Skip to content

Commit

Permalink
Fixed up signature for FilterMeta.__init__ 🧼
Browse files Browse the repository at this point in the history
  • Loading branch information
todofixthis committed Oct 19, 2024
1 parent 67f8346 commit 6097d6f
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/filters/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@
"Type",
]

T = typing.TypeVar("T")

FilterCompatible = typing.Optional[
typing.Union[
"BaseFilter",
"BaseFilter[T]",
"FilterMeta",
typing.Callable[[], "BaseFilter"],
typing.Callable[[], "BaseFilter[T]"],
]
]
"""
Expand All @@ -33,7 +35,13 @@ class FilterMeta(ABCMeta):
"""

# noinspection PyShadowingBuiltins
def __init__(cls, what, bases=None, dict=None, **kwargs):
def __init__(
cls,
what: str,
bases: tuple[type, ...],
dict: dict[str, typing.Any],
**kwargs: typing.Any,
):
super().__init__(what, bases, dict, **kwargs)

if not hasattr(cls, "templates"):
Expand Down Expand Up @@ -66,9 +74,6 @@ def __or__(self, next_filter: FilterCompatible) -> "FilterChain":
return FilterChain(self) | next_filter


T = typing.TypeVar("T")


class BaseFilter(typing.Generic[T], metaclass=FilterMeta):
"""
Base functionality for all Filters, macros, etc.
Expand Down

0 comments on commit 6097d6f

Please sign in to comment.