mypy icon indicating copy to clipboard operation
mypy copied to clipboard

Support ParamSpec mapping with functools.partial

Open sterliakov opened this issue 1 year ago • 9 comments

Follow-up for #17323, resolving a false positive discovered there.

This enables use of functools.partial to bind some *args or **kwargs on a callable typed with ParamSpec.

sterliakov avatar Jun 10 '24 00:06 sterliakov

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

optuna (https://github.com/optuna/optuna)
+ optuna/_convert_positional_args.py:83: error: Too few arguments  [call-arg]

pandas-stubs (https://github.com/pandas-dev/pandas-stubs)
+ tests/test_series.py:3022: error: No overload variant of "pipe" of "NDFrame" matches argument types "Callable[[Series[Any], int, list[float], str, NamedArg(tuple[int, int], 'keyword_only')], Series[Any]]", "str", "list[float]", "str", "tuple[int, int]"  [call-overload]
+ tests/test_series.py:3022: note: Possible overload variants:
+ tests/test_series.py:3022: note:     def [P`33573, T] pipe(self, func: Callable[[Series[int], **P], T], *args: P.args, **kwargs: P.kwargs) -> T
+ tests/test_series.py:3022: note:     def [T] pipe(self, func: tuple[Callable[..., T], str], *args: Any, **kwargs: Any) -> T
+ tests/test_series.py:3024: error: Unused "type: ignore" comment  [unused-ignore]
+ tests/test_series.py:3036: error: No overload variant of "pipe" of "NDFrame" matches argument types "Callable[[Series[Any], int, list[float], str, NamedArg(tuple[int, int], 'keyword_only')], Series[Any]]", "int", "list[float]", "int", "tuple[int, int]"  [call-overload]
+ tests/test_series.py:3036: note: Possible overload variants:
+ tests/test_series.py:3036: note:     def [P`33598, T] pipe(self, func: Callable[[Series[int], **P], T], *args: P.args, **kwargs: P.kwargs) -> T
+ tests/test_series.py:3036: note:     def [T] pipe(self, func: tuple[Callable[..., T], str], *args: Any, **kwargs: Any) -> T
+ tests/test_series.py:3040: error: Unused "type: ignore" comment  [unused-ignore]
+ tests/test_series.py:3050: error: Unused "type: ignore" comment  [unused-ignore]
+ tests/test_series.py:3050: error: No overload variant of "pipe" of "NDFrame" matches argument types "Callable[[Series[Any], int, list[float], str, NamedArg(tuple[int, int], 'keyword_only')], Series[Any]]", "int", "list[float]", "str", "tuple[int, int]"  [call-overload]
+ tests/test_series.py:3050: note: Error code "call-overload" not covered by "type: ignore" comment
+ tests/test_series.py:3050: note: Possible overload variants:
+ tests/test_series.py:3050: note:     def [P`33623, T] pipe(self, func: Callable[[Series[int], **P], T], *args: P.args, **kwargs: P.kwargs) -> T
+ tests/test_series.py:3050: note:     def [T] pipe(self, func: tuple[Callable[..., T], str], *args: Any, **kwargs: Any) -> T
+ tests/test_series.py:3057: error: Unused "type: ignore" comment  [unused-ignore]
+ tests/test_series.py:3057: error: No overload variant of "pipe" of "NDFrame" matches argument types "Callable[[Series[Any], int, list[float], str, NamedArg(tuple[int, int], 'keyword_only')], Series[Any]]", "int", "list[float]", "int", "tuple[int, int]"  [call-overload]
+ tests/test_series.py:3057: note: Error code "call-overload" not covered by "type: ignore" comment
+ tests/test_series.py:3057: note: Possible overload variants:
+ tests/test_series.py:3057: note:     def [P`33634, T] pipe(self, func: Callable[[Series[int], **P], T], *args: P.args, **kwargs: P.kwargs) -> T
+ tests/test_series.py:3057: note:     def [T] pipe(self, func: tuple[Callable[..., T], str], *args: Any, **kwargs: Any) -> T
+ tests/test_series.py:3061: error: Unused "type: ignore" comment  [unused-ignore]
+ tests/test_series.py:3064: error: Unused "type: ignore" comment  [unused-ignore]
+ tests/test_series.py:3064: error: No overload variant of "pipe" of "NDFrame" matches argument types "Callable[[Series[Any], int, list[float], str, NamedArg(tuple[int, int], 'keyword_only')], Series[Any]]", "int", "list[float]", "int", "tuple[int, int]"  [call-overload]
+ tests/test_series.py:3064: note: Error code "call-overload" not covered by "type: ignore" comment
+ tests/test_series.py:3064: note: Possible overload variants:
+ tests/test_series.py:3064: note:     def [P`33645, T] pipe(self, func: Callable[[Series[int], **P], T], *args: P.args, **kwargs: P.kwargs) -> T
+ tests/test_series.py:3064: note:     def [T] pipe(self, func: tuple[Callable[..., T], str], *args: Any, **kwargs: Any) -> T
+ tests/test_series.py:3068: error: Unused "type: ignore" comment  [unused-ignore]
+ tests/test_resampler.py:202: error: No overload variant of "pipe" of "BaseGroupBy" matches argument types "Callable[[DatetimeIndexResampler[DataFrame], int, list[float], str, NamedArg(tuple[int], 'kw')], DataFrame]", "str", "list[float]", "str", "tuple[int]"  [call-overload]
+ tests/test_resampler.py:202: note: Possible overload variants:
+ tests/test_resampler.py:202: note:     def [P`35977, T] pipe(self, func: Callable[[DatetimeIndexResampler[DataFrame], **P], T], *args: P.args, **kwargs: P.kwargs) -> T
+ tests/test_resampler.py:202: note:     def [T] pipe(self, func: tuple[Callable[..., T], str], *args: Any, **kwargs: Any) -> T
+ tests/test_resampler.py:204: error: Unused "type: ignore" comment  [unused-ignore]
+ tests/test_resampler.py:216: error: No overload variant of "pipe" of "BaseGroupBy" matches argument types "Callable[[DatetimeIndexResampler[DataFrame], int, list[float], str, NamedArg(tuple[int], 'kw')], DataFrame]", "int", "list[float]", "int", "tuple[int]"  [call-overload]
+ tests/test_resampler.py:216: note: Possible overload variants:
+ tests/test_resampler.py:216: note:     def [P`36006, T] pipe(self, func: Callable[[DatetimeIndexResampler[DataFrame], **P], T], *args: P.args, **kwargs: P.kwargs) -> T
+ tests/test_resampler.py:216: note:     def [T] pipe(self, func: tuple[Callable[..., T], str], *args: Any, **kwargs: Any) -> T
+ tests/test_resampler.py:220: error: Unused "type: ignore" comment  [unused-ignore]
+ tests/test_resampler.py:230: error: Unused "type: ignore" comment  [unused-ignore]
+ tests/test_resampler.py:230: error: No overload variant of "pipe" of "BaseGroupBy" matches argument types "Callable[[DatetimeIndexResampler[DataFrame], int, list[float], str, NamedArg(tuple[int], 'kw')], DataFrame]", "int", "list[float]", "str", "tuple[int]"  [call-overload]
+ tests/test_resampler.py:230: note: Error code "call-overload" not covered by "type: ignore" comment
+ tests/test_resampler.py:230: note: Possible overload variants:
+ tests/test_resampler.py:230: note:     def [P`36035, T] pipe(self, func: Callable[[DatetimeIndexResampler[DataFrame], **P], T], *args: P.args, **kwargs: P.kwargs) -> T
+ tests/test_resampler.py:230: note:     def [T] pipe(self, func: tuple[Callable[..., T], str], *args: Any, **kwargs: Any) -> T
+ tests/test_resampler.py:237: error: Unused "type: ignore" comment  [unused-ignore]
+ tests/test_resampler.py:237: error: No overload variant of "pipe" of "BaseGroupBy" matches argument types "Callable[[DatetimeIndexResampler[DataFrame], int, list[float], str, NamedArg(tuple[int], 'kw')], DataFrame]", "int", "list[float]", "int", "tuple[int]"  [call-overload]
+ tests/test_resampler.py:237: note: Error code "call-overload" not covered by "type: ignore" comment
+ tests/test_resampler.py:237: note: Possible overload variants:
+ tests/test_resampler.py:237: note:     def [P`36048, T] pipe(self, func: Callable[[DatetimeIndexResampler[DataFrame], **P], T], *args: P.args, **kwargs: P.kwargs) -> T
+ tests/test_resampler.py:237: note:     def [T] pipe(self, func: tuple[Callable[..., T], str], *args: Any, **kwargs: Any) -> T
+ tests/test_resampler.py:241: error: Unused "type: ignore" comment  [unused-ignore]
+ tests/test_resampler.py:244: error: Unused "type: ignore" comment  [unused-ignore]
+ tests/test_resampler.py:244: error: No overload variant of "pipe" of "BaseGroupBy" matches argument types "Callable[[DatetimeIndexResampler[DataFrame], int, list[float], str, NamedArg(tuple[int], 'kw')], DataFrame]", "int", "list[float]", "int", "tuple[int]"  [call-overload]
+ tests/test_resampler.py:244: note: Error code "call-overload" not covered by "type: ignore" comment
+ tests/test_resampler.py:244: note: Possible overload variants:
+ tests/test_resampler.py:244: note:     def [P`36061, T] pipe(self, func: Callable[[DatetimeIndexResampler[DataFrame], **P], T], *args: P.args, **kwargs: P.kwargs) -> T
+ tests/test_resampler.py:244: note:     def [T] pipe(self, func: tuple[Callable[..., T], str], *args: Any, **kwargs: Any) -> T
+ tests/test_resampler.py:248: error: Unused "type: ignore" comment  [unused-ignore]
+ tests/test_frame.py:1611: error: No overload variant of "pipe" of "NDFrame" matches argument types "Callable[[DataFrame, int, list[float], str, NamedArg(tuple[int, int], 'keyword_only')], DataFrame]", "str", "list[float]", "str", "tuple[int, int]"  [call-overload]
+ tests/test_frame.py:1611: note: Possible overload variants:
+ tests/test_frame.py:1611: note:     def [P`47491, T] pipe(self, func: Callable[[DataFrame, **P], T], *args: P.args, **kwargs: P.kwargs) -> T
+ tests/test_frame.py:1611: note:     def [T] pipe(self, func: tuple[Callable[..., T], str], *args: Any, **kwargs: Any) -> T
+ tests/test_frame.py:1613: error: Unused "type: ignore" comment  [unused-ignore]
+ tests/test_frame.py:1625: error: No overload variant of "pipe" of "NDFrame" matches argument types "Callable[[DataFrame, int, list[float], str, NamedArg(tuple[int, int], 'keyword_only')], DataFrame]", "int", "list[float]", "int", "tuple[int, int]"  [call-overload]
+ tests/test_frame.py:1625: note: Possible overload variants:
+ tests/test_frame.py:1625: note:     def [P`47516, T] pipe(self, func: Callable[[DataFrame, **P], T], *args: P.args, **kwargs: P.kwargs) -> T
+ tests/test_frame.py:1625: note:     def [T] pipe(self, func: tuple[Callable[..., T], str], *args: Any, **kwargs: Any) -> T
+ tests/test_frame.py:1629: error: Unused "type: ignore" comment  [unused-ignore]
+ tests/test_frame.py:1639: error: Unused "type: ignore" comment  [unused-ignore]
+ tests/test_frame.py:1639: error: No overload variant of "pipe" of "NDFrame" matches argument types "Callable[[DataFrame, int, list[float], str, NamedArg(tuple[int, int], 'keyword_only')], DataFrame]", "int", "list[float]", "str", "tuple[int, int]"  [call-overload]
+ tests/test_frame.py:1639: note: Error code "call-overload" not covered by "type: ignore" comment
+ tests/test_frame.py:1639: note: Possible overload variants:

... (truncated 16 lines) ...

pwndbg (https://github.com/pwndbg/pwndbg)
+ pwndbg/gdblib/events.py: note: In function "connect":
+ pwndbg/gdblib/events.py:124: error: Too few arguments  [call-arg]
+ pwndbg/gdblib/events.py: note: At top level:

github-actions[bot] avatar Jun 10 '24 00:06 github-actions[bot]

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

optuna (https://github.com/optuna/optuna)
+ optuna/_convert_positional_args.py:83: error: Too few arguments  [call-arg]

pandas-stubs (https://github.com/pandas-dev/pandas-stubs)
+ tests/test_series.py:3022: error: No overload variant of "pipe" of "NDFrame" matches argument types "Callable[[Series[Any], int, list[float], str, NamedArg(tuple[int, int], 'keyword_only')], Series[Any]]", "str", "list[float]", "str", "tuple[int, int]"  [call-overload]
+ tests/test_series.py:3022: note: Possible overload variants:
+ tests/test_series.py:3022: note:     def [P`33582, T] pipe(self, func: Callable[[Series[int], **P], T], *args: P.args, **kwargs: P.kwargs) -> T
+ tests/test_series.py:3022: note:     def [T] pipe(self, func: tuple[Callable[..., T], str], *args: Any, **kwargs: Any) -> T
+ tests/test_series.py:3024: error: Unused "type: ignore" comment  [unused-ignore]
+ tests/test_series.py:3036: error: No overload variant of "pipe" of "NDFrame" matches argument types "Callable[[Series[Any], int, list[float], str, NamedArg(tuple[int, int], 'keyword_only')], Series[Any]]", "int", "list[float]", "int", "tuple[int, int]"  [call-overload]
+ tests/test_series.py:3036: note: Possible overload variants:
+ tests/test_series.py:3036: note:     def [P`33607, T] pipe(self, func: Callable[[Series[int], **P], T], *args: P.args, **kwargs: P.kwargs) -> T
+ tests/test_series.py:3036: note:     def [T] pipe(self, func: tuple[Callable[..., T], str], *args: Any, **kwargs: Any) -> T
+ tests/test_series.py:3040: error: Unused "type: ignore" comment  [unused-ignore]
+ tests/test_series.py:3050: error: Unused "type: ignore" comment  [unused-ignore]
+ tests/test_series.py:3050: error: No overload variant of "pipe" of "NDFrame" matches argument types "Callable[[Series[Any], int, list[float], str, NamedArg(tuple[int, int], 'keyword_only')], Series[Any]]", "int", "list[float]", "str", "tuple[int, int]"  [call-overload]
+ tests/test_series.py:3050: note: Error code "call-overload" not covered by "type: ignore" comment
+ tests/test_series.py:3050: note: Possible overload variants:
+ tests/test_series.py:3050: note:     def [P`33632, T] pipe(self, func: Callable[[Series[int], **P], T], *args: P.args, **kwargs: P.kwargs) -> T
+ tests/test_series.py:3050: note:     def [T] pipe(self, func: tuple[Callable[..., T], str], *args: Any, **kwargs: Any) -> T
+ tests/test_series.py:3057: error: Unused "type: ignore" comment  [unused-ignore]
+ tests/test_series.py:3057: error: No overload variant of "pipe" of "NDFrame" matches argument types "Callable[[Series[Any], int, list[float], str, NamedArg(tuple[int, int], 'keyword_only')], Series[Any]]", "int", "list[float]", "int", "tuple[int, int]"  [call-overload]
+ tests/test_series.py:3057: note: Error code "call-overload" not covered by "type: ignore" comment
+ tests/test_series.py:3057: note: Possible overload variants:
+ tests/test_series.py:3057: note:     def [P`33643, T] pipe(self, func: Callable[[Series[int], **P], T], *args: P.args, **kwargs: P.kwargs) -> T
+ tests/test_series.py:3057: note:     def [T] pipe(self, func: tuple[Callable[..., T], str], *args: Any, **kwargs: Any) -> T
+ tests/test_series.py:3061: error: Unused "type: ignore" comment  [unused-ignore]
+ tests/test_series.py:3064: error: Unused "type: ignore" comment  [unused-ignore]
+ tests/test_series.py:3064: error: No overload variant of "pipe" of "NDFrame" matches argument types "Callable[[Series[Any], int, list[float], str, NamedArg(tuple[int, int], 'keyword_only')], Series[Any]]", "int", "list[float]", "int", "tuple[int, int]"  [call-overload]
+ tests/test_series.py:3064: note: Error code "call-overload" not covered by "type: ignore" comment
+ tests/test_series.py:3064: note: Possible overload variants:
+ tests/test_series.py:3064: note:     def [P`33654, T] pipe(self, func: Callable[[Series[int], **P], T], *args: P.args, **kwargs: P.kwargs) -> T
+ tests/test_series.py:3064: note:     def [T] pipe(self, func: tuple[Callable[..., T], str], *args: Any, **kwargs: Any) -> T
+ tests/test_series.py:3068: error: Unused "type: ignore" comment  [unused-ignore]
+ tests/test_resampler.py:202: error: No overload variant of "pipe" of "BaseGroupBy" matches argument types "Callable[[DatetimeIndexResampler[DataFrame], int, list[float], str, NamedArg(tuple[int], 'kw')], DataFrame]", "str", "list[float]", "str", "tuple[int]"  [call-overload]
+ tests/test_resampler.py:202: note: Possible overload variants:
+ tests/test_resampler.py:202: note:     def [P`35986, T] pipe(self, func: Callable[[DatetimeIndexResampler[DataFrame], **P], T], *args: P.args, **kwargs: P.kwargs) -> T
+ tests/test_resampler.py:202: note:     def [T] pipe(self, func: tuple[Callable[..., T], str], *args: Any, **kwargs: Any) -> T
+ tests/test_resampler.py:204: error: Unused "type: ignore" comment  [unused-ignore]
+ tests/test_resampler.py:216: error: No overload variant of "pipe" of "BaseGroupBy" matches argument types "Callable[[DatetimeIndexResampler[DataFrame], int, list[float], str, NamedArg(tuple[int], 'kw')], DataFrame]", "int", "list[float]", "int", "tuple[int]"  [call-overload]
+ tests/test_resampler.py:216: note: Possible overload variants:
+ tests/test_resampler.py:216: note:     def [P`36015, T] pipe(self, func: Callable[[DatetimeIndexResampler[DataFrame], **P], T], *args: P.args, **kwargs: P.kwargs) -> T
+ tests/test_resampler.py:216: note:     def [T] pipe(self, func: tuple[Callable[..., T], str], *args: Any, **kwargs: Any) -> T
+ tests/test_resampler.py:220: error: Unused "type: ignore" comment  [unused-ignore]
+ tests/test_resampler.py:230: error: Unused "type: ignore" comment  [unused-ignore]
+ tests/test_resampler.py:230: error: No overload variant of "pipe" of "BaseGroupBy" matches argument types "Callable[[DatetimeIndexResampler[DataFrame], int, list[float], str, NamedArg(tuple[int], 'kw')], DataFrame]", "int", "list[float]", "str", "tuple[int]"  [call-overload]
+ tests/test_resampler.py:230: note: Error code "call-overload" not covered by "type: ignore" comment
+ tests/test_resampler.py:230: note: Possible overload variants:
+ tests/test_resampler.py:230: note:     def [P`36044, T] pipe(self, func: Callable[[DatetimeIndexResampler[DataFrame], **P], T], *args: P.args, **kwargs: P.kwargs) -> T
+ tests/test_resampler.py:230: note:     def [T] pipe(self, func: tuple[Callable[..., T], str], *args: Any, **kwargs: Any) -> T
+ tests/test_resampler.py:237: error: Unused "type: ignore" comment  [unused-ignore]
+ tests/test_resampler.py:237: error: No overload variant of "pipe" of "BaseGroupBy" matches argument types "Callable[[DatetimeIndexResampler[DataFrame], int, list[float], str, NamedArg(tuple[int], 'kw')], DataFrame]", "int", "list[float]", "int", "tuple[int]"  [call-overload]
+ tests/test_resampler.py:237: note: Error code "call-overload" not covered by "type: ignore" comment
+ tests/test_resampler.py:237: note: Possible overload variants:
+ tests/test_resampler.py:237: note:     def [P`36057, T] pipe(self, func: Callable[[DatetimeIndexResampler[DataFrame], **P], T], *args: P.args, **kwargs: P.kwargs) -> T
+ tests/test_resampler.py:237: note:     def [T] pipe(self, func: tuple[Callable[..., T], str], *args: Any, **kwargs: Any) -> T
+ tests/test_resampler.py:241: error: Unused "type: ignore" comment  [unused-ignore]
+ tests/test_resampler.py:244: error: Unused "type: ignore" comment  [unused-ignore]
+ tests/test_resampler.py:244: error: No overload variant of "pipe" of "BaseGroupBy" matches argument types "Callable[[DatetimeIndexResampler[DataFrame], int, list[float], str, NamedArg(tuple[int], 'kw')], DataFrame]", "int", "list[float]", "int", "tuple[int]"  [call-overload]
+ tests/test_resampler.py:244: note: Error code "call-overload" not covered by "type: ignore" comment
+ tests/test_resampler.py:244: note: Possible overload variants:
+ tests/test_resampler.py:244: note:     def [P`36070, T] pipe(self, func: Callable[[DatetimeIndexResampler[DataFrame], **P], T], *args: P.args, **kwargs: P.kwargs) -> T
+ tests/test_resampler.py:244: note:     def [T] pipe(self, func: tuple[Callable[..., T], str], *args: Any, **kwargs: Any) -> T
+ tests/test_resampler.py:248: error: Unused "type: ignore" comment  [unused-ignore]
+ tests/test_frame.py:1611: error: No overload variant of "pipe" of "NDFrame" matches argument types "Callable[[DataFrame, int, list[float], str, NamedArg(tuple[int, int], 'keyword_only')], DataFrame]", "str", "list[float]", "str", "tuple[int, int]"  [call-overload]
+ tests/test_frame.py:1611: note: Possible overload variants:
+ tests/test_frame.py:1611: note:     def [P`47493, T] pipe(self, func: Callable[[DataFrame, **P], T], *args: P.args, **kwargs: P.kwargs) -> T
+ tests/test_frame.py:1611: note:     def [T] pipe(self, func: tuple[Callable[..., T], str], *args: Any, **kwargs: Any) -> T
+ tests/test_frame.py:1613: error: Unused "type: ignore" comment  [unused-ignore]
+ tests/test_frame.py:1625: error: No overload variant of "pipe" of "NDFrame" matches argument types "Callable[[DataFrame, int, list[float], str, NamedArg(tuple[int, int], 'keyword_only')], DataFrame]", "int", "list[float]", "int", "tuple[int, int]"  [call-overload]
+ tests/test_frame.py:1625: note: Possible overload variants:
+ tests/test_frame.py:1625: note:     def [P`47518, T] pipe(self, func: Callable[[DataFrame, **P], T], *args: P.args, **kwargs: P.kwargs) -> T
+ tests/test_frame.py:1625: note:     def [T] pipe(self, func: tuple[Callable[..., T], str], *args: Any, **kwargs: Any) -> T
+ tests/test_frame.py:1629: error: Unused "type: ignore" comment  [unused-ignore]
+ tests/test_frame.py:1639: error: Unused "type: ignore" comment  [unused-ignore]
+ tests/test_frame.py:1639: error: No overload variant of "pipe" of "NDFrame" matches argument types "Callable[[DataFrame, int, list[float], str, NamedArg(tuple[int, int], 'keyword_only')], DataFrame]", "int", "list[float]", "str", "tuple[int, int]"  [call-overload]
+ tests/test_frame.py:1639: note: Error code "call-overload" not covered by "type: ignore" comment
+ tests/test_frame.py:1639: note: Possible overload variants:

... (truncated 16 lines) ...

pwndbg (https://github.com/pwndbg/pwndbg)
+ pwndbg/gdblib/events.py: note: In function "connect":
+ pwndbg/gdblib/events.py:124: error: Too few arguments  [call-arg]

github-actions[bot] avatar Jun 24 '24 20:06 github-actions[bot]

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

starlette (https://github.com/encode/starlette)
- starlette/concurrency.py:38: error: Too few arguments  [call-arg]

github-actions[bot] avatar Sep 25 '24 17:09 github-actions[bot]

FWIW I don't like this. partial should remain within a plugin. It is not special enough to make significant changes in core mypy logic.

ilevkivskyi avatar Oct 16 '24 14:10 ilevkivskyi

TBH, I tend to agree with @ilevkivskyi - there's a balance between "we want to support this case correctly" and "we don't want to embed too many library-specific details into the typechecker". As far as I see, there's no other way to track such partial applications to ParamSpec components in any other way, but maybe the right thing is to just say "we don't want to support this".

sterliakov avatar Oct 17 '24 16:10 sterliakov

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

starlette (https://github.com/encode/starlette)
- starlette/concurrency.py:38: error: Too few arguments  [call-arg]

github-actions[bot] avatar Oct 17 '24 17:10 github-actions[bot]

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

starlette (https://github.com/encode/starlette)
- starlette/concurrency.py:38: error: Too few arguments  [call-arg]

github-actions[bot] avatar Oct 17 '24 21:10 github-actions[bot]

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

starlette (https://github.com/encode/starlette)
- starlette/concurrency.py:38: error: Too few arguments  [call-arg]

github-actions[bot] avatar Oct 17 '24 22:10 github-actions[bot]

@ilevkivskyi tagging you since you gave some feedback on the first revision. I managed to remove the scary part - error messages are less specific now, but only special_sig = "partial" escapes the plugin boundary. Are you comfortable with this amount of special-casing? (filtering error messages for "too few arguments" is way too fragile to consider here, IMO - those diagnostics can be issued by multiple checks, and we're only interested in one specific source of those)

sterliakov avatar Oct 18 '24 02:10 sterliakov

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

starlette (https://github.com/encode/starlette)
- starlette/concurrency.py:38: error: Too few arguments  [call-arg]

github-actions[bot] avatar Oct 24 '24 18:10 github-actions[bot]

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

starlette (https://github.com/encode/starlette)
- starlette/concurrency.py:38: error: Too few arguments  [call-arg]

github-actions[bot] avatar Oct 25 '24 14:10 github-actions[bot]

LG, I don't really understand the bound start args logic, but it will be easy to tweak if it will cause problems.

I just invented a counterexample to that test, it's indeed not sufficient to check by arg kinds. Last commit should address that problem and make the logic more clear as well.

sterliakov avatar Oct 25 '24 15:10 sterliakov

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

starlette (https://github.com/encode/starlette)
- starlette/concurrency.py:38: error: Too few arguments  [call-arg]

github-actions[bot] avatar Oct 25 '24 15:10 github-actions[bot]