Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some higher-order (?) ParamSpec usage #14903

Closed
wants to merge 17 commits into from

Conversation

A5rocks
Copy link
Contributor

@A5rocks A5rocks commented Mar 15, 2023

This PR just makes my own ParamSpec usages valid (I added a test). I probably need to do another scan of the issues to make sure I didn't fix anything else (cause I did my scan through before a couple more changes in this branch):

It feels like most of these are higher-order so I claim that this helps with that, but I'm not sure. Hopefully mypy primer is positive! I still need to add some regression tests.

Keep in mind that some of the changes are based on just changing things that seemed invalid when I was single-step debugging.

@AlexWaygood AlexWaygood added the topic-paramspec PEP 612, ParamSpec, Concatenate label Mar 15, 2023
@github-actions

This comment has been minimized.

@A5rocks

This comment was marked as outdated.

@A5rocks A5rocks marked this pull request as draft March 15, 2023 13:33
@github-actions

This comment has been minimized.

I don't actually know what I'm doing. The tests pass, I am happy.
@github-actions

This comment has been minimized.

@A5rocks A5rocks marked this pull request as ready for review March 25, 2023 02:57
@A5rocks
Copy link
Contributor Author

A5rocks commented Mar 25, 2023

I haven't taken a look at mypy primer yet, but at least now it isn't crashing! (marking as ready for review cause I expect fixing mypy primer will take probably only minor tweaks)

@github-actions
Copy link
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

sublime_debugger (https://github.com/daveleroy/sublime_debugger)
+ modules/core/asyncio.py:60: error: Overloaded function implementation does not accept all possible arguments of signature 1  [misc]
- modules/dap/session.py:105: error: Argument 1 to "add" of "Event" has incompatible type "Callable[[Any], Any]"; expected "Callable[[VarArg(Iterable[ExceptionBreakpointsFilter]), KwArg(Iterable[ExceptionBreakpointsFilter])], Any]"  [arg-type]
- modules/views/breakpoints.py:28: error: Argument 1 to "add" of "Event" has incompatible type "Callable[[Any], None]"; expected "Callable[[VarArg(Iterable[ExceptionBreakpointsFilter]), KwArg(Iterable[ExceptionBreakpointsFilter])], Any]"  [arg-type]
- modules/views/sources.py:21: error: Cannot determine type of "on_session_sources_updated"  [has-type]
- modules/views/sources.py:22: error: Cannot determine type of "on_session_removed"  [has-type]
- modules/views/modules.py:23: error: Cannot determine type of "on_session_modules_updated"  [has-type]
- modules/views/modules.py:24: error: Cannot determine type of "on_session_removed"  [has-type]
- modules/views/debugger.py:24: error: Cannot determine type of "on_session_active"  [has-type]
- modules/views/debugger.py:25: error: Cannot determine type of "on_session_added"  [has-type]
- modules/views/debugger.py:27: error: Argument 1 to "add" of "Event" has incompatible type "Callable[[], Any]"; expected "Callable[[VarArg(None), KwArg(None)], Any]"  [arg-type]
- modules/views/debugger.py:70: error: Cannot determine type of "on_session_removed"  [has-type]
- modules/views/debugger.py:71: error: Cannot infer type of lambda  [misc]
- modules/views/debugger.py:71: error: Argument 1 to "add" of "Event" has incompatible type "Callable[[], Any]"; expected "Callable[[VarArg(None), KwArg(None)], Any]"  [arg-type]
- modules/debugger_output_panel.py:21: error: Argument 1 to "add" of "Event" has incompatible type "Callable[[], Any]"; expected "Callable[[VarArg(None), KwArg(None)], Any]"  [arg-type]
- modules/views/variables.py:33: error: Cannot determine type of "on_session_variables_updated"  [has-type]
- modules/views/variables.py:34: error: Cannot determine type of "on_session_removed"  [has-type]
- modules/debugger.py:78: error: Incompatible types in assignment (expression has type "Event[Session]", base class "Debugger" defined the type as "Event[[Session]]")  [assignment]
- modules/debugger.py:79: error: Incompatible types in assignment (expression has type "Event[Session]", base class "Debugger" defined the type as "Event[[Session]]")  [assignment]
- modules/debugger.py:80: error: Incompatible types in assignment (expression has type "Event[Session]", base class "Debugger" defined the type as "Event[[Session]]")  [assignment]
- modules/debugger.py:82: error: Incompatible types in assignment (expression has type "Event[Session]", base class "Debugger" defined the type as "Event[[Session]]")  [assignment]
- modules/debugger.py:83: error: Incompatible types in assignment (expression has type "Event[Session]", base class "Debugger" defined the type as "Event[[Session]]")  [assignment]
- modules/debugger.py:84: error: Incompatible types in assignment (expression has type "Event[Session]", base class "Debugger" defined the type as "Event[[Session]]")  [assignment]
- modules/debugger.py:85: error: Incompatible types in assignment (expression has type "Event[Session]", base class "Debugger" defined the type as "Event[[Session]]")  [assignment]
- modules/debugger.py:87: error: Type application has too many types (1 expected)  [misc]
- modules/debugger.py:116: error: Argument 1 to "add" of "Event" has incompatible type "Callable[[str], Future[None]]"; expected "Callable[[VarArg(str), KwArg(str)], Any]"  [arg-type]
- modules/debugger.py:117: error: Argument 1 to "add" of "Event" has incompatible type "Callable[[SourceLocation], Any]"; expected "Callable[[VarArg(SourceLocation), KwArg(SourceLocation)], Any]"  [arg-type]
- modules/debugger.py:131: error: Argument 1 to "add" of "Event" has incompatible type "Callable[[], Any]"; expected "Callable[[VarArg(None), KwArg(None)], Any]"  [arg-type]
- modules/debugger.py:145: error: Cannot determine type of "on_session_active"  [has-type]
- modules/debugger.py:146: error: Cannot determine type of "on_session_added"  [has-type]
- modules/debugger.py:147: error: Cannot determine type of "on_session_removed"  [has-type]
- modules/debugger.py:347: error: Cannot determine type of "on_session_active"  [has-type]
- modules/debugger.py:353: error: Cannot determine type of "on_session_modules_updated"  [has-type]
- modules/debugger.py:356: error: Cannot determine type of "on_session_sources_updated"  [has-type]
- modules/debugger.py:359: error: Cannot determine type of "on_session_variables_updated"  [has-type]
- modules/debugger.py:362: error: Cannot determine type of "on_session_threads_updated"  [has-type]
- modules/debugger.py:370: error: Cannot determine type of "on_session_added"  [has-type]
- modules/debugger.py:371: error: Cannot determine type of "on_session_active"  [has-type]
- modules/debugger.py:393: error: Cannot determine type of "on_session_active"  [has-type]
- modules/debugger.py:395: error: Cannot determine type of "on_session_removed"  [has-type]
- modules/debugger.py:472: error: Cannot determine type of "on_session_active"  [has-type]

steam.py (https://github.com/Gobot1234/steam.py)
- steam/ext/commands/commands.py:265: error: Incompatible return value type (got "List[Command[Any]]", expected "List[Self]")  [return-value]
- steam/ext/commands/commands.py:693: error: "Command[Any]" has no attribute "__commands__"  [attr-defined]
- steam/ext/commands/commands.py:693: error: Item "Command[Any]" of "Optional[Command[Any]]" has no attribute "__commands__"  [union-attr]
+ steam/ext/commands/commands.py:693: error: Item "Command[Any]" of "Union[Group[[VarArg(Any), KwArg(Any)]], Command[Any]]" has no attribute "__commands__"  [union-attr]
- steam/ext/commands/commands.py:693: error: Item "None" of "Optional[Command[Any]]" has no attribute "__commands__"  [union-attr]
+ steam/ext/commands/commands.py:693: error: Item "Command[Any]" of "Union[Group[[VarArg(Any), KwArg(Any)]], Command[Any], Any]" has no attribute "__commands__"  [union-attr]
- steam/ext/commands/cog.py:86: error: "Group[Any]" has no attribute "__original_kwargs__"  [attr-defined]
+ steam/ext/commands/cog.py:86: error: "Group[[VarArg(Any), KwArg(Any)]]" has no attribute "__original_kwargs__"  [attr-defined]

prefect (https://github.com/PrefectHQ/prefect)
- src/prefect/client/base.py:34: error: Argument 1 to "asynccontextmanager" has incompatible type "Callable[[Any], AbstractContextManager[None]]"; expected "Callable[[Any], AsyncIterator[<nothing>]]"  [arg-type]
+ src/prefect/client/base.py:34: error: Argument 1 to "asynccontextmanager" has incompatible type "Callable[[Any], AbstractContextManager[None]]"; expected "Callable[[Any], AsyncIterator[_T_co]]"  [arg-type]
- src/prefect/context.py:380: error: Argument 1 to "contextmanager" has incompatible type "Callable[[VarArg(str)], Set[str]]"; expected "Callable[[VarArg(str)], Iterator[<nothing>]]"  [arg-type]
+ src/prefect/context.py:380: error: Argument 1 to "contextmanager" has incompatible type "Callable[[VarArg(str)], Set[str]]"; expected "Callable[[VarArg(str)], Iterator[_T_co]]"  [arg-type]
+ src/prefect/engine.py:2078: error: Argument 1 to "is_async_fn" has incompatible type "Callable[[Task[Any, Any], TaskRun, State[Any]], None]"; expected "Union[Callable[[VarArg(<nothing>), KwArg(<nothing>)], <nothing>], Callable[[VarArg(<nothing>), KwArg(<nothing>)], Awaitable[<nothing>]]]"  [arg-type]
+ src/prefect/engine.py:2079: error: Argument "task" has incompatible type "Task[Any, Any]"; expected <nothing>  [arg-type]
- src/prefect/engine.py:2079: error: Unexpected keyword argument "task"  [call-arg]
- src/prefect/engine.py:2079: error: Unexpected keyword argument "task_run"  [call-arg]
- src/prefect/engine.py:2079: error: Unexpected keyword argument "state"  [call-arg]

discord.py (https://github.com/Rapptz/discord.py)
+ discord/app_commands/tree.py:887: error: Need type annotation for "command"  [var-annotated]
+ discord/app_commands/tree.py:890: error: Argument "callback" to "Command" has incompatible type "Union[Callable[[Group, Interaction, **P], Coroutine[Any, Any, T]], Callable[[Interaction, **P], Coroutine[Any, Any, T]]]"; expected "Union[Callable[[<nothing>, Interaction, VarArg(<nothing>), KwArg(<nothing>)], Coroutine[Any, Any, <nothing>]], Callable[[Interaction, VarArg(<nothing>), KwArg(<nothing>)], Coroutine[Any, Any, <nothing>]]]"  [arg-type]
+ discord/app_commands/commands.py:1941: error: Need type annotation for "command"  [var-annotated]
+ discord/app_commands/commands.py:1944: error: Argument "callback" to "Command" has incompatible type "Union[Callable[[GroupT, Interaction, **P], Coroutine[Any, Any, T]], Callable[[Interaction, **P], Coroutine[Any, Any, T]]]"; expected "Union[Callable[[<nothing>, Interaction, VarArg(<nothing>), KwArg(<nothing>)], Coroutine[Any, Any, <nothing>]], Callable[[Interaction, VarArg(<nothing>), KwArg(<nothing>)], Coroutine[Any, Any, <nothing>]]]"  [arg-type]
- discord/ext/commands/context.py:609: error: Argument 1 has incompatible type "Group[Any, Any, Any]"; expected "Mapping[Optional[Cog], List[Command[Any, [VarArg(Any), KwArg(Any)], Any]]]"  [arg-type]
+ discord/ext/commands/context.py:609: error: Argument 1 has incompatible type "Group[Any, [VarArg(Any), KwArg(Any)], Any]"; expected "Mapping[Optional[Cog], List[Command[Any, [VarArg(Any), KwArg(Any)], Any]]]"  [arg-type]
- discord/ext/commands/context.py:612: error: Argument 1 has incompatible type "Command[Any, Any, Any]"; expected "Mapping[Optional[Cog], List[Command[Any, [VarArg(Any), KwArg(Any)], Any]]]"  [arg-type]
+ discord/ext/commands/context.py:612: error: Argument 1 has incompatible type "Command[Any, [VarArg(Any), KwArg(Any)], Any]"; expected "Mapping[Optional[Cog], List[Command[Any, [VarArg(Any), KwArg(Any)], Any]]]"  [arg-type]
+ discord/ext/commands/hybrid.py:816: error: Need type annotation for "result"  [var-annotated]
+ discord/ext/commands/hybrid.py:816: error: Argument 1 has incompatible type "Union[Callable[[CogT, ContextT, **P2], Coroutine[Any, Any, U]], Callable[[ContextT, **P2], Coroutine[Any, Any, U]]]"; expected "Union[Callable[[<nothing>, <nothing>, VarArg(<nothing>), KwArg(<nothing>)], Coroutine[Any, Any, <nothing>]], Callable[[<nothing>, VarArg(<nothing>), KwArg(<nothing>)], Coroutine[Any, Any, <nothing>]]]"  [arg-type]
+ discord/ext/commands/hybrid.py:820: error: Incompatible return value type (got "Callable[[Union[Callable[[CogT, ContextT, **P2], Coroutine[Any, Any, U]], Callable[[ContextT, **P2], Coroutine[Any, Any, U]]]], Any]", expected "Callable[[Union[Callable[[CogT, ContextT, **P2], Coroutine[Any, Any, U]], Callable[[ContextT, **P2], Coroutine[Any, Any, U]]]], HybridCommand[CogT, P2, U]]")  [return-value]
+ discord/ext/commands/hybrid.py:840: error: Need type annotation for "result"  [var-annotated]
+ discord/ext/commands/hybrid.py:840: error: Argument 1 has incompatible type "Union[Callable[[CogT, ContextT, **P2], Coroutine[Any, Any, U]], Callable[[ContextT, **P2], Coroutine[Any, Any, U]]]"; expected "Union[Callable[[<nothing>, <nothing>, VarArg(<nothing>), KwArg(<nothing>)], Coroutine[Any, Any, <nothing>]], Callable[[<nothing>, VarArg(<nothing>), KwArg(<nothing>)], Coroutine[Any, Any, <nothing>]]]"  [arg-type]
+ discord/ext/commands/hybrid.py:844: error: Incompatible return value type (got "Callable[[Union[Callable[[CogT, ContextT, **P2], Coroutine[Any, Any, U]], Callable[[ContextT, **P2], Coroutine[Any, Any, U]]]], Any]", expected "Callable[[Union[Callable[[CogT, ContextT, **P2], Coroutine[Any, Any, U]], Callable[[ContextT, **P2], Coroutine[Any, Any, U]]]], HybridGroup[CogT, P2, U]]")  [return-value]
+ discord/ext/commands/bot.py:290: error: Need type annotation for "result"  [var-annotated]
+ discord/ext/commands/bot.py:290: error: Argument 1 has incompatible type "Union[Callable[[Any, ContextT, **P], Coroutine[Any, Any, T]], Callable[[ContextT, **P], Coroutine[Any, Any, T]]]"; expected "Union[Callable[[<nothing>, <nothing>, VarArg(<nothing>), KwArg(<nothing>)], Coroutine[Any, Any, <nothing>]], Callable[[<nothing>, VarArg(<nothing>), KwArg(<nothing>)], Coroutine[Any, Any, <nothing>]]]"  [arg-type]
+ discord/ext/commands/bot.py:294: error: Incompatible return value type (got "Callable[[Union[Callable[[Any, ContextT, **P], Coroutine[Any, Any, T]], Callable[[ContextT, **P], Coroutine[Any, Any, T]]]], Any]", expected "Callable[[Union[Callable[[Any, ContextT, **P], Coroutine[Any, Any, T]], Callable[[ContextT, **P], Coroutine[Any, Any, T]]]], HybridCommand[Any, P, T]]")  [return-value]
+ discord/ext/commands/bot.py:314: error: Need type annotation for "result"  [var-annotated]
+ discord/ext/commands/bot.py:314: error: Argument 1 has incompatible type "Union[Callable[[Any, ContextT, **P], Coroutine[Any, Any, T]], Callable[[ContextT, **P], Coroutine[Any, Any, T]]]"; expected "Union[Callable[[<nothing>, <nothing>, VarArg(<nothing>), KwArg(<nothing>)], Coroutine[Any, Any, <nothing>]], Callable[[<nothing>, VarArg(<nothing>), KwArg(<nothing>)], Coroutine[Any, Any, <nothing>]]]"  [arg-type]
+ discord/ext/commands/bot.py:318: error: Incompatible return value type (got "Callable[[Union[Callable[[Any, ContextT, **P], Coroutine[Any, Any, T]], Callable[[ContextT, **P], Coroutine[Any, Any, T]]]], Any]", expected "Callable[[Union[Callable[[Any, ContextT, **P], Coroutine[Any, Any, T]], Callable[[ContextT, **P], Coroutine[Any, Any, T]]]], HybridGroup[Any, P, T]]")  [return-value]

hydra-zen (https://github.com/mit-ll-responsible-ai/hydra-zen)
+ src/hydra_zen/wrapper/_implementations.py:463: error: Incompatible default for argument "ZenWrapper" (default has type "Type[Zen[Any, Any]]", argument has type "Type[Zen[P, R]]")  [assignment]
+ src/hydra_zen/wrapper/_implementations.py:487: error: Incompatible default for argument "ZenWrapper" (default has type "Type[Zen[Any, Any]]", argument has type "Type[Zen[P, R]]")  [assignment]

Expression (https://github.com/cognitedata/Expression)
+ ./expression/core/fn.py:37: error: INTERNAL ERROR -- Please try using mypy master on GitHub:
+ https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
+ Please report a bug at https://github.com/python/mypy/issues
+ version: 1.3.0+dev.cb642fd4fe2eb7d34a412bbb035e32e34105c797
+ ./expression/core/fn.py:37: : note: use --pdb to drop into pdb
- expression/core/fn.py:38: error: List or tuple expected as variadic arguments  [misc]
- expression/core/fn.py:38: error: Argument after ** must be a mapping, not "Union[Any, _P.kwargs]"  [arg-type]
- expression/core/fn.py:57: error: List or tuple expected as variadic arguments  [misc]
- expression/core/fn.py:57: error: Argument after ** must be a mapping, not "Union[Any, _P.kwargs]"  [arg-type]
- expression/core/pipe.py:208: error: Cannot call function of unknown type  [operator]
- expression/core/union.py:62: error: Incompatible default for argument "value" (default has type "None", argument has type "_T")  [assignment]
- expression/core/union.py:62: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- expression/core/union.py:62: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- expression/core/union.py:135: error: Access to generic instance variables via class is ambiguous  [misc]
- expression/core/union.py:136: error: Access to generic instance variables via class is ambiguous  [misc]
- expression/extra/result/pipeline.py:105: error: Argument 1 to "reduce" has incompatible type "Callable[[Callable[[Any], Union[Ok[Any, Any], Error[Any, Any]]], Callable[[Any], Union[Ok[Any, Any], Error[Any, Any]]]], Callable[[Any], Union[Ok[Any, Any], Error[Any, Any]]]]"; expected "Callable[[Type[Ok[Any, Any]], Callable[[Any], Union[Ok[Any, Any], Error[Any, Any]]]], Type[Ok[Any, Any]]]"  [arg-type]
- expression/system/cancellation.py:59: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
- tests/test_disposable.py:9: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
- tests/test_disposable.py:19: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
- tests/test_disposable.py:32: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
- tests/test_disposable.py:42: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
- tests/test_disposable.py:57: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
- tests/test_disposable.py:75: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
- tests/test_cancellation.py:66: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
- tests/test_cancellation.py:77: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
- tests/test_cancellation.py:89: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
- expression/collections/asyncseq.py:24: error: Module not callable  [operator]
- expression/collections/block.py:814: error: Overloaded function implementation cannot produce return type of signature 1  [misc]
- expression/collections/block.py:814: error: Overloaded function implementation cannot produce return type of signature 2  [misc]
- expression/collections/block.py:814: error: Overloaded function implementation cannot produce return type of signature 3  [misc]
- expression/collections/array.py:249: error: Only instance methods can be decorated with @property  [misc]
- expression/collections/array.py:483: error: Signature of "__setitem__" incompatible with supertype "MutableSequence"  [override]
- expression/collections/array.py:483: note:      Superclass:
- expression/collections/array.py:483: note:          @overload
- expression/collections/array.py:483: note:          def __setitem__(self, int, _TSource, /) -> None
- expression/collections/array.py:483: note:          @overload
- expression/collections/array.py:483: note:          def __setitem__(self, slice, Iterable[_TSource], /) -> None
- expression/collections/array.py:483: note:      Subclass:
- expression/collections/array.py:483: note:          def __setitem__(self, int, _TSource, /) -> None
- expression/collections/array.py:489: error: Signature of "__delitem__" incompatible with supertype "MutableSequence"  [override]
- expression/collections/array.py:489: note:      Superclass:
- expression/collections/array.py:489: note:          @overload
- expression/collections/array.py:489: note:          def __delitem__(self, int, /) -> None
- expression/collections/array.py:489: note:          @overload
- expression/collections/array.py:489: note:          def __delitem__(self, slice, /) -> None
- expression/collections/array.py:489: note:      Subclass:
- expression/collections/array.py:489: note:          def __delitem__(self, int, /) -> None
- expression/collections/maptree.py:66: error: Type variable "expression.collections.maptree.Key" is unbound  [valid-type]
- expression/collections/maptree.py:66: note: (Hint: Use "Generic[Key]" or "Protocol[Key]" base class to bind "Key" inside a class)
- expression/collections/maptree.py:66: note: (Hint: Use "Key" in function signature to bind "Key" inside a function)
- expression/collections/maptree.py:66: error: Type variable "expression.collections.maptree.Value" is unbound  [valid-type]
- expression/collections/maptree.py:66: note: (Hint: Use "Generic[Value]" or "Protocol[Value]" base class to bind "Value" inside a class)
- expression/collections/maptree.py:66: note: (Hint: Use "Value" in function signature to bind "Value" inside a function)
- expression/collections/maptree.py:81: error: Type variable "expression.collections.maptree.Key" is unbound  [valid-type]
- expression/collections/maptree.py:81: note: (Hint: Use "Generic[Key]" or "Protocol[Key]" base class to bind "Key" inside a class)
- expression/collections/maptree.py:81: note: (Hint: Use "Key" in function signature to bind "Key" inside a function)
- expression/collections/maptree.py:81: error: Type variable "expression.collections.maptree.Value" is unbound  [valid-type]
- expression/collections/maptree.py:81: note: (Hint: Use "Generic[Value]" or "Protocol[Value]" base class to bind "Value" inside a class)
- expression/collections/maptree.py:81: note: (Hint: Use "Value" in function signature to bind "Value" inside a function)
- expression/collections/maptree.py:356: error: Type variable "expression.collections.maptree.Value" is unbound  [valid-type]
- expression/collections/maptree.py:356: note: (Hint: Use "Generic[Value]" or "Protocol[Value]" base class to bind "Value" inside a class)
- expression/collections/maptree.py:356: note: (Hint: Use "Value" in function signature to bind "Value" inside a function)
- expression/extra/parser.py:70: error: Argument 1 to "or_else" has incompatible type "Parser[_A]"; expected "Parser[_A]"  [arg-type]
- expression/extra/parser.py:73: error: Argument 1 to "map" has incompatible type "Callable[[_A], _B]"; expected "Callable[[_A], _B]"  [arg-type]
- expression/extra/parser.py:90: error: No overload variant of "starmap" matches argument type "Callable[..., Any]"  [call-overload]
- expression/extra/parser.py:90: note: Possible overload variants:
- expression/extra/parser.py:90: note:     def [_A, _B, _C] starmap(mapper: Callable[[_A, _B], _C], parser: Parser[Tuple[_A, _B]]) -> Parser[_C]
- expression/extra/parser.py:90: note:     def [_A, _B, _C, _D] starmap(mapper: Callable[[_A, _B, _C], _D], parser: Parser[Tuple[_A, _B, _C]]) -> Parser[_D]
- expression/extra/parser.py:99: error: Argument 1 to "bind" has incompatible type "Callable[[_A], Parser[_B]]"; expected "Callable[[_A], Parser[_B]]"  [arg-type]
- expression/extra/parser.py:182: error: Cannot infer type argument 1 of "pipe"  [misc]
- expression/extra/parser.py:182: error: Cannot infer type argument 2 of "pipe"  [misc]
- expression/extra/parser.py:233: error: Overloaded function implementation does not accept all possible arguments of signature 1  [misc]
- expression/extra/parser.py:233: error: Overloaded function implementation cannot produce return type of signature 1  [misc]
- expression/extra/parser.py:233: error: Overloaded function implementation does not accept all possible arguments of signature 2  [misc]
- expression/extra/parser.py:233: error: Overloaded function implementation cannot produce return type of signature 2  [misc]
- expression/extra/parser.py:240: error: Argument 1 to "map" has incompatible type "Callable[[Tuple[Any, ...]], Any]"; expected "Callable[[_A], _B]"  [arg-type]
- expression/extra/parser.py:263: error: Cannot infer type argument 1 of "pipe"  [misc]
- expression/extra/parser.py:267: error: Argument 1 to "map" has incompatible type "Callable[[Tuple[Callable[[_A], _B], _A]], _B]"; expected "Callable[[_A], _B]"  [arg-type]
- expression/extra/parser.py:278: error: Missing return statement  [return]
- expression/extra/parser.py:285: error: Argument 1 to "lift2" has incompatible type "Callable[[_A], Callable[[Block[_A]], Block[_A]]]"; expected "Callable[[_A], Callable[[_B], _C]]"  [arg-type]
- expression/extra/parser.py:297: error: Cannot infer type argument 1 of "pipe"  [misc]
- expression/extra/parser.py:297: error: Cannot infer type argument 2 of "pipe"  [misc]
- expression/extra/parser.py:297: error: Cannot infer type argument 3 of "pipe"  [misc]

... (truncated 228 lines) ...

A5rocks added a commit to A5rocks/mypy that referenced this pull request May 16, 2023
This is more:tm: correct as shown by changes in test cases. I can't find
any issues that are closed by this though. From what I remember, this
was a followup fix for python#14903 in
order to fix some incorrect mypy-primer output.
@A5rocks
Copy link
Contributor Author

A5rocks commented Jun 14, 2023

Most of these changes are split out and I'll have to reconsider others once #15287 is merged (... once I figure out what it all means, anyways.)

@A5rocks A5rocks closed this Jun 14, 2023
hauntsaninja pushed a commit that referenced this pull request Aug 9, 2023
- Fixes #15037
- Fixes #15065
- Fixes #15073
- Fixes #15388
- Fixes #15086

Yet another part of #14903 that's
finally been extracted!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment