typeshed icon indicating copy to clipboard operation
typeshed copied to clipboard

improve lru_cache by using ParamSpec

Open asottile opened this issue 3 years ago • 24 comments

https://github.com/python/mypy/issues/5107

Fixes #6987.

asottile avatar May 02 '22 23:05 asottile

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

flake8 (https://github.com/pycqa/flake8)
+ tests/unit/test_utils.py:226: error: Attribute function "__wrapped__" with type "Callable[[], _R]" does not accept self argument
+ tests/unit/test_utils.py:233: error: Attribute function "__wrapped__" with type "Callable[[], _R]" does not accept self argument

black (https://github.com/psf/black)
+ src/black/handle_ipynb_magics.py:60:2: error: Argument 1 to "__call__" of "_LRUCacheDecorator" has incompatible type "Callable[[NamedArg(bool, 'verbose'), NamedArg(bool, 'quiet')], bool]"; expected "Callable[[], bool]"
+ src/black/files.py:256:49: error: Unexpected keyword argument "verbose" for "__call__" of "_lru_cache_wrapper_0"
+ src/black/files.py:256:49: error: Unexpected keyword argument "quiet" for "__call__" of "_lru_cache_wrapper_0"
+ src/black/__init__.py:640:45: error: Unexpected keyword argument "verbose" for "__call__" of "_lru_cache_wrapper_0"
+ src/black/__init__.py:640:45: error: Unexpected keyword argument "quiet" for "__call__" of "_lru_cache_wrapper_0"

twine (https://github.com/pypa/twine)
- Warning: unused section(s) in mypy.ini: [mypy-tests.*]
+ twine/auth.py:72: 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: 0.950
+ twine/auth.py:72: : note: use --pdb to drop into pdb
+ Traceback (most recent call last):
+   File "mypy/checkexpr.py", line 3981, in accept
+   File "mypy/nodes.py", line 1673, in accept
+   File "mypy/checkexpr.py", line 2087, in visit_member_expr
+   File "mypy/checkexpr.py", line 2105, in analyze_ordinary_member_access
+   File "mypy/checkmember.py", line 130, in analyze_member_access
+   File "mypy/checkmember.py", line 147, in _analyze_member_access
+   File "mypy/checkmember.py", line 231, in analyze_instance_member_access
+   File "mypy/checkmember.py", line 385, in analyze_member_var_access
+   File "mypy/checkmember.py", line 612, in analyze_var
+   File "mypy/checkmember.py", line 509, in analyze_descriptor_access
+   File "mypy/checkexpr.py", line 944, in check_call
+   File "mypy/checkexpr.py", line 1621, in check_overload_call
+   File "mypy/checkexpr.py", line 1763, in infer_overload_return_type
+   File "mypy/checkexpr.py", line 940, in check_call
+   File "mypy/checkexpr.py", line 1025, in check_callable_call
+   File "mypy/checkexpr.py", line 1218, in infer_function_type_arguments_using_context
+   File "mypy/infer.py", line 60, in infer_type_arguments
+   File "mypy/constraints.py", line 108, in infer_constraints
+   File "mypy/constraints.py", line 181, in _infer_constraints
+   File "mypy/types.py", line 1127, in accept
+   File "mypy/constraints.py", line 551, in visit_instance
+   File "mypy/constraints.py", line 731, in infer_against_any
+   File "mypy/constraints.py", line 108, in infer_constraints
+   File "mypy/constraints.py", line 181, in _infer_constraints
+   File "mypy/types.py", line 1365, in accept
+   File "mypy/constraints.py", line 410, in visit_parameters
+ RuntimeError: Parameters cannot be constrained to

rich (https://github.com/willmcgugan/rich)
+ rich/theme.py:25: error: Missing positional argument "style_definition" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ rich/theme.py:25: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "Type[Style]"  [arg-type]
+ rich/theme.py:54: error: Missing positional argument "style_definition" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ rich/theme.py:54: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "Type[Style]"  [arg-type]
+ rich/style.py:148: error: Missing positional argument "color" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ rich/style.py:148: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "Type[Color]"  [arg-type]
+ rich/style.py:416: error: Missing positional argument "style_definition" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ rich/style.py:416: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "Type[Style]"  [arg-type]
+ rich/style.py:542: error: Missing positional argument "color" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ rich/style.py:542: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "Type[Color]"  [arg-type]
+ rich/style.py:569: error: Missing positional argument "color" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ rich/style.py:569: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "Type[Color]"  [arg-type]
+ rich/markup.py:157: error: Missing positional argument "style" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ rich/markup.py:157: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "Type[Style]"  [arg-type]
+ rich/markup.py:214: error: Missing positional argument "style" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ rich/markup.py:214: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "Type[Style]"  [arg-type]
+ rich/console.py:1439: error: Missing positional argument "style_definition" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ rich/console.py:1439: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "Type[Style]"  [arg-type]
+ rich/ansi.py:172: error: Missing positional argument "style_definition" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ rich/ansi.py:172: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "Type[Style]"  [arg-type]
+ rich/progress_bar.py:145: error: Argument 3 has incompatible type "Optional[str]"; expected "str"  [arg-type]

manticore (https://github.com/trailofbits/manticore)
+ manticore/core/smtlib/solver.py:505: error: Signature of "can_be_true" incompatible with supertype "Solver"
+ manticore/core/smtlib/solver.py:605: error: Signature of "get_all_values" incompatible with supertype "Solver"

isort (https://github.com/pycqa/isort)
+ isort/settings.py:335: error: Argument 2 to "__call__" of "_lru_cache_wrapper" has incompatible type "Tuple[str, ...]"; expected "Tuple[str]"
+ isort/settings.py:769: error: Argument 2 to "__call__" of "_lru_cache_wrapper" has incompatible type "Tuple[str, ...]"; expected "Tuple[str]"
+ isort/settings.py:807: error: Argument 2 to "__call__" of "_lru_cache_wrapper" has incompatible type "Tuple[str, ...]"; expected "Tuple[str]"

jinja (https://github.com/pallets/jinja)
+ src/jinja2/environment.py:1184: error: Unused "type: ignore" comment
+ src/jinja2/environment.py:1199: error: Unused "type: ignore" comment

aiohttp (https://github.com/aio-libs/aiohttp)
+ aiohttp/connector.py:935: error: Too many arguments  [call-arg]
+ aiohttp/connector.py:941: error: Too many arguments  [call-arg]
+ aiohttp/connector.py:942: error: Too many arguments  [call-arg]

pandas (https://github.com/pandas-dev/pandas)
+ pandas/core/dtypes/cast.py:535: error: Unused "type: ignore" comment

poetry (https://github.com/python-poetry/poetry)
+ src/poetry/puzzle/provider.py:246: error: Unexpected keyword argument "url" for "__call__" of "_lru_cache_wrapper"  [call-arg]

paroxython (https://github.com/laowantong/paroxython)
+ paroxython/assess_costs.py:85: error: Incompatible types in assignment (expression has type "_lru_cache_wrapper[int, [int], float]", variable has type "Callable[[int], float]")
+ paroxython/assess_costs.py:85: note: "_lru_cache_wrapper[int, [int], float].__call__" has type "Callable[[Arg(int, 'arg0'), Arg(int, 'stop')], float]"
+ paroxython/assess_costs.py:89: error: "Callable[[TaxonName], float]" has no attribute "cache_clear"

core (https://github.com/home-assistant/core)
+ homeassistant/components/mqtt/__init__.py:1026: error: "Callable[[Any], Any]" has no attribute "cache_clear"  [attr-defined]
+ homeassistant/components/mqtt/__init__.py:1039: error: "Callable[[Any], Any]" has no attribute "cache_clear"  [attr-defined]

pip (https://github.com/pypa/pip)
+ src/pip/_internal/locations/__init__.py:398: error: Unexpected keyword argument "user" for "__call__" of "_lru_cache_wrapper_0"
+ src/pip/_internal/locations/__init__.py:398: error: Unexpected keyword argument "home" for "__call__" of "_lru_cache_wrapper_0"
+ src/pip/_internal/locations/__init__.py:398: error: Unexpected keyword argument "root" for "__call__" of "_lru_cache_wrapper_0"
+ src/pip/_internal/locations/__init__.py:398: error: Unexpected keyword argument "prefix" for "__call__" of "_lru_cache_wrapper_0"
+ src/pip/_internal/locations/__init__.py:518: error: Unexpected keyword argument "prefix" for "__call__" of "_lru_cache_wrapper_0"

pydantic (https://github.com/samuelcolvin/pydantic)
+ pydantic/tools.py:37: error: Unused "type: ignore" comment

github-actions[bot] avatar May 03 '22 00:05 github-actions[bot]

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

flake8 (https://github.com/pycqa/flake8)
+ tests/unit/test_utils.py:226: error: Attribute function "__wrapped__" with type "Callable[[], _R]" does not accept self argument
+ tests/unit/test_utils.py:233: error: Attribute function "__wrapped__" with type "Callable[[], _R]" does not accept self argument

black (https://github.com/psf/black)
+ src/black/handle_ipynb_magics.py:60:2: error: Argument 1 to "__call__" of "_LRUCacheDecorator" has incompatible type "Callable[[NamedArg(bool, 'verbose'), NamedArg(bool, 'quiet')], bool]"; expected "Callable[[], bool]"
+ src/black/files.py:256:49: error: Unexpected keyword argument "verbose" for "__call__" of "_lru_cache_wrapper_0"
+ src/black/files.py:256:49: error: Unexpected keyword argument "quiet" for "__call__" of "_lru_cache_wrapper_0"
+ src/black/__init__.py:640:45: error: Unexpected keyword argument "verbose" for "__call__" of "_lru_cache_wrapper_0"
+ src/black/__init__.py:640:45: error: Unexpected keyword argument "quiet" for "__call__" of "_lru_cache_wrapper_0"

rich (https://github.com/willmcgugan/rich)
+ rich/theme.py:25: error: Missing positional argument "style_definition" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ rich/theme.py:25: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "Type[Style]"  [arg-type]
+ rich/theme.py:54: error: Missing positional argument "style_definition" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ rich/theme.py:54: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "Type[Style]"  [arg-type]
+ rich/style.py:148: error: Missing positional argument "color" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ rich/style.py:148: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "Type[Color]"  [arg-type]
+ rich/style.py:416: error: Missing positional argument "style_definition" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ rich/style.py:416: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "Type[Style]"  [arg-type]
+ rich/style.py:542: error: Missing positional argument "color" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ rich/style.py:542: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "Type[Color]"  [arg-type]
+ rich/style.py:569: error: Missing positional argument "color" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ rich/style.py:569: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "Type[Color]"  [arg-type]
+ rich/markup.py:157: error: Missing positional argument "style" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ rich/markup.py:157: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "Type[Style]"  [arg-type]
+ rich/markup.py:214: error: Missing positional argument "style" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ rich/markup.py:214: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "Type[Style]"  [arg-type]
+ rich/console.py:1439: error: Missing positional argument "style_definition" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ rich/console.py:1439: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "Type[Style]"  [arg-type]
+ rich/ansi.py:172: error: Missing positional argument "style_definition" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ rich/ansi.py:172: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "Type[Style]"  [arg-type]
+ rich/progress_bar.py:145: error: Argument 3 has incompatible type "Optional[str]"; expected "str"  [arg-type]

pandas (https://github.com/pandas-dev/pandas)
+ pandas/core/dtypes/cast.py:535: error: Unused "type: ignore" comment

jinja (https://github.com/pallets/jinja)
+ src/jinja2/environment.py:1184: error: Unused "type: ignore" comment
+ src/jinja2/environment.py:1199: error: Unused "type: ignore" comment

manticore (https://github.com/trailofbits/manticore)
+ manticore/core/smtlib/solver.py:505: error: Signature of "can_be_true" incompatible with supertype "Solver"
+ manticore/core/smtlib/solver.py:605: error: Signature of "get_all_values" incompatible with supertype "Solver"

poetry (https://github.com/python-poetry/poetry)
+ src/poetry/puzzle/provider.py:246: error: Unexpected keyword argument "url" for "__call__" of "_lru_cache_wrapper"  [call-arg]

isort (https://github.com/pycqa/isort)
+ isort/settings.py:335: error: Argument 2 to "__call__" of "_lru_cache_wrapper" has incompatible type "Tuple[str, ...]"; expected "Tuple[str]"
+ isort/settings.py:769: error: Argument 2 to "__call__" of "_lru_cache_wrapper" has incompatible type "Tuple[str, ...]"; expected "Tuple[str]"
+ isort/settings.py:807: error: Argument 2 to "__call__" of "_lru_cache_wrapper" has incompatible type "Tuple[str, ...]"; expected "Tuple[str]"

aiohttp (https://github.com/aio-libs/aiohttp)
+ aiohttp/connector.py:935: error: Too many arguments  [call-arg]
+ aiohttp/connector.py:941: error: Too many arguments  [call-arg]
+ aiohttp/connector.py:942: error: Too many arguments  [call-arg]

paroxython (https://github.com/laowantong/paroxython)
+ paroxython/assess_costs.py:85: error: Incompatible types in assignment (expression has type "_lru_cache_wrapper[int, [int], float]", variable has type "Callable[[int], float]")
+ paroxython/assess_costs.py:85: note: "_lru_cache_wrapper[int, [int], float].__call__" has type "Callable[[Arg(int, 'arg0'), Arg(int, 'stop')], float]"
+ paroxython/assess_costs.py:89: error: "Callable[[TaxonName], float]" has no attribute "cache_clear"

core (https://github.com/home-assistant/core)
+ homeassistant/components/mqtt/__init__.py:1026: error: "Callable[[Any], Any]" has no attribute "cache_clear"  [attr-defined]
+ homeassistant/components/mqtt/__init__.py:1039: error: "Callable[[Any], Any]" has no attribute "cache_clear"  [attr-defined]

pip (https://github.com/pypa/pip)
+ src/pip/_internal/locations/__init__.py:398: error: Unexpected keyword argument "user" for "__call__" of "_lru_cache_wrapper_0"
+ src/pip/_internal/locations/__init__.py:398: error: Unexpected keyword argument "home" for "__call__" of "_lru_cache_wrapper_0"
+ src/pip/_internal/locations/__init__.py:398: error: Unexpected keyword argument "root" for "__call__" of "_lru_cache_wrapper_0"
+ src/pip/_internal/locations/__init__.py:398: error: Unexpected keyword argument "prefix" for "__call__" of "_lru_cache_wrapper_0"
+ src/pip/_internal/locations/__init__.py:518: error: Unexpected keyword argument "prefix" for "__call__" of "_lru_cache_wrapper_0"

pydantic (https://github.com/samuelcolvin/pydantic)
+ pydantic/tools.py:37: error: Unused "type: ignore" comment

github-actions[bot] avatar May 03 '22 00:05 github-actions[bot]

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

rich (https://github.com/willmcgugan/rich)
+ rich/theme.py:25: error: Missing positional argument "style_definition" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ rich/theme.py:25: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "Type[Style]"  [arg-type]
+ rich/theme.py:54: error: Missing positional argument "style_definition" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ rich/theme.py:54: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "Type[Style]"  [arg-type]
+ rich/style.py:148: error: Missing positional argument "color" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ rich/style.py:148: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "Type[Color]"  [arg-type]
+ rich/style.py:416: error: Missing positional argument "style_definition" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ rich/style.py:416: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "Type[Style]"  [arg-type]
+ rich/style.py:542: error: Missing positional argument "color" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ rich/style.py:542: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "Type[Color]"  [arg-type]
+ rich/style.py:569: error: Missing positional argument "color" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ rich/style.py:569: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "Type[Color]"  [arg-type]
+ rich/markup.py:157: error: Missing positional argument "style" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ rich/markup.py:157: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "Type[Style]"  [arg-type]
+ rich/markup.py:214: error: Missing positional argument "style" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ rich/markup.py:214: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "Type[Style]"  [arg-type]
+ rich/console.py:1439: error: Missing positional argument "style_definition" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ rich/console.py:1439: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "Type[Style]"  [arg-type]
+ rich/ansi.py:172: error: Missing positional argument "style_definition" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ rich/ansi.py:172: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "Type[Style]"  [arg-type]
+ rich/progress_bar.py:145: error: Argument 3 has incompatible type "Optional[str]"; expected "str"  [arg-type]

black (https://github.com/psf/black)
+ src/black/handle_ipynb_magics.py:60:2: error: Argument 1 to "__call__" of "_LRUCacheDecorator" has incompatible type "Callable[[NamedArg(bool, 'verbose'), NamedArg(bool, 'quiet')], bool]"; expected "Callable[[], bool]"
+ src/black/files.py:256:49: error: Unexpected keyword argument "verbose" for "__call__" of "_lru_cache_wrapper_0"
+ src/black/files.py:256:49: error: Unexpected keyword argument "quiet" for "__call__" of "_lru_cache_wrapper_0"
+ src/black/__init__.py:640:45: error: Unexpected keyword argument "verbose" for "__call__" of "_lru_cache_wrapper_0"
+ src/black/__init__.py:640:45: error: Unexpected keyword argument "quiet" for "__call__" of "_lru_cache_wrapper_0"

isort (https://github.com/pycqa/isort)
+ isort/settings.py:335: error: Argument 2 to "__call__" of "_lru_cache_wrapper" has incompatible type "Tuple[str, ...]"; expected "Tuple[str]"
+ isort/settings.py:769: error: Argument 2 to "__call__" of "_lru_cache_wrapper" has incompatible type "Tuple[str, ...]"; expected "Tuple[str]"
+ isort/settings.py:807: error: Argument 2 to "__call__" of "_lru_cache_wrapper" has incompatible type "Tuple[str, ...]"; expected "Tuple[str]"

manticore (https://github.com/trailofbits/manticore)
+ manticore/core/smtlib/solver.py:505: error: Signature of "can_be_true" incompatible with supertype "Solver"
+ manticore/core/smtlib/solver.py:605: error: Signature of "get_all_values" incompatible with supertype "Solver"

aiohttp (https://github.com/aio-libs/aiohttp)
+ aiohttp/connector.py:935: error: Too many arguments  [call-arg]
+ aiohttp/connector.py:941: error: Too many arguments  [call-arg]
+ aiohttp/connector.py:942: error: Too many arguments  [call-arg]

pandas (https://github.com/pandas-dev/pandas)
+ pandas/core/dtypes/cast.py:535: error: Unused "type: ignore" comment

poetry (https://github.com/python-poetry/poetry)
+ src/poetry/puzzle/provider.py:246: error: Unexpected keyword argument "url" for "__call__" of "_lru_cache_wrapper"  [call-arg]

jinja (https://github.com/pallets/jinja)
+ src/jinja2/environment.py:1184: error: Unused "type: ignore" comment
+ src/jinja2/environment.py:1199: error: Unused "type: ignore" comment

paroxython (https://github.com/laowantong/paroxython)
+ paroxython/assess_costs.py:85: error: Incompatible types in assignment (expression has type "_lru_cache_wrapper[int, [int], float]", variable has type "Callable[[int], float]")
+ paroxython/assess_costs.py:85: note: "_lru_cache_wrapper[int, [int], float].__call__" has type "Callable[[Arg(int, 'arg0'), Arg(int, 'stop')], float]"
+ paroxython/assess_costs.py:89: error: "Callable[[TaxonName], float]" has no attribute "cache_clear"

core (https://github.com/home-assistant/core)
+ homeassistant/components/mqtt/__init__.py:1026: error: "Callable[[Any], Any]" has no attribute "cache_clear"  [attr-defined]
+ homeassistant/components/mqtt/__init__.py:1039: error: "Callable[[Any], Any]" has no attribute "cache_clear"  [attr-defined]

pip (https://github.com/pypa/pip)
+ src/pip/_internal/locations/__init__.py:398: error: Unexpected keyword argument "user" for "__call__" of "_lru_cache_wrapper_0"
+ src/pip/_internal/locations/__init__.py:398: error: Unexpected keyword argument "home" for "__call__" of "_lru_cache_wrapper_0"
+ src/pip/_internal/locations/__init__.py:398: error: Unexpected keyword argument "root" for "__call__" of "_lru_cache_wrapper_0"
+ src/pip/_internal/locations/__init__.py:398: error: Unexpected keyword argument "prefix" for "__call__" of "_lru_cache_wrapper_0"
+ src/pip/_internal/locations/__init__.py:518: error: Unexpected keyword argument "prefix" for "__call__" of "_lru_cache_wrapper_0"

pydantic (https://github.com/samuelcolvin/pydantic)
+ pydantic/tools.py:37: error: Unused "type: ignore" comment

github-actions[bot] avatar May 03 '22 00:05 github-actions[bot]

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

rich (https://github.com/willmcgugan/rich)
+ rich/theme.py:25: error: Missing positional argument "style_definition" in call to "__call__" of "_lru_cache_wrapper_1"  [call-arg]
+ rich/theme.py:25: error: Argument 1 to "__call__" of "_lru_cache_wrapper_1" has incompatible type "str"; expected "Type[Style]"  [arg-type]
+ rich/theme.py:54: error: Missing positional argument "style_definition" in call to "__call__" of "_lru_cache_wrapper_1"  [call-arg]
+ rich/theme.py:54: error: Argument 1 to "__call__" of "_lru_cache_wrapper_1" has incompatible type "str"; expected "Type[Style]"  [arg-type]
+ rich/style.py:148: error: Missing positional argument "color" in call to "__call__" of "_lru_cache_wrapper_1"  [call-arg]
+ rich/style.py:148: error: Argument 1 to "__call__" of "_lru_cache_wrapper_1" has incompatible type "str"; expected "Type[Color]"  [arg-type]
+ rich/style.py:393: error: Missing positional argument "system" in call to "__call__" of "_lru_cache_wrapper_1"  [call-arg]
+ rich/style.py:393: error: Missing positional argument "self" in call to "__call__" of "_lru_cache_wrapper_1"  [call-arg]
+ rich/style.py:393: error: Argument 1 to "__call__" of "_lru_cache_wrapper_1" has incompatible type "ColorSystem"; expected "Color"  [arg-type]
+ rich/style.py:396: error: Missing positional argument "system" in call to "__call__" of "_lru_cache_wrapper_1"  [call-arg]
+ rich/style.py:396: error: Missing positional argument "self" in call to "__call__" of "_lru_cache_wrapper_1"  [call-arg]
+ rich/style.py:396: error: Argument 1 to "__call__" of "_lru_cache_wrapper_1" has incompatible type "ColorSystem"; expected "Color"  [arg-type]
+ rich/style.py:416: error: Missing positional argument "style_definition" in call to "__call__" of "_lru_cache_wrapper_1"  [call-arg]
+ rich/style.py:416: error: Argument 1 to "__call__" of "_lru_cache_wrapper_1" has incompatible type "str"; expected "Type[Style]"  [arg-type]
+ rich/style.py:542: error: Missing positional argument "color" in call to "__call__" of "_lru_cache_wrapper_1"  [call-arg]
+ rich/style.py:542: error: Argument 1 to "__call__" of "_lru_cache_wrapper_1" has incompatible type "str"; expected "Type[Color]"  [arg-type]
+ rich/style.py:569: error: Missing positional argument "color" in call to "__call__" of "_lru_cache_wrapper_1"  [call-arg]
+ rich/style.py:569: error: Argument 1 to "__call__" of "_lru_cache_wrapper_1" has incompatible type "str"; expected "Type[Color]"  [arg-type]
+ rich/segment.py:168: error: Missing positional argument "cut" in call to "__call__" of "_lru_cache_wrapper_1"  [call-arg]
+ rich/segment.py:168: error: Argument 1 to "__call__" of "_lru_cache_wrapper_1" has incompatible type "Segment"; expected "Type[Segment]"  [arg-type]
+ rich/segment.py:168: error: Argument 2 to "__call__" of "_lru_cache_wrapper_1" has incompatible type "int"; expected "Segment"  [arg-type]
+ rich/markup.py:157: error: Missing positional argument "style" in call to "__call__" of "_lru_cache_wrapper_1"  [call-arg]
+ rich/markup.py:157: error: Argument 1 to "__call__" of "_lru_cache_wrapper_1" has incompatible type "str"; expected "Type[Style]"  [arg-type]
+ rich/markup.py:214: error: Missing positional argument "style" in call to "__call__" of "_lru_cache_wrapper_1"  [call-arg]
+ rich/markup.py:214: error: Argument 1 to "__call__" of "_lru_cache_wrapper_1" has incompatible type "str"; expected "Type[Style]"  [arg-type]
+ rich/jupyter.py:72: error: Argument 1 to "__call__" of "_lru_cache_wrapper_1" has incompatible type "TerminalTheme"; expected "Style"  [arg-type]
+ rich/console.py:1439: error: Missing positional argument "style_definition" in call to "__call__" of "_lru_cache_wrapper_1"  [call-arg]
+ rich/console.py:1439: error: Argument 1 to "__call__" of "_lru_cache_wrapper_1" has incompatible type "str"; expected "Type[Style]"  [arg-type]
+ rich/console.py:2156: error: Argument 1 to "__call__" of "_lru_cache_wrapper_1" has incompatible type "TerminalTheme"; expected "Style"  [arg-type]
+ rich/console.py:2168: error: Argument 1 to "__call__" of "_lru_cache_wrapper_1" has incompatible type "TerminalTheme"; expected "Style"  [arg-type]
+ rich/console.py:2281: error: Argument 1 to "__call__" of "_lru_cache_wrapper_1" has incompatible type "TerminalTheme"; expected "Style"  [arg-type]
+ rich/color.py:545: error: Missing positional argument "color" in call to "__call__" of "_lru_cache_wrapper_1"  [call-arg]
+ rich/color.py:545: error: Argument 1 to "__call__" of "_lru_cache_wrapper_1" has incompatible type "ColorTriplet"; expected "Palette"  [arg-type]
+ rich/color.py:558: error: Missing positional argument "color" in call to "__call__" of "_lru_cache_wrapper_1"  [call-arg]
+ rich/color.py:558: error: Argument 1 to "__call__" of "_lru_cache_wrapper_1" has incompatible type "ColorTriplet"; expected "Palette"  [arg-type]
+ rich/ansi.py:172: error: Missing positional argument "style_definition" in call to "__call__" of "_lru_cache_wrapper_1"  [call-arg]
+ rich/ansi.py:172: error: Argument 1 to "__call__" of "_lru_cache_wrapper_1" has incompatible type "str"; expected "Type[Style]"  [arg-type]
+ rich/progress_bar.py:144: error: Missing positional argument "no_color" in call to "__call__" of "_lru_cache_wrapper_1"  [call-arg]
+ rich/progress_bar.py:145: error: Argument 1 to "__call__" of "_lru_cache_wrapper_1" has incompatible type "Style"; expected "ProgressBar"  [arg-type]
+ rich/progress_bar.py:145: error: Argument 3 to "__call__" of "_lru_cache_wrapper_1" has incompatible type "Optional[str]"; expected "Style"  [arg-type]
+ rich/progress_bar.py:145: error: Argument 4 to "__call__" of "_lru_cache_wrapper_1" has incompatible type "bool"; expected "str"  [arg-type]

pandas (https://github.com/pandas-dev/pandas)
+ pandas/core/dtypes/cast.py:535: error: Unused "type: ignore" comment

poetry (https://github.com/python-poetry/poetry)
+ src/poetry/mixology/term.py:48: error: Missing positional argument "other" in call to "__call__" of "_lru_cache_wrapper_1"  [call-arg]
+ src/poetry/mixology/term.py:152: error: Missing positional argument "other" in call to "__call__" of "_lru_cache_wrapper_1"  [call-arg]
+ src/poetry/mixology/incompatibility.py:53: error: Missing positional argument "other" in call to "__call__" of "_lru_cache_wrapper_1"  [call-arg]
+ src/poetry/mixology/partial_solution.py:150: error: Missing positional argument "other" in call to "__call__" of "_lru_cache_wrapper_1"  [call-arg]
+ src/poetry/mixology/partial_solution.py:160: error: Missing positional argument "other" in call to "__call__" of "_lru_cache_wrapper_1"  [call-arg]
+ src/poetry/mixology/partial_solution.py:214: error: Missing positional argument "other" in call to "__call__" of "_lru_cache_wrapper_1"  [call-arg]
+ src/poetry/mixology/partial_solution.py:224: error: Missing positional argument "other" in call to "__call__" of "_lru_cache_wrapper_1"  [call-arg]

jinja (https://github.com/pallets/jinja)
+ src/jinja2/environment.py:1184: error: Unused "type: ignore" comment
+ src/jinja2/environment.py:1199: error: Unused "type: ignore" comment

manticore (https://github.com/trailofbits/manticore)
+ manticore/core/smtlib/solver.py:505: error: Signature of "can_be_true" incompatible with supertype "Solver"

isort (https://github.com/pycqa/isort)
+ isort/deprecated/finders.py:302: error: Missing positional argument "path" in call to "__call__" of "_lru_cache_wrapper_1"
+ isort/deprecated/finders.py:302: error: Argument 1 to "__call__" of "_lru_cache_wrapper_1" has incompatible type "str"; expected "Type[RequirementsFinder]"
+ isort/deprecated/finders.py:333: error: Missing positional argument "path" in call to "__call__" of "_lru_cache_wrapper_1"
+ isort/deprecated/finders.py:333: error: Argument 1 to "__call__" of "_lru_cache_wrapper_1" has incompatible type "str"; expected "Type[RequirementsFinder]"

paroxython (https://github.com/laowantong/paroxython)
+ paroxython/assess_costs.py:128: error: Missing positional argument "taxon" in call to "__call__" of "_lru_cache_wrapper_1"
+ paroxython/assess_costs.py:128: error: Argument 1 to "__call__" of "_lru_cache_wrapper_1" has incompatible type "TaxonName"; expected "LearningCostAssessor"
+ paroxython/recommend_programs.py:290: error: Missing positional argument "taxon" in call to "__call__" of "_lru_cache_wrapper_1"
+ paroxython/recommend_programs.py:290: error: Argument 1 to "__call__" of "_lru_cache_wrapper_1" has incompatible type "TaxonName"; expected "LearningCostAssessor"

mypy (https://github.com/python/mypy)
+ mypy/find_sources.py:161: error: Missing positional argument "dir" in call to "__call__" of "_lru_cache_wrapper_1"  [call-arg]
+ mypy/find_sources.py:161: error: Argument 1 to "__call__" of "_lru_cache_wrapper_1" has incompatible type "str"; expected "SourceFinder"  [arg-type]
+ mypy/find_sources.py:203: error: Missing positional argument "dir" in call to "__call__" of "_lru_cache_wrapper_1"  [call-arg]
+ mypy/find_sources.py:203: error: Argument 1 to "__call__" of "_lru_cache_wrapper_1" has incompatible type "str"; expected "SourceFinder"  [arg-type]

pip (https://github.com/pypa/pip)
+ src/pip/_internal/locations/__init__.py:398: error: Unexpected keyword argument "user" for "__call__" of "_lru_cache_wrapper_0"
+ src/pip/_internal/locations/__init__.py:398: error: Unexpected keyword argument "home" for "__call__" of "_lru_cache_wrapper_0"
+ src/pip/_internal/locations/__init__.py:398: error: Unexpected keyword argument "root" for "__call__" of "_lru_cache_wrapper_0"
+ src/pip/_internal/locations/__init__.py:398: error: Unexpected keyword argument "prefix" for "__call__" of "_lru_cache_wrapper_0"
+ src/pip/_internal/locations/__init__.py:518: error: Unexpected keyword argument "prefix" for "__call__" of "_lru_cache_wrapper_0"
+ src/pip/_internal/req/req_install.py:491: error: Missing positional argument "self" in call to "__call__" of "_lru_cache_wrapper_1"
+ src/pip/_internal/req/req_install.py:517: error: Missing positional argument "self" in call to "__call__" of "_lru_cache_wrapper_1"
+ src/pip/_internal/index/package_finder.py:894: error: Missing positional argument "project_name" in call to "__call__" of "_lru_cache_wrapper_1"
+ src/pip/_internal/index/package_finder.py:894: error: Argument 1 to "__call__" of "_lru_cache_wrapper_1" has incompatible type "str"; expected "PackageFinder"
+ src/pip/_internal/index/package_finder.py:912: error: Missing positional argument "project_name" in call to "__call__" of "_lru_cache_wrapper_1"
+ src/pip/_internal/index/package_finder.py:913: error: Argument 1 to "__call__" of "_lru_cache_wrapper_1" has incompatible type "str"; expected "PackageFinder"
+ src/pip/_internal/self_outdated_check.py:178: error: Missing positional argument "project_name" in call to "__call__" of "_lru_cache_wrapper_1"
+ src/pip/_internal/self_outdated_check.py:178: error: Argument 1 to "__call__" of "_lru_cache_wrapper_1" has incompatible type "str"; expected "PackageFinder"
+ src/pip/_internal/wheel_builder.py:75: error: Missing positional argument "self" in call to "__call__" of "_lru_cache_wrapper_1"
+ src/pip/_internal/distributions/sdist.py:109: error: Missing positional argument "self" in call to "__call__" of "_lru_cache_wrapper_1"
+ src/pip/_internal/resolution/resolvelib/factory.py:294: error: Missing positional argument "self" in call to "__call__" of "_lru_cache_wrapper_1"
+ src/pip/_internal/resolution/resolvelib/factory.py:613: error: Missing positional argument "project_name" in call to "__call__" of "_lru_cache_wrapper_1"
+ src/pip/_internal/resolution/resolvelib/factory.py:613: error: Argument 1 to "__call__" of "_lru_cache_wrapper_1" has incompatible type "NormalizedName"; expected "PackageFinder"
+ src/pip/_internal/commands/list.py:232: error: Missing positional argument "project_name" in call to "__call__" of "_lru_cache_wrapper_1"
+ src/pip/_internal/commands/list.py:232: error: Argument 1 to "__call__" of "_lru_cache_wrapper_1" has incompatible type "NormalizedName"; expected "PackageFinder"
+ src/pip/_internal/commands/index.py:119: error: Missing positional argument "project_name" in call to "__call__" of "_lru_cache_wrapper_1"

pydantic (https://github.com/samuelcolvin/pydantic)
+ pydantic/tools.py:37: error: Unused "type: ignore" comment

pylint (https://github.com/pycqa/pylint)
+ pylint/utils/file_state.py:100: error: Missing positional argument "msgid_or_symbol" in call to "__call__" of "_lru_cache_wrapper_1"  [call-arg]
+ pylint/utils/file_state.py:100: error: Argument 1 to "__call__" of "_lru_cache_wrapper_1" has incompatible type "str"; expected "MessageDefinitionStore"  [arg-type]
+ pylint/message/message_definition_store.py:73: error: Missing positional argument "msgid_or_symbol" in call to "__call__" of "_lru_cache_wrapper_1"  [call-arg]
+ pylint/message/message_definition_store.py:73: error: Argument 1 to "__call__" of "_lru_cache_wrapper_1" has incompatible type "str"; expected "MessageDefinitionStore"  [arg-type]
+ pylint/message/message_definition_store.py:82: error: Missing positional argument "msgid_or_symbol" in call to "__call__" of "_lru_cache_wrapper_1"  [call-arg]
+ pylint/message/message_definition_store.py:83: error: Argument 1 to "__call__" of "_lru_cache_wrapper_1" has incompatible type "str"; expected "MessageDefinitionStore"  [arg-type]
+ pylint/lint/pylinter.py:1338: error: Missing positional argument "msgid_or_symbol" in call to "__call__" of "_lru_cache_wrapper_1"  [call-arg]
+ pylint/lint/pylinter.py:1338: error: Argument 1 to "__call__" of "_lru_cache_wrapper_1" has incompatible type "str"; expected "MessageDefinitionStore"  [arg-type]
+ pylint/lint/pylinter.py:1365: error: Missing positional argument "msgid_or_symbol" in call to "__call__" of "_lru_cache_wrapper_1"  [call-arg]
+ pylint/lint/pylinter.py:1365: error: Argument 1 to "__call__" of "_lru_cache_wrapper_1" has incompatible type "str"; expected "MessageDefinitionStore"  [arg-type]
+ pylint/lint/pylinter.py:1438: error: Missing positional argument "msgid_or_symbol" in call to "__call__" of "_lru_cache_wrapper_1"  [call-arg]
+ pylint/lint/pylinter.py:1438: error: Argument 1 to "__call__" of "_lru_cache_wrapper_1" has incompatible type "str"; expected "MessageDefinitionStore"  [arg-type]
+ pylint/lint/pylinter.py:1466: error: Missing positional argument "msgid_or_symbol" in call to "__call__" of "_lru_cache_wrapper_1"  [call-arg]
+ pylint/lint/pylinter.py:1466: error: Argument 1 to "__call__" of "_lru_cache_wrapper_1" has incompatible type "str"; expected "MessageDefinitionStore"  [arg-type]
+ pylint/checkers/format.py:451: error: Missing positional argument "msgid_or_symbol" in call to "__call__" of "_lru_cache_wrapper_1"  [call-arg]
+ pylint/checkers/format.py:452: error: Argument 1 to "__call__" of "_lru_cache_wrapper_1" has incompatible type "str"; expected "MessageDefinitionStore"  [arg-type]

github-actions[bot] avatar May 03 '22 00:05 github-actions[bot]

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

rich (https://github.com/willmcgugan/rich)
+ rich/theme.py:25: error: Missing positional argument "style_definition" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ rich/theme.py:25: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "Type[Style]"  [arg-type]
+ rich/theme.py:54: error: Missing positional argument "style_definition" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ rich/theme.py:54: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "Type[Style]"  [arg-type]
+ rich/style.py:148: error: Missing positional argument "color" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ rich/style.py:148: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "Type[Color]"  [arg-type]
+ rich/style.py:416: error: Missing positional argument "style_definition" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ rich/style.py:416: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "Type[Style]"  [arg-type]
+ rich/style.py:542: error: Missing positional argument "color" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ rich/style.py:542: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "Type[Color]"  [arg-type]
+ rich/style.py:569: error: Missing positional argument "color" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ rich/style.py:569: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "Type[Color]"  [arg-type]
+ rich/markup.py:157: error: Missing positional argument "style" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ rich/markup.py:157: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "Type[Style]"  [arg-type]
+ rich/markup.py:214: error: Missing positional argument "style" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ rich/markup.py:214: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "Type[Style]"  [arg-type]
+ rich/console.py:1439: error: Missing positional argument "style_definition" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ rich/console.py:1439: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "Type[Style]"  [arg-type]
+ rich/ansi.py:172: error: Missing positional argument "style_definition" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ rich/ansi.py:172: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "Type[Style]"  [arg-type]
+ rich/progress_bar.py:145: error: Argument 3 to "__call__" of "_lru_cache_wrapper_1" has incompatible type "Optional[str]"; expected "str"  [arg-type]

manticore (https://github.com/trailofbits/manticore)
+ manticore/core/smtlib/solver.py:505: error: Signature of "can_be_true" incompatible with supertype "Solver"

jinja (https://github.com/pallets/jinja)
+ src/jinja2/environment.py:1184: error: Unused "type: ignore" comment
+ src/jinja2/environment.py:1199: error: Unused "type: ignore" comment

aiohttp (https://github.com/aio-libs/aiohttp)
+ aiohttp/connector.py:935: error: Too many arguments for "__call__" of "_lru_cache_wrapper_1"  [call-arg]
+ aiohttp/connector.py:941: error: Too many arguments for "__call__" of "_lru_cache_wrapper_1"  [call-arg]
+ aiohttp/connector.py:942: error: Too many arguments for "__call__" of "_lru_cache_wrapper_1"  [call-arg]

pandas (https://github.com/pandas-dev/pandas)
+ pandas/core/dtypes/cast.py:535: error: Unused "type: ignore" comment

paroxython (https://github.com/laowantong/paroxython)
+ paroxython/assess_costs.py:85: error: Incompatible types in assignment (expression has type "_lru_cache_wrapper[int, [int], float]", variable has type "_lru_cache_wrapper_1[[int], float]")

pip (https://github.com/pypa/pip)
+ src/pip/_internal/locations/__init__.py:398: error: Unexpected keyword argument "user" for "__call__" of "_lru_cache_wrapper_0"
+ src/pip/_internal/locations/__init__.py:398: error: Unexpected keyword argument "home" for "__call__" of "_lru_cache_wrapper_0"
+ src/pip/_internal/locations/__init__.py:398: error: Unexpected keyword argument "root" for "__call__" of "_lru_cache_wrapper_0"
+ src/pip/_internal/locations/__init__.py:398: error: Unexpected keyword argument "prefix" for "__call__" of "_lru_cache_wrapper_0"
+ src/pip/_internal/locations/__init__.py:518: error: Unexpected keyword argument "prefix" for "__call__" of "_lru_cache_wrapper_0"

pydantic (https://github.com/samuelcolvin/pydantic)
+ pydantic/tools.py:37: error: Unused "type: ignore" comment

github-actions[bot] avatar May 03 '22 00:05 github-actions[bot]

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

rich (https://github.com/willmcgugan/rich)
+ rich/theme.py:25: error: Missing positional argument "style_definition" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ rich/theme.py:25: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "Type[Style]"  [arg-type]
+ rich/theme.py:54: error: Missing positional argument "style_definition" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ rich/theme.py:54: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "Type[Style]"  [arg-type]
+ rich/style.py:148: error: Missing positional argument "color" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ rich/style.py:148: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "Type[Color]"  [arg-type]
+ rich/style.py:416: error: Missing positional argument "style_definition" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ rich/style.py:416: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "Type[Style]"  [arg-type]
+ rich/style.py:542: error: Missing positional argument "color" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ rich/style.py:542: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "Type[Color]"  [arg-type]
+ rich/style.py:569: error: Missing positional argument "color" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ rich/style.py:569: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "Type[Color]"  [arg-type]
+ rich/markup.py:157: error: Missing positional argument "style" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ rich/markup.py:157: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "Type[Style]"  [arg-type]
+ rich/markup.py:214: error: Missing positional argument "style" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ rich/markup.py:214: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "Type[Style]"  [arg-type]
+ rich/console.py:1439: error: Missing positional argument "style_definition" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ rich/console.py:1439: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "Type[Style]"  [arg-type]
+ rich/ansi.py:172: error: Missing positional argument "style_definition" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ rich/ansi.py:172: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "Type[Style]"  [arg-type]
+ rich/progress_bar.py:145: error: Argument 3 to "__call__" of "_lru_cache_wrapper_1" has incompatible type "Optional[str]"; expected "str"  [arg-type]

manticore (https://github.com/trailofbits/manticore)
+ manticore/core/smtlib/solver.py:505: error: Signature of "can_be_true" incompatible with supertype "Solver"

jinja (https://github.com/pallets/jinja)
+ src/jinja2/environment.py:1184: error: Unused "type: ignore" comment
+ src/jinja2/environment.py:1199: error: Unused "type: ignore" comment

aiohttp (https://github.com/aio-libs/aiohttp)
+ aiohttp/connector.py:935: error: Too many arguments for "__call__" of "_lru_cache_wrapper_1"  [call-arg]
+ aiohttp/connector.py:941: error: Too many arguments for "__call__" of "_lru_cache_wrapper_1"  [call-arg]
+ aiohttp/connector.py:942: error: Too many arguments for "__call__" of "_lru_cache_wrapper_1"  [call-arg]

pandas (https://github.com/pandas-dev/pandas)
+ pandas/core/dtypes/cast.py:535: error: Unused "type: ignore" comment

paroxython (https://github.com/laowantong/paroxython)
+ paroxython/assess_costs.py:85: error: Incompatible types in assignment (expression has type "_lru_cache_wrapper[int, [int], float]", variable has type "_lru_cache_wrapper_1[[int], float]")

pip (https://github.com/pypa/pip)
+ src/pip/_internal/locations/__init__.py:398: error: Unexpected keyword argument "user" for "__call__" of "_lru_cache_wrapper_0"
+ src/pip/_internal/locations/__init__.py:398: error: Unexpected keyword argument "home" for "__call__" of "_lru_cache_wrapper_0"
+ src/pip/_internal/locations/__init__.py:398: error: Unexpected keyword argument "root" for "__call__" of "_lru_cache_wrapper_0"
+ src/pip/_internal/locations/__init__.py:398: error: Unexpected keyword argument "prefix" for "__call__" of "_lru_cache_wrapper_0"
+ src/pip/_internal/locations/__init__.py:518: error: Unexpected keyword argument "prefix" for "__call__" of "_lru_cache_wrapper_0"

pydantic (https://github.com/samuelcolvin/pydantic)
+ pydantic/tools.py:37: error: Unused "type: ignore" comment

github-actions[bot] avatar May 03 '22 00:05 github-actions[bot]

hmmm, this is close but not quite there. seems my little descriptor trick fixes a lot of situations but doesn't quite work for classmethods. also seems to trigger an internal error in mypy (though pyright is ok with it) -- mypy's matching of Callable with ParamSpec seems a little incomplete

I had originally written this idea as a WIP mypy plugin

asottile avatar May 03 '22 00:05 asottile

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

rich (https://github.com/willmcgugan/rich)
+ rich/theme.py:25: error: Missing positional argument "style_definition" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ rich/theme.py:25: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "Type[Style]"  [arg-type]
+ rich/theme.py:54: error: Missing positional argument "style_definition" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ rich/theme.py:54: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "Type[Style]"  [arg-type]
+ rich/style.py:148: error: Missing positional argument "color" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ rich/style.py:148: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "Type[Color]"  [arg-type]
+ rich/style.py:416: error: Missing positional argument "style_definition" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ rich/style.py:416: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "Type[Style]"  [arg-type]
+ rich/style.py:542: error: Missing positional argument "color" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ rich/style.py:542: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "Type[Color]"  [arg-type]
+ rich/style.py:569: error: Missing positional argument "color" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ rich/style.py:569: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "Type[Color]"  [arg-type]
+ rich/markup.py:157: error: Missing positional argument "style" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ rich/markup.py:157: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "Type[Style]"  [arg-type]
+ rich/markup.py:214: error: Missing positional argument "style" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ rich/markup.py:214: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "Type[Style]"  [arg-type]
+ rich/console.py:1439: error: Missing positional argument "style_definition" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ rich/console.py:1439: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "Type[Style]"  [arg-type]
+ rich/ansi.py:172: error: Missing positional argument "style_definition" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ rich/ansi.py:172: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "Type[Style]"  [arg-type]
+ rich/progress_bar.py:145: error: Argument 3 to "__call__" of "_lru_cache_wrapper_0" has incompatible type "Optional[str]"; expected "str"  [arg-type]

jinja (https://github.com/pallets/jinja)
+ src/jinja2/environment.py:1184: error: Unused "type: ignore" comment
+ src/jinja2/environment.py:1199: error: Unused "type: ignore" comment

aiohttp (https://github.com/aio-libs/aiohttp)
+ aiohttp/connector.py:935: error: Too many arguments for "__call__" of "_lru_cache_wrapper_0"  [call-arg]
+ aiohttp/connector.py:941: error: Too many arguments for "__call__" of "_lru_cache_wrapper_0"  [call-arg]
+ aiohttp/connector.py:942: error: Too many arguments for "__call__" of "_lru_cache_wrapper_0"  [call-arg]

pandas (https://github.com/pandas-dev/pandas)
+ pandas/core/dtypes/cast.py:535: error: Unused "type: ignore" comment

manticore (https://github.com/trailofbits/manticore)
+ manticore/core/smtlib/solver.py:505: error: Signature of "can_be_true" incompatible with supertype "Solver"

paroxython (https://github.com/laowantong/paroxython)
+ paroxython/assess_costs.py:85: error: Incompatible types in assignment (expression has type "_lru_cache_wrapper[int, [int], float]", variable has type "_lru_cache_wrapper_0[[int], float]")

pydantic (https://github.com/samuelcolvin/pydantic)
+ pydantic/tools.py:37: error: Unused "type: ignore" comment

github-actions[bot] avatar May 03 '22 01:05 github-actions[bot]

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

rich (https://github.com/willmcgugan/rich)
+ rich/progress_bar.py:145: error: Argument 3 to "__call__" of "_lru_cache_wrapper_0" has incompatible type "Optional[str]"; expected "str"  [arg-type]

manticore (https://github.com/trailofbits/manticore)
+ manticore/core/smtlib/solver.py:505: error: Signature of "can_be_true" incompatible with supertype "Solver"

jinja (https://github.com/pallets/jinja)
+ src/jinja2/environment.py:1184: error: Unused "type: ignore" comment
+ src/jinja2/environment.py:1199: error: Unused "type: ignore" comment

aiohttp (https://github.com/aio-libs/aiohttp)
+ aiohttp/connector.py:935: error: Too many arguments for "__call__" of "_lru_cache_wrapper_0"  [call-arg]
+ aiohttp/connector.py:941: error: Too many arguments for "__call__" of "_lru_cache_wrapper_0"  [call-arg]
+ aiohttp/connector.py:942: error: Too many arguments for "__call__" of "_lru_cache_wrapper_0"  [call-arg]

pandas (https://github.com/pandas-dev/pandas)
+ pandas/core/dtypes/cast.py:535: error: Unused "type: ignore" comment

paroxython (https://github.com/laowantong/paroxython)
+ paroxython/assess_costs.py:85: error: Incompatible types in assignment (expression has type "_lru_cache_wrapper[int, [int], float]", variable has type "_lru_cache_wrapper_0[[int], float]")

pydantic (https://github.com/samuelcolvin/pydantic)
+ pydantic/tools.py:37: error: Unused "type: ignore" comment

github-actions[bot] avatar May 03 '22 04:05 github-actions[bot]

Linking to previous typeshed discussion on this topic:

  • https://github.com/python/typeshed/issues/6347

AlexWaygood avatar May 03 '22 09:05 AlexWaygood

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

rich (https://github.com/willmcgugan/rich)
+ rich/progress_bar.py:145: error: Argument 3 to "__call__" of "_lru_cache_wrapper_0" has incompatible type "Optional[str]"; expected "str"  [arg-type]

pandas (https://github.com/pandas-dev/pandas)
+ pandas/core/dtypes/cast.py:559: error: Unused "type: ignore" comment

jinja (https://github.com/pallets/jinja)
+ src/jinja2/environment.py:1184: error: Unused "type: ignore" comment
+ src/jinja2/environment.py:1199: error: Unused "type: ignore" comment

manticore (https://github.com/trailofbits/manticore)
+ manticore/core/smtlib/solver.py:505: error: Signature of "can_be_true" incompatible with supertype "Solver"

aiohttp (https://github.com/aio-libs/aiohttp)
+ aiohttp/connector.py:935: error: Too many arguments for "__call__" of "_lru_cache_wrapper_0"  [call-arg]
+ aiohttp/connector.py:941: error: Too many arguments for "__call__" of "_lru_cache_wrapper_0"  [call-arg]
+ aiohttp/connector.py:942: error: Too many arguments for "__call__" of "_lru_cache_wrapper_0"  [call-arg]

paroxython (https://github.com/laowantong/paroxython)
+ paroxython/assess_costs.py:85: error: Incompatible types in assignment (expression has type "_lru_cache_wrapper[int, [int], float]", variable has type "_lru_cache_wrapper_0[[int], float]")

pydantic (https://github.com/samuelcolvin/pydantic)
+ pydantic/tools.py:37: error: Unused "type: ignore" comment

github-actions[bot] avatar May 18 '22 23:05 github-actions[bot]

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

rich (https://github.com/willmcgugan/rich)
+ rich/progress_bar.py:145: error: Argument 3 to "__call__" of "_lru_cache_wrapper_0" has incompatible type "Optional[str]"; expected "str"  [arg-type]

manticore (https://github.com/trailofbits/manticore)
+ manticore/core/smtlib/solver.py:505: error: Signature of "can_be_true" incompatible with supertype "Solver"

aiohttp (https://github.com/aio-libs/aiohttp)
+ aiohttp/connector.py:935: error: Too many arguments for "__call__" of "_lru_cache_wrapper_0"  [call-arg]
+ aiohttp/connector.py:941: error: Too many arguments for "__call__" of "_lru_cache_wrapper_0"  [call-arg]
+ aiohttp/connector.py:942: error: Too many arguments for "__call__" of "_lru_cache_wrapper_0"  [call-arg]

jinja (https://github.com/pallets/jinja)
+ src/jinja2/environment.py:1184: error: Unused "type: ignore" comment
+ src/jinja2/environment.py:1199: error: Unused "type: ignore" comment

pandas (https://github.com/pandas-dev/pandas)
+ pandas/core/dtypes/cast.py:559: error: Unused "type: ignore" comment

paroxython (https://github.com/laowantong/paroxython)
+ paroxython/assess_costs.py:85: error: Incompatible types in assignment (expression has type "_lru_cache_wrapper[int, [int], float]", variable has type "_lru_cache_wrapper_0[[int], float]")

pydantic (https://github.com/samuelcolvin/pydantic)
+ pydantic/tools.py:37: error: Unused "type: ignore" comment

github-actions[bot] avatar May 19 '22 12:05 github-actions[bot]

I've reported the mypy crash at https://github.com/python/mypy/issues/12922.

AlexWaygood avatar Jun 01 '22 15:06 AlexWaygood

I've reported the mypy crash at python/mypy#12922.

The crash should be fixed in 0.970 now that https://github.com/python/mypy/pull/12953 has been merged :)

AlexWaygood avatar Jun 07 '22 23:06 AlexWaygood

Marking this as deferred until mypy 0.970 has been released.

AlexWaygood avatar Jun 12 '22 18:06 AlexWaygood

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

rich (https://github.com/willmcgugan/rich)
+ rich/progress_bar.py:145: error: Argument 3 to "__call__" of "_lru_cache_wrapper_0" has incompatible type "Optional[str]"; expected "str"  [arg-type]

zulip (https://github.com/zulip/zulip)
+ zerver/lib/cache.py:744: error: "_lru_cache_wrapper" expects 3 type arguments, but 1 given  [type-arg]
+ zerver/lib/cache.py:761: error: Unused "type: ignore" comment

pandas (https://github.com/pandas-dev/pandas)
+ pandas/core/dtypes/cast.py:559: error: Unused "type: ignore" comment

jinja (https://github.com/pallets/jinja)
+ src/jinja2/environment.py:1184: error: Unused "type: ignore" comment
+ src/jinja2/environment.py:1199: error: Unused "type: ignore" comment

manticore (https://github.com/trailofbits/manticore)
+ manticore/core/smtlib/solver.py:505: error: Signature of "can_be_true" incompatible with supertype "Solver"

aiohttp (https://github.com/aio-libs/aiohttp)
+ aiohttp/connector.py:935: error: Too many arguments for "__call__" of "_lru_cache_wrapper_0"  [call-arg]
+ aiohttp/connector.py:941: error: Too many arguments for "__call__" of "_lru_cache_wrapper_0"  [call-arg]
+ aiohttp/connector.py:942: error: Too many arguments for "__call__" of "_lru_cache_wrapper_0"  [call-arg]

ibis (https://github.com/ibis-project/ibis)
+ ibis/backends/duckdb/tests/conftest.py:19: error: Too many arguments for "__call__" of "_lru_cache_wrapper_0"
+ ibis/backends/duckdb/tests/conftest.py:53: error: Signature of "connect" incompatible with supertype "BackendTest"

paroxython (https://github.com/laowantong/paroxython)
+ paroxython/assess_costs.py:85: error: Incompatible types in assignment (expression has type "_lru_cache_wrapper[int, [int], float]", variable has type "_lru_cache_wrapper_0[[int], float]")

pydantic (https://github.com/samuelcolvin/pydantic)
+ pydantic/tools.py:37: error: Unused "type: ignore" comment

github-actions[bot] avatar Jul 19 '22 15:07 github-actions[bot]

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

zulip (https://github.com/zulip/zulip)
+ zerver/lib/cache.py:744: error: "_lru_cache_wrapper" expects 3 type arguments, but 1 given  [type-arg]
+ zerver/lib/cache.py:761: error: Unused "type: ignore" comment

rich (https://github.com/willmcgugan/rich)
+ rich/progress_bar.py:145: error: Argument 3 to "__call__" of "_lru_cache_wrapper_0" has incompatible type "Optional[str]"; expected "str"  [arg-type]

manticore (https://github.com/trailofbits/manticore)
+ manticore/core/smtlib/solver.py:505: error: Signature of "can_be_true" incompatible with supertype "Solver"

aiohttp (https://github.com/aio-libs/aiohttp)
+ aiohttp/connector.py:935: error: Too many arguments for "__call__" of "_lru_cache_wrapper_0"  [call-arg]
+ aiohttp/connector.py:941: error: Too many arguments for "__call__" of "_lru_cache_wrapper_0"  [call-arg]
+ aiohttp/connector.py:942: error: Too many arguments for "__call__" of "_lru_cache_wrapper_0"  [call-arg]

jinja (https://github.com/pallets/jinja)
+ src/jinja2/environment.py:1184: error: Unused "type: ignore" comment
+ src/jinja2/environment.py:1199: error: Unused "type: ignore" comment

pandas (https://github.com/pandas-dev/pandas)
+ pandas/core/dtypes/cast.py:559: error: Unused "type: ignore" comment

ibis (https://github.com/ibis-project/ibis)
+ ibis/backends/duckdb/tests/conftest.py:19: error: Too many arguments for "__call__" of "_lru_cache_wrapper_0"
+ ibis/backends/duckdb/tests/conftest.py:53: error: Signature of "connect" incompatible with supertype "BackendTest"

paroxython (https://github.com/laowantong/paroxython)
+ paroxython/assess_costs.py:85: error: Incompatible types in assignment (expression has type "_lru_cache_wrapper[int, [int], float]", variable has type "_lru_cache_wrapper_0[[int], float]")

pydantic (https://github.com/samuelcolvin/pydantic)
+ pydantic/tools.py:37: error: Unused "type: ignore" comment

github-actions[bot] avatar Jul 19 '22 15:07 github-actions[bot]

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

rich (https://github.com/willmcgugan/rich)
+ rich/progress_bar.py:145: error: Argument 3 to "__call__" of "_lru_cache_wrapper_0" has incompatible type "Optional[str]"; expected "str"  [arg-type]

zulip (https://github.com/zulip/zulip)
+ zerver/lib/cache.py:744: error: "_lru_cache_wrapper" expects 3 type arguments, but 1 given  [type-arg]
+ zerver/lib/cache.py:761: error: Unused "type: ignore" comment

pandas (https://github.com/pandas-dev/pandas)
+ pandas/core/dtypes/cast.py:559: error: Unused "type: ignore" comment

aiohttp (https://github.com/aio-libs/aiohttp)
+ aiohttp/connector.py:935: error: Too many arguments for "__call__" of "_lru_cache_wrapper_0"  [call-arg]
+ aiohttp/connector.py:941: error: Too many arguments for "__call__" of "_lru_cache_wrapper_0"  [call-arg]
+ aiohttp/connector.py:942: error: Too many arguments for "__call__" of "_lru_cache_wrapper_0"  [call-arg]

jinja (https://github.com/pallets/jinja)
+ src/jinja2/environment.py:1184: error: Unused "type: ignore" comment
+ src/jinja2/environment.py:1199: error: Unused "type: ignore" comment

manticore (https://github.com/trailofbits/manticore)
+ manticore/core/smtlib/solver.py:505: error: Signature of "can_be_true" incompatible with supertype "Solver"

ibis (https://github.com/ibis-project/ibis)
+ ibis/backends/duckdb/tests/conftest.py:19: error: Too many arguments for "__call__" of "_lru_cache_wrapper_0"
+ ibis/backends/duckdb/tests/conftest.py:53: error: Signature of "connect" incompatible with supertype "BackendTest"

paroxython (https://github.com/laowantong/paroxython)
+ paroxython/assess_costs.py:85: error: Incompatible types in assignment (expression has type "_lru_cache_wrapper[int, [int], float]", variable has type "_lru_cache_wrapper_0[[int], float]")

pydantic (https://github.com/samuelcolvin/pydantic)
+ pydantic/tools.py:37: error: Unused "type: ignore" comment

github-actions[bot] avatar Jul 19 '22 15:07 github-actions[bot]

The patch no longer causes mypy to crash on 0.971, but there's now a stubtest failure. Also, the mypy_primer report is a bit of a mixed bag.

AlexWaygood avatar Jul 19 '22 15:07 AlexWaygood

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

zulip (https://github.com/zulip/zulip)
+ zerver/lib/cache.py:744: error: "_lru_cache_wrapper" expects 3 type arguments, but 1 given  [type-arg]
+ zerver/lib/cache.py:761: error: Unused "type: ignore" comment

rich (https://github.com/willmcgugan/rich)
+ rich/progress_bar.py:145: error: Argument 3 to "__call__" of "_lru_cache_wrapper_0" has incompatible type "Optional[str]"; expected "str"  [arg-type]

jinja (https://github.com/pallets/jinja)
+ src/jinja2/environment.py:1184: error: Unused "type: ignore" comment
+ src/jinja2/environment.py:1199: error: Unused "type: ignore" comment

pandas (https://github.com/pandas-dev/pandas)
+ pandas/core/dtypes/cast.py:559: error: Unused "type: ignore" comment

aiohttp (https://github.com/aio-libs/aiohttp)
+ aiohttp/connector.py:935: error: Too many arguments for "__call__" of "_lru_cache_wrapper_0"  [call-arg]
+ aiohttp/connector.py:941: error: Too many arguments for "__call__" of "_lru_cache_wrapper_0"  [call-arg]
+ aiohttp/connector.py:942: error: Too many arguments for "__call__" of "_lru_cache_wrapper_0"  [call-arg]

manticore (https://github.com/trailofbits/manticore)
+ manticore/core/smtlib/solver.py:505: error: Signature of "can_be_true" incompatible with supertype "Solver"

ibis (https://github.com/ibis-project/ibis)
+ ibis/backends/duckdb/tests/conftest.py:19: error: Too many arguments for "__call__" of "_lru_cache_wrapper_0"
+ ibis/backends/duckdb/tests/conftest.py:53: error: Signature of "connect" incompatible with supertype "BackendTest"

paroxython (https://github.com/laowantong/paroxython)
+ paroxython/assess_costs.py:85: error: Incompatible types in assignment (expression has type "_lru_cache_wrapper[int, [int], float]", variable has type "_lru_cache_wrapper_0[[int], float]")

pydantic (https://github.com/samuelcolvin/pydantic)
+ pydantic/tools.py:37: error: Unused "type: ignore" comment

github-actions[bot] avatar Jul 20 '22 17:07 github-actions[bot]

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

rich (https://github.com/willmcgugan/rich)
+ rich/progress_bar.py:145: error: Argument 3 to "__call__" of "_lru_cache_wrapper_0" has incompatible type "Optional[str]"; expected "str"  [arg-type]

zulip (https://github.com/zulip/zulip)
+ zerver/lib/cache.py:744: error: "_lru_cache_wrapper" expects 3 type arguments, but 1 given  [type-arg]
+ zerver/lib/cache.py:761: error: Unused "type: ignore" comment

pandas (https://github.com/pandas-dev/pandas)
+ pandas/core/dtypes/cast.py:559: error: Unused "type: ignore" comment

jinja (https://github.com/pallets/jinja)
+ src/jinja2/environment.py:1184: error: Unused "type: ignore" comment
+ src/jinja2/environment.py:1199: error: Unused "type: ignore" comment

aiohttp (https://github.com/aio-libs/aiohttp)
+ aiohttp/connector.py:935: error: Too many arguments for "__call__" of "_lru_cache_wrapper_0"  [call-arg]
+ aiohttp/connector.py:941: error: Too many arguments for "__call__" of "_lru_cache_wrapper_0"  [call-arg]
+ aiohttp/connector.py:942: error: Too many arguments for "__call__" of "_lru_cache_wrapper_0"  [call-arg]

manticore (https://github.com/trailofbits/manticore)
+ manticore/core/smtlib/solver.py:505: error: Signature of "can_be_true" incompatible with supertype "Solver"

ibis (https://github.com/ibis-project/ibis)
+ ibis/backends/duckdb/tests/conftest.py:19: error: Too many arguments for "__call__" of "_lru_cache_wrapper_0"
+ ibis/backends/duckdb/tests/conftest.py:53: error: Signature of "connect" incompatible with supertype "BackendTest"

paroxython (https://github.com/laowantong/paroxython)
+ paroxython/assess_costs.py:85: error: Incompatible types in assignment (expression has type "_lru_cache_wrapper[int, [int], float]", variable has type "_lru_cache_wrapper_0[[int], float]")

pydantic (https://github.com/samuelcolvin/pydantic)
+ pydantic/tools.py:37: error: Unused "type: ignore" comment

github-actions[bot] avatar Jul 20 '22 17:07 github-actions[bot]

Sorry if this derails at all. I noticed on: https://github.com/python/typeshed/pull/7771/files#diff-02c51ed45b741b6765c365fb5d6578c586510bbbd57b10a1dba10aeba37ae157R50

That this makes lru_cache a Generic[_P, _T] (names differ, but for commenting this is easier to represent). Would this PR be the same model to be applied to weakref as noted by the todo comment here: https://github.com/python/typeshed/blob/de1a79bd007e73bd57821a89e21bc08d4d07e75a/stdlib/weakref.pyi#L127

If this is too far off topic, just let me know and I can either create a new issue or table this question entirely

kkirsche avatar Jul 28 '22 17:07 kkirsche

@kkirsche, yeah, that's quite off-topic for this PR thread, I'd recommend opening an issue if you want to seek clarification on that :)

AlexWaygood avatar Jul 28 '22 21:07 AlexWaygood

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

jax (https://github.com/google/jax)
+ jax/experimental/sharding.py:179: error: Signature of "device_replica_id_map" incompatible with supertype "XLACompatibleSharding"  [override]
+ jax/experimental/sharding.py:190: error: Signature of "_device_assignment" incompatible with supertype "XLACompatibleSharding"  [override]
+ jax/experimental/sharding.py:247: error: Signature of "devices_indices_map" incompatible with supertype "Sharding"  [override]
+ jax/experimental/sharding.py:252: error: Signature of "device_replica_id_map" incompatible with supertype "XLACompatibleSharding"  [override]
+ jax/experimental/sharding.py:293: error: Signature of "devices_indices_map" incompatible with supertype "Sharding"  [override]
+ jax/experimental/sharding.py:303: error: Signature of "device_replica_id_map" incompatible with supertype "XLACompatibleSharding"  [override]
+ jax/experimental/sharding.py:314: error: Signature of "_device_assignment" incompatible with supertype "XLACompatibleSharding"  [override]

zulip (https://github.com/zulip/zulip)
+ zerver/lib/cache.py:744: error: "_lru_cache_wrapper" expects 3 type arguments, but 1 given  [type-arg]
+ zerver/lib/cache.py:761: error: Unused "type: ignore" comment

manticore (https://github.com/trailofbits/manticore)
+ manticore/core/smtlib/solver.py:505: error: Signature of "can_be_true" incompatible with supertype "Solver"

rich (https://github.com/Textualize/rich)
+ rich/progress_bar.py:145: error: Argument 3 to "__call__" of "_lru_cache_wrapper_0" has incompatible type "Optional[str]"; expected "str"  [arg-type]

jinja (https://github.com/pallets/jinja)
+ src/jinja2/environment.py:1184: error: Unused "type: ignore" comment
+ src/jinja2/environment.py:1199: error: Unused "type: ignore" comment

aiohttp (https://github.com/aio-libs/aiohttp)
+ aiohttp/connector.py:935: error: Too many arguments for "__call__" of "_lru_cache_wrapper_0"  [call-arg]
+ aiohttp/connector.py:941: error: Too many arguments for "__call__" of "_lru_cache_wrapper_0"  [call-arg]
+ aiohttp/connector.py:942: error: Too many arguments for "__call__" of "_lru_cache_wrapper_0"  [call-arg]

pandas (https://github.com/pandas-dev/pandas)
+ pandas/core/dtypes/cast.py:559: error: Unused "type: ignore" comment

ibis (https://github.com/ibis-project/ibis)
+ ibis/backends/duckdb/tests/conftest.py:19: error: Too many arguments for "__call__" of "_lru_cache_wrapper_0"
+ ibis/backends/duckdb/tests/conftest.py:53: error: Signature of "connect" incompatible with supertype "BackendTest"

paroxython (https://github.com/laowantong/paroxython)
+ paroxython/assess_costs.py:85: error: Incompatible types in assignment (expression has type "_lru_cache_wrapper[int, [int], float]", variable has type "_lru_cache_wrapper_0[[int], float]")

pydantic (https://github.com/samuelcolvin/pydantic)
+ pydantic/tools.py:37: error: Unused "type: ignore" comment

github-actions[bot] avatar Jul 28 '22 21:07 github-actions[bot]

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

jax (https://github.com/google/jax)
+ jax/experimental/sharding.py:94: error: Signature of "shard_shape" incompatible with supertype "Sharding"  [override]
+ jax/experimental/sharding.py:304: error: Signature of "devices_indices_map" incompatible with supertype "Sharding"  [override]
+ jax/experimental/sharding.py:317: error: Signature of "shard_shape" incompatible with supertype "XLACompatibleSharding"  [override]
+ jax/experimental/sharding.py:317: error: Signature of "shard_shape" incompatible with supertype "Sharding"  [override]
+ jax/experimental/sharding.py:378: error: Signature of "devices_indices_map" incompatible with supertype "Sharding"  [override]

manticore (https://github.com/trailofbits/manticore)
+ manticore/core/smtlib/solver.py:505: error: Signature of "can_be_true" incompatible with supertype "Solver"

pandas (https://github.com/pandas-dev/pandas)
+ pandas/core/dtypes/cast.py:560: error: Unused "type: ignore" comment

pydantic (https://github.com/samuelcolvin/pydantic)
+ pydantic/tools.py:37: error: Unused "type: ignore" comment

jinja (https://github.com/pallets/jinja)
+ src/jinja2/environment.py:1184: error: Unused "type: ignore" comment
+ src/jinja2/environment.py:1199: error: Unused "type: ignore" comment

ibis (https://github.com/ibis-project/ibis)
+ ibis/backends/duckdb/tests/conftest.py:19: error: Too many arguments for "__call__" of "_lru_cache_wrapper_0"
+ ibis/backends/duckdb/tests/conftest.py:53: error: Signature of "connect" incompatible with supertype "BackendTest"

paroxython (https://github.com/laowantong/paroxython)
+ paroxython/assess_costs.py:85: error: Incompatible types in assignment (expression has type "_lru_cache_wrapper[int, [int], float]", variable has type "_lru_cache_wrapper_0[[int], float]")

pylint (https://github.com/pycqa/pylint)
+ pylint/checkers/classes/class_checker.py:2002: error: Returning Any from function declared to return "Union[SupportsDunderLT[Any], SupportsDunderGT[Any]]"  [no-any-return]

rich (https://github.com/Textualize/rich)
+ rich/progress_bar.py:145: error: Argument 3 to "__call__" of "_lru_cache_wrapper_0" has incompatible type "Optional[str]"; expected "str"  [arg-type]

zulip (https://github.com/zulip/zulip)
+ zerver/lib/cache.py:744: error: "_lru_cache_wrapper" expects 3 type arguments, but 1 given  [type-arg]
+ zerver/lib/cache.py:761: error: Unused "type: ignore" comment

aiohttp (https://github.com/aio-libs/aiohttp)
+ aiohttp/connector.py:935: error: Too many arguments for "__call__" of "_lru_cache_wrapper_0"  [call-arg]
+ aiohttp/connector.py:941: error: Too many arguments for "__call__" of "_lru_cache_wrapper_0"  [call-arg]
+ aiohttp/connector.py:942: error: Too many arguments for "__call__" of "_lru_cache_wrapper_0"  [call-arg]

github-actions[bot] avatar Sep 13 '22 15:09 github-actions[bot]

this is going to go the same way as #7430 so I'm just going to retract it

asottile avatar Sep 13 '22 16:09 asottile

Hello, has this been implemented somewhere. lru_cache and cache would really benefit from ParamSpec they seem like the textbook usecase. Right now mypy is seeing the function args as Any which means my callsites are not enforced.

Greedquest avatar Nov 26 '22 11:11 Greedquest

I don't believe so. I know when I tried it originally, I had run into some problems getting everything to work with the various dunder (double underscore) properties. Some of my personal obligations are clearing up so I may be able to take another stab at this. I may have still misunderstood ParamSpec at that time (I wanted it to be more like typescript function parameter utility type). At the very least, giving it another shot should allow me to articulate more clearly what specific issues I ran into in case others may be able to help solve those.

kkirsche avatar Nov 26 '22 12:11 kkirsche

I believe the difficulty is in dealing with __get__ to make it work correctly as both a function and a method decorator.

JelleZijlstra avatar Nov 26 '22 14:11 JelleZijlstra