Skip to content

Commit

Permalink
fix pyright compatibility issues
Browse files Browse the repository at this point in the history
  • Loading branch information
hitblast committed Dec 30, 2024
1 parent 085b939 commit b189928
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# uv-specific things
[project]
name = "avro-py"
version = "2024.12.9"
version = "2024.12.30"
description = "A modern Pythonic implementation of Avro Phonetic."
readme = "README.md"
license = { file = "LICENSE" }
Expand Down
2 changes: 1 addition & 1 deletion src/avro/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@
from .main import *

# Version information.
__version_info__ = (2024, 12, 9)
__version_info__ = (2024, 12, 30)
__version__ = ".".join(map(str, __version_info__))
26 changes: 13 additions & 13 deletions src/avro/core/processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,9 @@ def match_patterns(
"matched": True,
"found": p.get("find"),
"replaced": p.get("replace"),
"reversed": reverse_with_rules(cur, fixed_text, p.get("reverse"))
"reversed": reverse_with_rules(
cur, fixed_text, p.get("reverse", None)
)
if not rule
else None,
"rules": p.get("rules") if rule else None,
Expand Down Expand Up @@ -213,7 +215,7 @@ def reverse_with_rules(


def process_rules(
rules: dict[str, Any], fixed_text: str, cur: int = 0, cur_end: int = 1
rules: Any, fixed_text: str, cur: int = 0, cur_end: int = 1
) -> Optional[str]:
"""Process rules matched in pattern and returns suitable replacement.
Expand Down Expand Up @@ -242,6 +244,7 @@ def process_rules(
"""

replaced = ""
matched = False

# Iterate through rules.
for rule in rules:
Expand Down Expand Up @@ -408,17 +411,13 @@ def rearrange_unicode_text(text: str) -> str:
else:
break

(
chars[i - 1],
chars[i],
chars[i + 1 : i + j + found_pre_kar + 1],
chars[i + j + 1 :],
) = (
chars[i + j + 1],
chars[i + 1 : i + j + 1],
chars[i - 1],
chars[i],
chars[i + j + found_pre_kar + 1 :],
chars = (
chars[: i - 1]
+ [chars[i + j + 1]]
+ chars[i + 1 : i + j + 1]
+ [chars[i - 1]]
+ [chars[i]]
+ chars[i + j + found_pre_kar + 1 :]
)
i += j + found_pre_kar
barrier = i + 1
Expand Down Expand Up @@ -510,6 +509,7 @@ def rearrange_bijoy_text(text: str) -> str:
and text[i + 1] != " "
):
j = 1
part = ""
while validate.is_bangla_banjonborno(text[i + j]):
if validate.is_bangla_halant((part := text[i + j + 1])):
j += 2
Expand Down

0 comments on commit b189928

Please sign in to comment.