Use pretty_callable for callables with non-positional args#12037
Use pretty_callable for callables with non-positional args#1203797littleleaf11 wants to merge 5 commits into
Conversation
|
cc @JukkaL |
|
|
||
| def format_key_list(keys: List[str], *, short: bool = False) -> str: | ||
| def format_typeddict_key_list(keys: List[str], *, short: bool = False) -> str: | ||
| formatted_keys = ['"{}"'.format(key) for key in keys] |
There was a problem hiding this comment.
I renamed this for it's only used for typeddict
| [out] | ||
| _program.py:4: error: Argument 1 to "map" has incompatible type "Callable[[VarArg(str)], str]"; expected "Callable[[int], str]" | ||
| _program.py:4: error: Argument 1 to "map" has incompatible type "def f(*args: str) -> str"; expected "Callable[[int], str]" | ||
|
|
There was a problem hiding this comment.
Two formats in one error message.
There was a problem hiding this comment.
FWIW I would prefer to always use same format in same error message (if it is easy to implement).
This comment has been minimized.
This comment has been minimized.
|
The result of mypy_primer shows that this change is useful. |
| call_soon(Bad1()) # E: Argument 1 to "call_soon" has incompatible type "Bad1"; expected "def (x: int, *str) -> int" \ | ||
| # N: "Bad1.__call__" has type "def __call__(self, x: int, *rest: int) -> int" | ||
| call_soon(Bad2()) # E: Argument 1 to "call_soon" has incompatible type "Bad2"; expected "def (x: int, *str) -> int" \ | ||
| # N: "Bad2.__call__" has type "def __call__(self, y: int, *rest: str) -> int" |
There was a problem hiding this comment.
I think we should not repeat the name here if possible.
There was a problem hiding this comment.
You mean the __call__ should not repeat in the note?
There was a problem hiding this comment.
I mean __call__ appears twice in the note
"Bad2.__call__" has type "def __call__(self, ...
I think it should be
"Bad2.__call__" has type "def (self, ...
if possible.
| [out] | ||
| _program.py:4: error: Argument 1 to "map" has incompatible type "Callable[[VarArg(str)], str]"; expected "Callable[[int], str]" | ||
| _program.py:4: error: Argument 1 to "map" has incompatible type "def f(*args: str) -> str"; expected "Callable[[int], str]" | ||
|
|
There was a problem hiding this comment.
FWIW I would prefer to always use same format in same error message (if it is easy to implement).
|
It would be nice to finish up this PR. Would anybody like to fix the conflicts so that this can be merged? |
|
I just merge the master branch without fixing the issue about inconsistency format inside one line. |
|
Diff from mypy_primer, showing the effect of this PR on open source code: comtypes (https://github.com/enthought/comtypes)
- comtypes/_memberspec.py:243: error: Incompatible types in assignment (expression has type "Callable[..., Any] | None", variable has type "Callable[[Any, VarArg(Any)], Any]") [assignment]
+ comtypes/_memberspec.py:243: error: Incompatible types in assignment (expression has type "Callable[..., Any] | None", variable has type "def put_or_putref(self: Any, *args: Any) -> Any") [assignment]
Tanjun (https://github.com/FasterSpeeding/Tanjun)
- tanjun/dependencies/limiters.py:782: error: Argument 1 to "add_pre_execution" of "Hooks" has incompatible type "CooldownPreExecution"; expected "Callable[[_ContextT_contra, VarArg(Any), KwArg(Any)], Optional[Coroutine[Any, Any, None]]]" [arg-type]
+ tanjun/dependencies/limiters.py:782: error: Argument 1 to "add_pre_execution" of "Hooks" has incompatible type "CooldownPreExecution"; expected "def (_ContextT_contra, /, *Any, **Any) -> Optional[Coroutine[Any, Any, None]]" [arg-type]
- tanjun/dependencies/limiters.py:782: note: "CooldownPreExecution.__call__" has type "Callable[[Context, Arg(AbstractCooldownManager, 'cooldowns'), DefaultNamedArg(Optional[AbstractLocaliser], 'localiser'), NamedArg(Optional[AbstractOwners], 'owner_check')], Coroutine[Any, Any, None]]"
+ tanjun/dependencies/limiters.py:782: note: "CooldownPreExecution.__call__" has type "def __call__(self, Context, /, cooldowns: AbstractCooldownManager, *, localiser: Optional[AbstractLocaliser] = ..., owner_check: Optional[AbstractOwners]) -> Coroutine[Any, Any, None]"
- tanjun/dependencies/limiters.py:1137: error: Argument 1 to "add_pre_execution" of "Hooks" has incompatible type "ConcurrencyPreExecution"; expected "Callable[[_ContextT_contra, VarArg(Any), KwArg(Any)], Optional[Coroutine[Any, Any, None]]]" [arg-type]
+ tanjun/dependencies/limiters.py:1137: error: Argument 1 to "add_pre_execution" of "Hooks" has incompatible type "ConcurrencyPreExecution"; expected "def (_ContextT_contra, /, *Any, **Any) -> Optional[Coroutine[Any, Any, None]]" [arg-type]
- tanjun/dependencies/limiters.py:1137: note: "ConcurrencyPreExecution.__call__" has type "Callable[[Context, Arg(AbstractConcurrencyLimiter, 'limiter'), DefaultNamedArg(Optional[AbstractLocaliser], 'localiser')], Coroutine[Any, Any, None]]"
+ tanjun/dependencies/limiters.py:1137: note: "ConcurrencyPreExecution.__call__" has type "def __call__(self, Context, /, limiter: AbstractConcurrencyLimiter, *, localiser: Optional[AbstractLocaliser] = ...) -> Coroutine[Any, Any, None]"
- tanjun/dependencies/limiters.py:1137: error: Argument 1 to "add_post_execution" of "Hooks" has incompatible type "ConcurrencyPostExecution"; expected "Callable[[_ContextT_contra, VarArg(Any), KwArg(Any)], Optional[Coroutine[Any, Any, None]]]" [arg-type]
+ tanjun/dependencies/limiters.py:1137: error: Argument 1 to "add_post_execution" of "Hooks" has incompatible type "ConcurrencyPostExecution"; expected "def (_ContextT_contra, /, *Any, **Any) -> Optional[Coroutine[Any, Any, None]]" [arg-type]
- tanjun/dependencies/limiters.py:1137: note: "ConcurrencyPostExecution.__call__" has type "Callable[[Context, Arg(AbstractConcurrencyLimiter, 'limiter')], Coroutine[Any, Any, None]]"
+ tanjun/dependencies/limiters.py:1137: note: "ConcurrencyPostExecution.__call__" has type "def __call__(self, Context, /, limiter: AbstractConcurrencyLimiter) -> Coroutine[Any, Any, None]"
- tanjun/checks.py:628: error: Argument 2 to "_optional_kwargs" has incompatible type "DmCheck"; expected "Callable[[_ContextT_contra, VarArg(Any), KwArg(Any)], Union[Coroutine[Any, Any, bool], bool]]" [arg-type]
+ tanjun/checks.py:628: error: Argument 2 to "_optional_kwargs" has incompatible type "DmCheck"; expected "def (_ContextT_contra, /, *Any, **Any) -> Union[Coroutine[Any, Any, bool], bool]" [arg-type]
- tanjun/checks.py:628: note: "DmCheck.__call__" has type "Callable[[Context, DefaultNamedArg(Optional[AbstractLocaliser], 'localiser')], bool]"
+ tanjun/checks.py:628: note: "DmCheck.__call__" has type "def __call__(self, Context, /, *, localiser: Optional[AbstractLocaliser] = ...) -> bool"
- tanjun/checks.py:694: error: Argument 2 to "_optional_kwargs" has incompatible type "GuildCheck"; expected "Callable[[_ContextT_contra, VarArg(Any), KwArg(Any)], Union[Coroutine[Any, Any, bool], bool]]" [arg-type]
+ tanjun/checks.py:694: error: Argument 2 to "_optional_kwargs" has incompatible type "GuildCheck"; expected "def (_ContextT_contra, /, *Any, **Any) -> Union[Coroutine[Any, Any, bool], bool]" [arg-type]
- tanjun/checks.py:694: note: "GuildCheck.__call__" has type "Callable[[Context, DefaultNamedArg(Optional[AbstractLocaliser], 'localiser')], bool]"
+ tanjun/checks.py:694: note: "GuildCheck.__call__" has type "def __call__(self, Context, /, *, localiser: Optional[AbstractLocaliser] = ...) -> bool"
- tanjun/checks.py:756: error: Argument 2 to "_optional_kwargs" has incompatible type "NsfwCheck"; expected "Callable[[_ContextT_contra, VarArg(Any), KwArg(Any)], Union[Coroutine[Any, Any, bool], bool]]" [arg-type]
+ tanjun/checks.py:756: error: Argument 2 to "_optional_kwargs" has incompatible type "NsfwCheck"; expected "def (_ContextT_contra, /, *Any, **Any) -> Union[Coroutine[Any, Any, bool], bool]" [arg-type]
- tanjun/checks.py:756: note: "NsfwCheck.__call__" has type "Callable[[Context, DefaultNamedArg(Optional[AbstractLocaliser], 'localiser')], Coroutine[Any, Any, bool]]"
+ tanjun/checks.py:756: note: "NsfwCheck.__call__" has type "def __call__(self, Context, /, *, localiser: Optional[AbstractLocaliser] = ...) -> Coroutine[Any, Any, bool]"
- tanjun/checks.py:818: error: Argument 2 to "_optional_kwargs" has incompatible type "SfwCheck"; expected "Callable[[_ContextT_contra, VarArg(Any), KwArg(Any)], Union[Coroutine[Any, Any, bool], bool]]" [arg-type]
+ tanjun/checks.py:818: error: Argument 2 to "_optional_kwargs" has incompatible type "SfwCheck"; expected "def (_ContextT_contra, /, *Any, **Any) -> Union[Coroutine[Any, Any, bool], bool]" [arg-type]
- tanjun/checks.py:818: note: "SfwCheck.__call__" has type "Callable[[Context, DefaultNamedArg(Optional[AbstractLocaliser], 'localiser')], Coroutine[Any, Any, bool]]"
+ tanjun/checks.py:818: note: "SfwCheck.__call__" has type "def __call__(self, Context, /, *, localiser: Optional[AbstractLocaliser] = ...) -> Coroutine[Any, Any, bool]"
- tanjun/checks.py:880: error: Argument 2 to "_optional_kwargs" has incompatible type "OwnerCheck"; expected "Callable[[_ContextT_contra, VarArg(Any), KwArg(Any)], Union[Coroutine[Any, Any, bool], bool]]" [arg-type]
+ tanjun/checks.py:880: error: Argument 2 to "_optional_kwargs" has incompatible type "OwnerCheck"; expected "def (_ContextT_contra, /, *Any, **Any) -> Union[Coroutine[Any, Any, bool], bool]" [arg-type]
- tanjun/checks.py:880: note: "OwnerCheck.__call__" has type "Callable[[Context, Arg(AbstractOwners, 'dependency'), DefaultNamedArg(Optional[AbstractLocaliser], 'localiser')], Coroutine[Any, Any, bool]]"
+ tanjun/checks.py:880: note: "OwnerCheck.__call__" has type "def __call__(self, Context, /, dependency: AbstractOwners, *, localiser: Optional[AbstractLocaliser] = ...) -> Coroutine[Any, Any, bool]"
- tanjun/checks.py:936: error: Argument 2 to "_add_to_command" has incompatible type "AuthorPermissionCheck"; expected "Callable[[_ContextT_contra, VarArg(Any), KwArg(Any)], Union[Coroutine[Any, Any, bool], bool]]" [arg-type]
+ tanjun/checks.py:936: error: Argument 2 to "_add_to_command" has incompatible type "AuthorPermissionCheck"; expected "def (_ContextT_contra, /, *Any, **Any) -> Union[Coroutine[Any, Any, bool], bool]" [arg-type]
- tanjun/checks.py:936: note: "AuthorPermissionCheck.__call__" has type "Callable[[Context, DefaultNamedArg(Optional[AbstractLocaliser], 'localiser')], Coroutine[Any, Any, bool]]"
+ tanjun/checks.py:936: note: "AuthorPermissionCheck.__call__" has type "def __call__(self, Context, /, *, localiser: Optional[AbstractLocaliser] = ...) -> Coroutine[Any, Any, bool]"
- tanjun/checks.py:993: error: Argument 2 to "_add_to_command" has incompatible type "OwnPermissionCheck"; expected "Callable[[_ContextT_contra, VarArg(Any), KwArg(Any)], Union[Coroutine[Any, Any, bool], bool]]" [arg-type]
+ tanjun/checks.py:993: error: Argument 2 to "_add_to_command" has incompatible type "OwnPermissionCheck"; expected "def (_ContextT_contra, /, *Any, **Any) -> Union[Coroutine[Any, Any, bool], bool]" [arg-type]
- tanjun/checks.py:993: note: "OwnPermissionCheck.__call__" has type "Callable[[Context, DefaultNamedArg(Optional[AbstractLocaliser], 'localiser'), DefaultNamedArg(OwnUser, 'my_user'), DefaultNamedArg(Optional[GuildBoundCache[Union[Snowflake, int], Member]], 'member_cache')], Coroutine[Any, Any, bool]]"
+ tanjun/checks.py:993: note: "OwnPermissionCheck.__call__" has type "def __call__(self, Context, /, *, localiser: Optional[AbstractLocaliser] = ..., my_user: OwnUser = ..., member_cache: Optional[GuildBoundCache[Union[Snowflake, int], Member]] = ...) -> Coroutine[Any, Any, bool]"
- tanjun/checks.py:1154: error: Argument 2 to "_add_to_command" has incompatible type "Callable[[_ContextT_contra], Coroutine[Any, Any, bool]]"; expected "Callable[[_ContextT_contra, VarArg(Any), KwArg(Any)], Union[Coroutine[Any, Any, bool], bool]]" [arg-type]
+ tanjun/checks.py:1154: error: Argument 2 to "_add_to_command" has incompatible type "Callable[[_ContextT_contra], Coroutine[Any, Any, bool]]"; expected "def (_ContextT_contra, /, *Any, **Any) -> Union[Coroutine[Any, Any, bool], bool]" [arg-type]
- tanjun/checks.py:1343: error: Argument 2 to "_add_to_command" has incompatible type "_AnyCallback[<nothing>]"; expected "Callable[[_ContextT_contra, VarArg(Any), KwArg(Any)], Union[Coroutine[Any, Any, bool], bool]]" [arg-type]
+ tanjun/checks.py:1343: error: Argument 2 to "_add_to_command" has incompatible type "_AnyCallback[<nothing>]"; expected "def (_ContextT_contra, /, *Any, **Any) -> Union[Coroutine[Any, Any, bool], bool]" [arg-type]
- tanjun/checks.py:1343: note: "_AnyCallback[<nothing>].__call__" has type "Callable[[<nothing>, DefaultNamedArg(Optional[AbstractLocaliser], 'localiser')], Coroutine[Any, Any, bool]]"
+ tanjun/checks.py:1343: note: "_AnyCallback[<nothing>].__call__" has type "def __call__(self, <nothing>, /, *, localiser: Optional[AbstractLocaliser] = ...) -> Coroutine[Any, Any, bool]"
... (truncated 6 lines) ...
dragonchain (https://github.com/dragonchain/dragonchain)
- dragonchain/lib/database/redis_utest.py:114:9: error: "Callable[[VarArg(Union[str, bytes])], int]" has no attribute "assert_called_once_with" [attr-defined]
+ dragonchain/lib/database/redis_utest.py:114:9: error: "def delete(self, *names: Union[str, bytes]) -> int" has no attribute "assert_called_once_with" [attr-defined]
- dragonchain/lib/database/redis_utest.py:122:9: error: "Callable[[bool, KwArg(Union[Any, Any])], bool]" has no attribute "assert_called_once" [attr-defined]
+ dragonchain/lib/database/redis_utest.py:122:9: error: "def flushall(self, asynchronous: bool = ..., **kwargs: Union[Any, Any]) -> bool" has no attribute "assert_called_once" [attr-defined]
- dragonchain/lib/database/redis_utest.py:126:9: error: "Callable[[Union[str, bytes], VarArg(Union[str, bytes])], int]" has no attribute "assert_called_once_with" [attr-defined]
+ dragonchain/lib/database/redis_utest.py:126:9: error: "def hdel(self, name: Union[str, bytes], *keys: Union[str, bytes]) -> int" has no attribute "assert_called_once_with" [attr-defined]
- dragonchain/lib/database/redis_utest.py:130:9: error: "Callable[[Union[bytes, float, int, str], VarArg(Union[bytes, float, int, str])], int]" has no attribute "assert_called_once_with" [attr-defined]
- dragonchain/lib/database/redis_utest.py:134:9: error: "Callable[[Union[bytes, float, int, str], VarArg(Union[bytes, float, int, str])], int]" has no attribute "assert_called_once_with" [attr-defined]
+ dragonchain/lib/database/redis_utest.py:130:9: error: "def lpush(self, name: Union[bytes, float, int, str], *values: Union[bytes, float, int, str]) -> int" has no attribute "assert_called_once_with" [attr-defined]
+ dragonchain/lib/database/redis_utest.py:134:9: error: "def rpush(self, name: Union[bytes, float, int, str], *values: Union[bytes, float, int, str]) -> int" has no attribute "assert_called_once_with" [attr-defined]
- dragonchain/lib/database/redis_utest.py:138:9: error: "Callable[[VarArg(Union[str, bytes])], int]" has no attribute "assert_called_once_with" [attr-defined]
+ dragonchain/lib/database/redis_utest.py:138:9: error: "def delete(self, *names: Union[str, bytes]) -> int" has no attribute "assert_called_once_with" [attr-defined]
- dragonchain/lib/database/redis_utest.py:174:9: error: "Callable[[Union[str, bytes], VarArg(Union[bytes, float, int, str])], int]" has no attribute "assert_called_once_with" [attr-defined]
+ dragonchain/lib/database/redis_utest.py:174:9: error: "def sadd(self, name: Union[str, bytes], *values: Union[bytes, float, int, str]) -> int" has no attribute "assert_called_once_with" [attr-defined]
- dragonchain/lib/database/redis_utest.py:186:9: error: "Callable[[Union[str, bytes], VarArg(Union[bytes, float, int, str])], int]" has no attribute "assert_called_once_with" [attr-defined]
+ dragonchain/lib/database/redis_utest.py:186:9: error: "def srem(self, name: Union[str, bytes], *values: Union[bytes, float, int, str]) -> int" has no attribute "assert_called_once_with" [attr-defined]
spack (https://github.com/spack/spack) got 1.28x slower (63.6s -> 81.1s)
sublime_debugger (https://github.com/daveleroy/sublime_debugger)
- modules/core/__init__.py:61: error: Argument 2 to "call_later" has incompatible type "Callable[[], None]"; expected "Callable[[VarArg(Any)], Any]" [arg-type]
+ modules/core/__init__.py:61: error: Argument 2 to "call_later" has incompatible type "Callable[[], None]"; expected "def (*Any) -> Any" [arg-type]
- modules/core/__init__.py:65: error: Argument 2 to "call_later" has incompatible type "Callable[[], None]"; expected "Callable[[VarArg(Any)], Any]" [arg-type]
+ modules/core/__init__.py:65: error: Argument 2 to "call_later" has incompatible type "Callable[[], None]"; expected "def (*Any) -> Any" [arg-type]
- modules/ui/layout.py:92: error: Argument 1 to "call_soon" has incompatible type "Callable[[], Any]"; expected "Callable[[VarArg(Any)], Any]" [arg-type]
+ modules/ui/layout.py:92: error: Argument 1 to "call_soon" has incompatible type "Callable[[], Any]"; expected "def (*Any) -> Any" [arg-type]
- modules/dap/transport.py:231: error: Argument 1 to "call_soon" has incompatible type "Callable[[str, dict[str, Any]], Any]"; expected "Callable[[VarArg(Any)], Any]" [arg-type]
+ modules/dap/transport.py:231: error: Argument 1 to "call_soon" has incompatible type "Callable[[str, dict[str, Any]], Any]"; expected "def (*Any) -> Any" [arg-type]
- modules/dap/transport.py:237: error: Argument 1 to "call_soon" has incompatible type "Callable[[], Any]"; expected "Callable[[VarArg(Any)], Any]" [arg-type]
+ modules/dap/transport.py:237: error: Argument 1 to "call_soon" has incompatible type "Callable[[], Any]"; expected "def (*Any) -> Any" [arg-type]
- modules/dap/transports.py:88: error: Argument 1 to "call_soon" has incompatible type "Callable[[str], None]"; expected "Callable[[VarArg(Any)], Any]" [arg-type]
+ modules/dap/transports.py:88: error: Argument 1 to "call_soon" has incompatible type "Callable[[str], None]"; expected "def (*Any) -> Any" [arg-type]
- 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/dap/session.py:105: error: Argument 1 to "add" of "Event" has incompatible type "Callable[[Any], Any]"; expected "def (*Iterable[ExceptionBreakpointsFilter], **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/breakpoints.py:28: error: Argument 1 to "add" of "Event" has incompatible type "Callable[[Any], None]"; expected "def (*Iterable[ExceptionBreakpointsFilter], **Iterable[ExceptionBreakpointsFilter]) -> Any" [arg-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:27: error: Argument 1 to "add" of "Event" has incompatible type "Callable[[], Any]"; expected "def (*None, **None) -> Any" [arg-type]
- 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/views/debugger.py:71: error: Argument 1 to "add" of "Event" has incompatible type "Callable[[], Any]"; expected "def (*None, **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/debugger_output_panel.py:21: error: Argument 1 to "add" of "Event" has incompatible type "Callable[[], Any]"; expected "def (*None, **None) -> Any" [arg-type]
- 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:116: error: Argument 1 to "add" of "Event" has incompatible type "Callable[[str], Future[None]]"; expected "def (*str, **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:117: error: Argument 1 to "add" of "Event" has incompatible type "Callable[[SourceLocation], Any]"; expected "def (*SourceLocation, **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:131: error: Argument 1 to "add" of "Event" has incompatible type "Callable[[], Any]"; expected "def (*None, **None) -> Any" [arg-type]
steam.py (https://github.com/Gobot1234/steam.py)
- steam/ext/commands/commands.py:219: error: Value of type "Callable[[VarArg(Any), KwArg(Any)], NoReturn]" is not indexable [index]
+ steam/ext/commands/commands.py:219: error: Value of type "def [T] __new__(cls, *args: Any, **kwargs: Any) -> NoReturn" is not indexable [index]
- steam/ext/commands/help.py:32: error: Argument 1 to "__init__" of "Command" has incompatible type "Callable[[Context, DefaultNamedArg(str, 'content')], Coroutine[Any, Any, None]]"; expected "CallbackType[Any]" [arg-type]
+ steam/ext/commands/help.py:32: error: Argument 1 to "__init__" of "Command" has incompatible type "def command_callback(self, ctx: Context, *, content: str = ...) -> Coroutine[Any, Any, None]"; expected "CallbackType[Any]" [arg-type]
pyinstrument (https://github.com/joerick/pyinstrument)
- pyinstrument/vendor/decorator.py:295: error: Incompatible types in assignment (expression has type "Callable[[Any, Any, VarArg(Any), KwArg(Any)], Any]", variable has type "Callable[[_GeneratorContextManager[_T_co], Callable[..., Iterator[_T_co]], tuple[Any, ...], dict[str, Any]], None]") [assignment]
+ pyinstrument/vendor/decorator.py:295: error: Incompatible types in assignment (expression has type "def __init__(self: Any, g: Any, *a: Any, **k: Any) -> Any", variable has type "Callable[[_GeneratorContextManager[_T_co], Callable[..., Iterator[_T_co]], tuple[Any, ...], dict[str, Any]], None]") [assignment]
- pyinstrument/vendor/decorator.py:301: error: Incompatible types in assignment (expression has type "Callable[[Any, Any, VarArg(Any), KwArg(Any)], Any]", variable has type "Callable[[_GeneratorContextManager[_T_co], Callable[..., Iterator[_T_co]], tuple[Any, ...], dict[str, Any]], None]") [assignment]
+ pyinstrument/vendor/decorator.py:301: error: Incompatible types in assignment (expression has type "def __init__(self: Any, g: Any, *a: Any, **k: Any) -> Any", variable has type "Callable[[_GeneratorContextManager[_T_co], Callable[..., Iterator[_T_co]], tuple[Any, ...], dict[str, Any]], None]") [assignment]
streamlit (https://github.com/streamlit/streamlit)
- lib/tests/streamlit/connections/sql_connection_test.py:194:16: error: "Callable[[bool, KwArg(Any)], Any]" has no attribute "call_count" [attr-defined]
+ lib/tests/streamlit/connections/sql_connection_test.py:194:16: error: "def _connect(self, autocommit: bool = ..., **kwargs: Any) -> Any" has no attribute "call_count" [attr-defined]
- lib/tests/streamlit/connections/sql_connection_test.py:195:9: error: "Callable[[bool, KwArg(Any)], Any]" has no attribute "reset_mock" [attr-defined]
+ lib/tests/streamlit/connections/sql_connection_test.py:195:9: error: "def _connect(self, autocommit: bool = ..., **kwargs: Any) -> Any" has no attribute "reset_mock" [attr-defined]
- lib/tests/streamlit/connections/sql_connection_test.py:209:16: error: "Callable[[bool, KwArg(Any)], Any]" has no attribute "call_count" [attr-defined]
+ lib/tests/streamlit/connections/sql_connection_test.py:209:16: error: "def _connect(self, autocommit: bool = ..., **kwargs: Any) -> Any" has no attribute "call_count" [attr-defined]
- lib/tests/streamlit/connections/sql_connection_test.py:210:9: error: "Callable[[bool, KwArg(Any)], Any]" has no attribute "reset_mock" [attr-defined]
+ lib/tests/streamlit/connections/sql_connection_test.py:210:9: error: "def _connect(self, autocommit: bool = ..., **kwargs: Any) -> Any" has no attribute "reset_mock" [attr-defined]
- lib/tests/streamlit/connections/snowpark_connection_test.py:173:16: error: "Callable[[KwArg(Any)], Any]" has no attribute "call_count" [attr-defined]
+ lib/tests/streamlit/connections/snowpark_connection_test.py:173:16: error: "def _connect(self, **kwargs: Any) -> Any" has no attribute "call_count" [attr-defined]
- lib/tests/streamlit/connections/snowpark_connection_test.py:193:16: error: "Callable[[KwArg(Any)], Any]" has no attribute "call_count" [attr-defined]
+ lib/tests/streamlit/connections/snowpark_connection_test.py:193:16: error: "def _connect(self, **kwargs: Any) -> Any" has no attribute "call_count" [attr-defined]
hydra-zen (https://github.com/mit-ll-responsible-ai/hydra-zen)
- src/hydra_zen/wrapper/_implementations.py:1371: error: Incompatible default for argument "to_config" (default has type "Callable[[Callable[..., Any] | DataClass_ | list[Any] | dict[Any, Any] | ListConfig | DictConfig, KwArg(Any)], DataClass_ | type[DataClass_] | ListConfig | DictConfig]", argument has type "Callable[[F], Any]") [assignment]
+ src/hydra_zen/wrapper/_implementations.py:1371: error: Incompatible default for argument "to_config" (default has type "def default_to_config(target: Callable[..., Any] | DataClass_ | list[Any] | dict[Any, Any] | ListConfig | DictConfig, **kw: Any) -> DataClass_ | type[DataClass_] | ListConfig | DictConfig", argument has type "Callable[[F], Any]") [assignment]
prefect (https://github.com/PrefectHQ/prefect)
- src/prefect/utilities/dispatch.py:117: error: Incompatible types in assignment (expression has type "Callable[[Any, KwArg(Any)], Any]", variable has type "Callable[[], None]") [assignment]
+ src/prefect/utilities/dispatch.py:117: error: Incompatible types in assignment (expression has type "def _register_subclass_of_base_type(cls: Any, **kwargs: Any) -> Any", variable has type "Callable[[], None]") [assignment]
- src/prefect/utilities/asyncutils.py:264: error: Argument 1 to "is_async_fn" has incompatible type "T"; expected "Callable[[VarArg(<nothing>), KwArg(<nothing>)], <nothing>] | Callable[[VarArg(<nothing>), KwArg(<nothing>)], Awaitable[<nothing>]]" [arg-type]
+ src/prefect/utilities/asyncutils.py:264: error: Argument 1 to "is_async_fn" has incompatible type "T"; expected "def (*<nothing>, **<nothing>) -> <nothing> | def (*<nothing>, **<nothing>) -> Awaitable[<nothing>]" [arg-type]
- src/prefect/utilities/asyncutils.py:271: error: "Callable[[VarArg(Any), KwArg(Any)], Any]" has no attribute "aio" [attr-defined]
+ src/prefect/utilities/asyncutils.py:271: error: "def coroutine_wrapper(*args: Any, **kwargs: Any) -> Any" has no attribute "aio" [attr-defined]
- src/prefect/utilities/asyncutils.py:272: error: Incompatible return value type (got "Callable[[VarArg(Any), KwArg(Any)], Any]", expected "T") [return-value]
+ src/prefect/utilities/asyncutils.py:272: error: Incompatible return value type (got "def coroutine_wrapper(*args: Any, **kwargs: Any) -> Any", expected "T") [return-value]
- src/prefect/utilities/pydantic.py:183: error: Incompatible types in assignment (expression has type "Callable[[type[Any], KwArg(Any)], Any]", variable has type overloaded function) [assignment]
+ src/prefect/utilities/pydantic.py:183: error: Incompatible types in assignment (expression has type "def __new__(cls: type[Any], **kwargs: Any) -> Any", variable has type overloaded function) [assignment]
- 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 "def tags(*new_tags: str) -> set[str]"; expected "def (*new_tags: str) -> Iterator[<nothing>]" [arg-type]
- src/prefect/engine.py:990: error: Argument 1 to "create_call" has incompatible type "function"; expected "Callable[[VarArg(<nothing>), KwArg(<nothing>)], <nothing>]" [arg-type]
+ src/prefect/engine.py:990: error: Argument 1 to "create_call" has incompatible type "function"; expected "def (*<nothing>, **<nothing>) -> <nothing>" [arg-type]
- src/prefect/server/utilities/server.py:77: error: "Callable[[VarArg(Any), NamedArg(Any, 'request'), KwArg(Any)], Coroutine[Any, Any, Any]]" has no attribute "__signature__" [attr-defined]
+ src/prefect/server/utilities/server.py:77: error: "def wrapper(*args: Any, request: Any, **kwargs: Any) -> Coroutine[Any, Any, Any]" has no attribute "__signature__" [attr-defined]
ibis (https://github.com/ibis-project/ibis)
- ibis/__init__.py:100: error: "Callable[[VarArg(Any), KwArg(Any)], Any]" has no attribute "__wrapped__" [attr-defined]
+ ibis/__init__.py:100: error: "def connect(*args: Any, **kwargs: Any) -> Any" has no attribute "__wrapped__" [attr-defined]
- ibis/backends/clickhouse/compiler/values.py:868: error: Incompatible return value type (got "Callable[[Any, NamedArg(Any, 'cache'), KwArg(Any)], Any]", expected "str") [return-value]
+ ibis/backends/clickhouse/compiler/values.py:868: error: Incompatible return value type (got "def tr(op: Any, *, cache: Any, **kw: Any) -> Any", expected "str") [return-value]
- ibis/backends/bigquery/udf/__init__.py:314: error: "Callable[[VarArg(Any), KwArg(Any)], Any]" has no attribute "__signature__" [attr-defined]
+ ibis/backends/bigquery/udf/__init__.py:314: error: "def wrapped(*args: Any, **kwargs: Any) -> Any" has no attribute "__signature__" [attr-defined]
- ibis/backends/bigquery/udf/__init__.py:323: error: "Callable[[VarArg(Any), KwArg(Any)], Any]" has no attribute "sql" [attr-defined]
+ ibis/backends/bigquery/udf/__init__.py:323: error: "def wrapped(*args: Any, **kwargs: Any) -> Any" has no attribute "sql" [attr-defined]
- ibis/backends/dask/execution/__init__.py:11: error: Incompatible import of "compute_row_reduction" (imported name has type "Callable[[Any, Any], Any]", local name has type "Callable[[Any, Any, KwArg(Any)], Any]") [assignment]
+ ibis/backends/dask/execution/__init__.py:11: error: Incompatible import of "compute_row_reduction" (imported name has type "Callable[[Any, Any], Any]", local name has type "def compute_row_reduction(func: Any, values: Any, **kwargs: Any) -> Any") [assignment]
- ibis/backends/snowflake/tests/conftest.py:82: note: "partial[Future[_T]].__call__" has type "Callable[[VarArg(Any), KwArg(Any)], Future[_T]]"
+ ibis/backends/snowflake/tests/conftest.py:82: note: "partial[Future[_T]].__call__" has type "def __call__(__self, *args: Any, **kwargs: Any) -> Future[_T]"
pydantic (https://github.com/samuelcolvin/pydantic)
- pydantic/_internal/_decorators.py:151: error: Incompatible return value type (got "Callable[[VarArg(Any), KwArg(Any)], ReturnType] | Any", expected "PydanticDescriptorProxy[ReturnType]") [return-value]
+ pydantic/_internal/_decorators.py:151: error: Incompatible return value type (got "def (*Any, **Any) -> ReturnType | Any", expected "PydanticDescriptorProxy[ReturnType]") [return-value]
discord.py (https://github.com/Rapptz/discord.py)
- discord/scheduled_event.py:652: error: Incompatible types in assignment (expression has type "Callable[[Arg(int, 'retrieve'), Arg(Snowflake | None, 'before'), Arg(int | None, 'limit')], Coroutine[Any, Any, Any]]", variable has type "Callable[[Arg(int, 'retrieve'), Arg(Snowflake | None, 'after'), Arg(int | None, 'limit')], Coroutine[Any, Any, Any]]") [assignment]
+ discord/scheduled_event.py:652: error: Incompatible types in assignment (expression has type "def _before_strategy(retrieve: int, before: Snowflake | None, limit: int | None) -> Coroutine[Any, Any, Any]", variable has type "def _after_strategy(retrieve: int, after: Snowflake | None, limit: int | None) -> Coroutine[Any, Any, Any]") [assignment]
... (truncated 38 lines) ...``` |
|
close this since #20128 has been merged |
Description
Related #5490 (comment)
I add a flag
use_pretty_callableinformat_type_inner.pretty_callablesometimes makes output even more confusing when two formats show up in one error message.