Skip to content

Commit

Permalink
Partially-fixed incorrect return type syntax 🙈
Browse files Browse the repository at this point in the history
This is what you get for blindly trusting an LLM without checking its work 😅
mypy says there's more work to do here, but this will do for now.
  • Loading branch information
todofixthis committed Oct 19, 2024
1 parent 8b011d5 commit 8e51f3b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/filters/macros.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,16 @@ def MyMacro():
pass


F = typing.TypeVar('F', bound=FilterCompatible)
P = typing.ParamSpec('P')
R = typing.TypeVar('R', bound=FilterMacroType)
F = typing.TypeVar("F", bound=FilterCompatible)
P = typing.ParamSpec("P")
R = typing.TypeVar("R", bound=FilterMacroType)


@typing.overload
def filter_macro(
func: typing.Callable[P, R],
/,
) -> typing.Type[FilterMacroType] & typing.Callable[P, R]:
) -> typing.Type[FilterMacroType] | typing.Callable[P, R]:
"""Bare decorator variant"""
...

Expand All @@ -53,7 +53,7 @@ def filter_macro(
func: typing.Callable[P, F],
*args: typing.Unpack[P.args],
**kwargs: typing.Unpack[P.kwargs],
) -> typing.Type[FilterMacroType] & F:
) -> typing.Type[FilterMacroType] | F:
"""Decorator factory variant"""
...

Expand All @@ -62,7 +62,7 @@ def filter_macro(
func: typing.Callable[P, R],
*args: typing.Unpack[P.args],
**kwargs: typing.Unpack[P.kwargs],
) -> typing.Type[FilterMacroType] & typing.Callable[P, R]:
) -> typing.Type[FilterMacroType] | typing.Callable[P, R]:
"""
Promotes a function that returns a filter into its own filter type.
Expand Down

0 comments on commit 8e51f3b

Please sign in to comment.