Skip to content

Commit

Permalink
fix typing for sort key funcs
Browse files Browse the repository at this point in the history
  • Loading branch information
ilius committed Dec 16, 2024
1 parent 5aaf737 commit ea74d75
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pyglossary/sort_keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
from .icu_types import T_Collator, T_Locale
from .sort_keys_types import (
LocaleSortKeyMakerType,
LocaleSQLiteSortKeyMakerType,
SortKeyMakerType,
SQLiteSortKeyMakerType,
)
Expand Down Expand Up @@ -64,7 +65,6 @@ def module(self): # noqa: ANN201
self.mod = mod
return mod

# mypy seems to have problems with @property
@property
def normal(self) -> SortKeyMakerType:
return self.module.normal
Expand All @@ -78,7 +78,7 @@ def locale(self) -> LocaleSortKeyMakerType | None:
return getattr(self.module, "locale", None)

@property
def sqlite_locale(self) -> SQLiteSortKeyMakerType | None:
def sqlite_locale(self) -> LocaleSQLiteSortKeyMakerType | None:
return getattr(self.module, "sqlite_locale", None)


Expand Down
7 changes: 7 additions & 0 deletions pyglossary/sort_keys_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@ def __call__(
) -> SortKeyMakerType: ...


class LocaleSQLiteSortKeyMakerType(Protocol):
def __call__(
self,
collator: T_Collator, # noqa: F821
) -> SQLiteSortKeyMakerType: ...


__all__ = [
"LocaleSortKeyMakerType",
"SQLiteSortKeyType",
Expand Down

0 comments on commit ea74d75

Please sign in to comment.