Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Use ParamSpec for lru_cache #11662

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

cdce8p
Copy link
Contributor

@cdce8p cdce8p commented Mar 26, 2024

This was originally added in #6221 but later reverted due to an incomplete ParamSpec implementation in mypy at the time. Maybe it works now.

Refs:


Deferred, waiting for outcome of this discussion: https://discuss.python.org/t/allow-self-binding-for-generic-paramspec/50948

stdlib/functools.pyi Outdated Show resolved Hide resolved
Copy link
Member

@JelleZijlstra JelleZijlstra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's see what mypy-primer says, but this looks correct to me.

We may also want to add some test cases.

Copy link
Contributor

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

paroxython (https://github.com/laowantong/paroxython)
+ paroxython/assess_costs.py:128: error: Missing positional argument "taxon" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ paroxython/assess_costs.py:128: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "TaxonName"; expected "LearningCostAssessor"  [arg-type]
+ paroxython/recommend_programs.py:296: error: Missing positional argument "taxon" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ paroxython/recommend_programs.py:296: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "TaxonName"; expected "LearningCostAssessor"  [arg-type]
+ paroxython/map_taxonomy.py:243: error: Missing positional argument "label_name" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ paroxython/map_taxonomy.py:243: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "LabelName"; expected "Taxonomy"  [arg-type]

pip (https://github.com/pypa/pip)
+ src/pip/_internal/models/link.py:245: error: Missing positional argument "url" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ src/pip/_internal/models/link.py:245: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "type[LinkHash]"  [arg-type]
+ src/pip/_internal/index/package_finder.py:890: error: Missing positional argument "project_name" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ src/pip/_internal/index/package_finder.py:890: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "PackageFinder"  [arg-type]
+ src/pip/_internal/index/package_finder.py:908: error: Missing positional argument "project_name" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ src/pip/_internal/index/package_finder.py:909: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str | None"; expected "PackageFinder"  [arg-type]
+ src/pip/_internal/self_outdated_check.py:183: error: Missing positional argument "project_name" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ src/pip/_internal/self_outdated_check.py:183: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "PackageFinder"  [arg-type]
+ src/pip/_internal/resolution/resolvelib/factory.py:297: error: Missing positional argument "self" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ src/pip/_internal/resolution/resolvelib/factory.py:668: error: Missing positional argument "project_name" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ src/pip/_internal/resolution/resolvelib/factory.py:668: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "NormalizedName"; expected "PackageFinder"  [arg-type]
+ src/pip/_internal/commands/list.py:239: error: Missing positional argument "project_name" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ src/pip/_internal/commands/list.py:239: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "NormalizedName"; expected "PackageFinder"  [arg-type]
+ src/pip/_internal/commands/index.py:119: error: Missing positional argument "project_name" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]

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

cloud-init (https://github.com/canonical/cloud-init)
+ cloudinit/distros/package_management/apt.py:139: error: Missing positional argument "self" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]

mkdocs (https://github.com/mkdocs/mkdocs)
+ mkdocs/livereload/__init__.py:281: error: Missing positional argument "url" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ mkdocs/config/config_options.py:1197: error: Missing positional argument "path" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]

manticore (https://github.com/trailofbits/manticore)
+ manticore/core/smtlib/solver.py:505: error: Signature of "can_be_true" incompatible with supertype "Solver"  [override]
+ manticore/core/smtlib/solver.py:505: note:      Superclass:
+ manticore/core/smtlib/solver.py:505: note:          def can_be_true(self, constraints: Any, expression: Any = ...) -> bool
+ manticore/core/smtlib/solver.py:505: note:      Subclass:
+ manticore/core/smtlib/solver.py:505: note:          _lru_cache_wrapper[[SMTLIBSolver, ConstraintSet, bool | Bool], bool]
+ manticore/core/smtlib/solver.py:605: error: Signature of "get_all_values" incompatible with supertype "Solver"  [override]
+ manticore/core/smtlib/solver.py:605: note:      Superclass:
+ manticore/core/smtlib/solver.py:605: note:          def get_all_values(self, constraints: Any, x: Any, maxcnt: Any = ..., silent: Any = ...) -> Any
+ manticore/core/smtlib/solver.py:605: note:      Subclass:
+ manticore/core/smtlib/solver.py:605: note:          _lru_cache_wrapper[[SMTLIBSolver, ConstraintSet, Any, int | None, bool], Any]

pandas (https://github.com/pandas-dev/pandas)
+ pandas/core/dtypes/cast.py:592: error: Unused "type: ignore" comment  [unused-ignore]
+ pandas/core/arrays/base.py:2318: error: Missing positional argument "is_numeric" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ pandas/core/arrays/base.py:2318: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "type[WrappedCythonOp]"  [arg-type]
+ pandas/core/arrays/base.py:2318: error: Argument 3 to "__call__" of "_lru_cache_wrapper" has incompatible type "dtype[object_]"; expected "str"  [arg-type]
+ pandas/core/arrays/base.py:2318: error: Argument 4 to "__call__" of "_lru_cache_wrapper" has incompatible type "bool"; expected "dtype[Any]"  [arg-type]
+ pandas/core/apply.py:993: error: Unused "type: ignore" comment  [unused-ignore]
+ pandas/core/groupby/ops.py:402: error: Missing positional argument "is_numeric" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ pandas/core/groupby/ops.py:402: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "type[WrappedCythonOp]"  [arg-type]
+ pandas/core/groupby/ops.py:402: error: Argument 4 to "__call__" of "_lru_cache_wrapper" has incompatible type "bool"; expected "dtype[Any]"  [arg-type]

mitmproxy (https://github.com/mitmproxy/mitmproxy)
+ mitmproxy/coretypes/serializable.py:83: error: Missing positional argument "cls" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ mitmproxy/coretypes/serializable.py:91: error: Missing positional argument "cls" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ mitmproxy/coretypes/serializable.py:99: error: Missing positional argument "cls" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ mitmproxy/proxy/mode_specs.py:165: error: Missing positional argument "spec" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ mitmproxy/connection.py:181: error: Missing positional argument "spec" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ mitmproxy/connection.py:181: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "type[Never]"  [arg-type]
+ mitmproxy/utils/asyncio_utils.py:62: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "Any | str"; expected "tuple[Any, ...] | None"  [arg-type]
+ mitmproxy/tools/console/common.py:811: error: Argument "error_message" to "__call__" of "_lru_cache_wrapper" has incompatible type "str | None"; expected "str"  [arg-type]
+ mitmproxy/tools/console/common.py:848: error: Incompatible types in assignment (expression has type "_lru_cache_wrapper[[NamedArg(RenderMode, 'render_mode'), NamedArg(bool, 'focused'), NamedArg(str, 'marked'), NamedArg(str | None, 'is_replay'), NamedArg(str, 'request_method'), NamedArg(str, 'request_scheme'), NamedArg(str, 'request_host'), NamedArg(str, 'request_path'), NamedArg(str, 'request_url'), NamedArg(str, 'request_http_version'), NamedArg(float, 'request_timestamp'), NamedArg(bool, 'request_is_push_promise'), NamedArg(bool, 'intercepted'), NamedArg(int | None, 'response_code'), NamedArg(str | None, 'response_reason'), NamedArg(int | None, 'response_content_length'), NamedArg(str | None, 'response_content_type'), NamedArg(float | None, 'duration'), NamedArg(str | None, 'error_message')], Any]", variable has type "_lru_cache_wrapper[[NamedArg(RenderMode, 'render_mode'), NamedArg(bool, 'focused'), NamedArg(str, 'marked'), NamedArg(bool, 'is_replay'), NamedArg(str, 'request_method'), NamedArg(str, 'request_scheme'), NamedArg(str, 'request_host'), NamedArg(str, 'request_path'), NamedArg(str, 'request_url'), NamedArg(str, 'request_http_version'), NamedArg(float, 'request_timestamp'), NamedArg(bool, 'request_is_push_promise'), NamedArg(bool, 'intercepted'), NamedArg(int | None, 'response_code'), NamedArg(str | None, 'response_reason'), NamedArg(int | None, 'response_content_length'), NamedArg(str | None, 'response_content_type'), NamedArg(float | None, 'duration'), NamedArg(str | None, 'error_message')], Any]")  [assignment]
+ mitmproxy/tools/console/common.py:853: error: Argument "is_replay" to "__call__" of "_lru_cache_wrapper" has incompatible type "str | None"; expected "bool"  [arg-type]
+ mitmproxy/command.py:286: error: Missing positional argument "cmdstr" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ mitmproxy/command.py:286: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "CommandManager"  [arg-type]
+ mitmproxy/test/tflow.py:134: error: Missing positional argument "spec" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ mitmproxy/test/tflow.py:134: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "type[Never]"  [arg-type]
+ mitmproxy/test/tflow.py:235: error: Missing positional argument "spec" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ mitmproxy/test/tflow.py:235: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "type[Never]"  [arg-type]
+ mitmproxy/proxy/server.py:564: error: Missing positional argument "spec" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ mitmproxy/proxy/server.py:564: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "type[Never]"  [arg-type]
+ mitmproxy/proxy/mode_servers.py:116: error: Missing positional argument "spec" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ mitmproxy/proxy/mode_servers.py:116: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "type[Never]"  [arg-type]
+ mitmproxy/addons/clientplayback.py:98: error: Missing positional argument "spec" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ mitmproxy/addons/proxyserver.py:104: error: Missing positional argument "spec" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ mitmproxy/addons/proxyserver.py:104: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "type[Never]"  [arg-type]
+ mitmproxy/addons/proxyserver.py:248: error: Missing positional argument "spec" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ mitmproxy/addons/proxyserver.py:288: error: Missing positional argument "spec" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ mitmproxy/master.py:135: error: Missing positional argument "spec" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ mitmproxy/tools/console/commander/commander.py:77: error: Missing positional argument "cmdstr" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ mitmproxy/tools/console/commander/commander.py:77: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "CommandManager"  [arg-type]
+ mitmproxy/tools/console/commander/commander.py:109: error: Missing positional argument "cmdstr" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ mitmproxy/tools/console/commander/commander.py:110: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "CommandManager"  [arg-type]
+ mitmproxy/tools/console/flowview.py:303: error: Missing positional argument "_" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ mitmproxy/tools/console/flowlist.py:78: error: Missing positional argument "pos" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ mitmproxy/tools/console/flowlist.py:81: error: Missing positional argument "pos" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ mitmproxy/tools/console/quickhelp.py:177: error: Missing positional argument "help" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ mitmproxy/tools/console/quickhelp.py:177: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "Keymap"  [arg-type]

pylint (https://github.com/pycqa/pylint)
+ pylint/checkers/utils.py:2258: error: "_lru_cache_wrapper" expects 2 type arguments, but 1 given  [type-arg]
+ pylint/checkers/utils.py:2258: error: Missing type parameters for generic type "_lru_cache_wrapper"  [type-arg]
+ pylint/message/message_definition_store.py:78: error: Missing positional argument "msgid_or_symbol" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ pylint/message/message_definition_store.py:78: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "MessageDefinitionStore"  [arg-type]
+ pylint/message/message_definition_store.py:87: error: Missing positional argument "msgid_or_symbol" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ pylint/message/message_definition_store.py:88: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "MessageDefinitionStore"  [arg-type]
+ pylint/lint/message_state_handler.py:123: error: Missing positional argument "msgid_or_symbol" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ pylint/lint/message_state_handler.py:123: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "MessageDefinitionStore"  [arg-type]
+ pylint/lint/message_state_handler.py:151: error: Missing positional argument "msgid_or_symbol" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ pylint/lint/message_state_handler.py:151: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "MessageDefinitionStore"  [arg-type]
+ pylint/lint/pylinter.py:1264: error: Missing positional argument "msgid_or_symbol" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ pylint/lint/pylinter.py:1264: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "MessageDefinitionStore"  [arg-type]
+ pylint/lint/pylinter.py:1291: error: Missing positional argument "msgid_or_symbol" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ pylint/lint/pylinter.py:1291: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "MessageDefinitionStore"  [arg-type]
+ pylint/checkers/format.py:446: error: Missing positional argument "msgid_or_symbol" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ pylint/checkers/format.py:447: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "MessageDefinitionStore"  [arg-type]

rich (https://github.com/Textualize/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:147: error: Missing positional argument "color" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ rich/style.py:147: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "type[Color]"  [arg-type]
+ rich/style.py:368: error: Missing positional argument "system" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ rich/style.py:368: error: Missing positional argument "self" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ rich/style.py:368: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "ColorSystem"; expected "Color"  [arg-type]
+ rich/style.py:371: error: Missing positional argument "system" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ rich/style.py:371: error: Missing positional argument "self" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ rich/style.py:371: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "ColorSystem"; expected "Color"  [arg-type]
+ rich/style.py:391: error: Missing positional argument "style_definition" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ rich/style.py:391: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "type[Style]"  [arg-type]
+ rich/style.py:527: error: Missing positional argument "color" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ rich/style.py:527: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "type[Color]"  [arg-type]
+ rich/style.py:554: error: Missing positional argument "color" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ rich/style.py:554: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "type[Color]"  [arg-type]
+ rich/style.py:758: error: Missing positional argument "style" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ rich/style.py:758: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "Style | None"; expected "Style"  [arg-type]
+ rich/segment.py:168: error: Missing positional argument "cut" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ rich/segment.py:168: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "Segment"; expected "type[Segment]"  [arg-type]
+ rich/segment.py:168: error: Argument 2 to "__call__" of "_lru_cache_wrapper" has incompatible type "int"; expected "Segment"  [arg-type]
+ rich/markup.py:163: error: Missing positional argument "style" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ rich/markup.py:163: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "type[Style]"  [arg-type]
+ rich/markup.py:220: error: Missing positional argument "style" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ rich/markup.py:220: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "type[Style]"  [arg-type]
+ rich/jupyter.py:72: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "TerminalTheme"; expected "Style"  [arg-type]
+ rich/console.py:1477: error: Missing positional argument "style_definition" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ rich/console.py:1477: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "type[Style]"  [arg-type]
+ rich/console.py:2211: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "TerminalTheme"; expected "Style"  [arg-type]
+ rich/console.py:2223: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "TerminalTheme"; expected "Style"  [arg-type]
+ rich/color.py:552: error: Missing positional argument "color" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ rich/color.py:552: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "ColorTriplet"; expected "Palette"  [arg-type]
+ rich/color.py:565: error: Missing positional argument "color" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ rich/color.py:565: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "ColorTriplet"; expected "Palette"  [arg-type]
+ rich/ansi.py:175: error: Missing positional argument "style_definition" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ rich/ansi.py:175: error: Argument 1 to "__call__" of "_lru_cache_wrapper" 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"  [call-arg]
+ rich/progress_bar.py:145: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "Style"; expected "ProgressBar"  [arg-type]
+ rich/progress_bar.py:145: error: Argument 3 to "__call__" of "_lru_cache_wrapper" has incompatible type "str | None"; expected "Style"  [arg-type]
+ rich/progress_bar.py:145: error: Argument 4 to "__call__" of "_lru_cache_wrapper" has incompatible type "bool"; expected "str"  [arg-type]

mypy (https://github.com/python/mypy)
+ mypy/find_sources.py:160: error: Missing positional argument "dir" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ mypy/find_sources.py:160: note: See https://mypy.rtfd.io/en/stable/_refs.html#code-call-arg for more info
+ mypy/find_sources.py:160: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "SourceFinder"  [arg-type]
+ mypy/find_sources.py:202: error: Missing positional argument "dir" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ mypy/find_sources.py:202: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "SourceFinder"  [arg-type]
- mypy/test/helpers.py:44: note: See https://mypy.rtfd.io/en/stable/_refs.html#code-call-arg for more info

optuna (https://github.com/optuna/optuna)
+ optuna/importance/_fanova/_tree.py:105: error: Missing positional argument "node_index" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ optuna/importance/_fanova/_tree.py:105: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "int"; expected "_FanovaTree"  [arg-type]
+ optuna/importance/_fanova/_tree.py:110: error: Missing positional argument "node_index" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ optuna/importance/_fanova/_tree.py:110: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "int"; expected "_FanovaTree"  [arg-type]
+ optuna/importance/_fanova/_tree.py:111: error: Missing positional argument "node_index" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ optuna/importance/_fanova/_tree.py:111: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "int"; expected "_FanovaTree"  [arg-type]
+ optuna/importance/_fanova/_tree.py:116: error: Missing positional argument "node_index" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ optuna/importance/_fanova/_tree.py:116: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "int"; expected "_FanovaTree"  [arg-type]
+ optuna/importance/_fanova/_tree.py:128: error: Missing positional argument "node_index" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ optuna/importance/_fanova/_tree.py:128: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "int"; expected "_FanovaTree"  [arg-type]
+ optuna/importance/_fanova/_tree.py:161: error: Missing positional argument "node_index" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ optuna/importance/_fanova/_tree.py:161: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "int"; expected "_FanovaTree"  [arg-type]
+ optuna/importance/_fanova/_tree.py:162: error: Missing positional argument "node_index" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ optuna/importance/_fanova/_tree.py:162: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "int"; expected "_FanovaTree"  [arg-type]
+ optuna/importance/_fanova/_tree.py:167: error: Missing positional argument "node_index" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ optuna/importance/_fanova/_tree.py:167: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "int"; expected "_FanovaTree"  [arg-type]
+ optuna/importance/_fanova/_tree.py:175: error: Missing positional argument "node_index" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ optuna/importance/_fanova/_tree.py:175: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "int"; expected "_FanovaTree"  [arg-type]
+ optuna/importance/_fanova/_tree.py:178: error: Missing positional argument "node_index" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ optuna/importance/_fanova/_tree.py:178: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "int"; expected "_FanovaTree"  [arg-type]
+ optuna/importance/_fanova/_tree.py:214: error: Missing positional argument "node_index" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ optuna/importance/_fanova/_tree.py:214: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "int"; expected "_FanovaTree"  [arg-type]
+ optuna/importance/_fanova/_tree.py:216: error: Missing positional argument "node_index" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ optuna/importance/_fanova/_tree.py:216: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "int"; expected "_FanovaTree"  [arg-type]
+ optuna/importance/_fanova/_tree.py:232: error: Missing positional argument "node_index" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ optuna/importance/_fanova/_tree.py:232: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "int"; expected "_FanovaTree"  [arg-type]
+ optuna/importance/_fanova/_tree.py:235: error: Missing positional argument "node_index" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ optuna/importance/_fanova/_tree.py:235: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "int"; expected "_FanovaTree"  [arg-type]
+ optuna/importance/_fanova/_tree.py:264: error: Missing positional argument "node_index" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ optuna/importance/_fanova/_tree.py:264: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "int"; expected "_FanovaTree"  [arg-type]
+ optuna/importance/_fanova/_tree.py:286: error: Missing positional argument "node_index" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ optuna/importance/_fanova/_tree.py:286: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "int"; expected "_FanovaTree"  [arg-type]
+ optuna/importance/_fanova/_tree.py:287: error: Missing positional argument "node_index" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ optuna/importance/_fanova/_tree.py:287: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "int"; expected "_FanovaTree"  [arg-type]
+ optuna/importance/_fanova/_tree.py:296: error: Missing positional argument "node_index" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ optuna/importance/_fanova/_tree.py:296: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "int"; expected "_FanovaTree"  [arg-type]
+ optuna/importance/_fanova/_tree.py:297: error: Missing positional argument "node_index" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ optuna/importance/_fanova/_tree.py:297: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "int"; expected "_FanovaTree"  [arg-type]
+ tests/importance_tests/fanova_tests/test_tree.py:219: error: Missing positional argument "node_index" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ tests/importance_tests/fanova_tests/test_tree.py:219: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "int"; expected "_FanovaTree"  [arg-type]
+ tests/importance_tests/fanova_tests/test_tree.py:220: error: Missing positional argument "node_index" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ tests/importance_tests/fanova_tests/test_tree.py:220: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "int"; expected "_FanovaTree"  [arg-type]
+ tests/importance_tests/fanova_tests/test_tree.py:221: error: Missing positional argument "node_index" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ tests/importance_tests/fanova_tests/test_tree.py:221: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "int"; expected "_FanovaTree"  [arg-type]
+ tests/importance_tests/fanova_tests/test_tree.py:222: error: Missing positional argument "node_index" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ tests/importance_tests/fanova_tests/test_tree.py:222: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "int"; expected "_FanovaTree"  [arg-type]
+ tests/importance_tests/fanova_tests/test_tree.py:223: error: Missing positional argument "node_index" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ tests/importance_tests/fanova_tests/test_tree.py:223: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "int"; expected "_FanovaTree"  [arg-type]
+ tests/importance_tests/fanova_tests/test_tree.py:225: error: Missing positional argument "node_index" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ tests/importance_tests/fanova_tests/test_tree.py:225: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "int"; expected "_FanovaTree"  [arg-type]
+ tests/importance_tests/fanova_tests/test_tree.py:226: error: Missing positional argument "node_index" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ tests/importance_tests/fanova_tests/test_tree.py:226: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "int"; expected "_FanovaTree"  [arg-type]
+ tests/importance_tests/fanova_tests/test_tree.py:227: error: Missing positional argument "node_index" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ tests/importance_tests/fanova_tests/test_tree.py:227: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "int"; expected "_FanovaTree"  [arg-type]
+ tests/importance_tests/fanova_tests/test_tree.py:228: error: Missing positional argument "node_index" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ tests/importance_tests/fanova_tests/test_tree.py:228: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "int"; expected "_FanovaTree"  [arg-type]
+ tests/importance_tests/fanova_tests/test_tree.py:229: error: Missing positional argument "node_index" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ tests/importance_tests/fanova_tests/test_tree.py:229: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "int"; expected "_FanovaTree"  [arg-type]
+ tests/importance_tests/fanova_tests/test_tree.py:231: error: Missing positional argument "node_index" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ tests/importance_tests/fanova_tests/test_tree.py:231: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "int"; expected "_FanovaTree"  [arg-type]
+ tests/importance_tests/fanova_tests/test_tree.py:232: error: Missing positional argument "node_index" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ tests/importance_tests/fanova_tests/test_tree.py:232: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "int"; expected "_FanovaTree"  [arg-type]
+ tests/importance_tests/fanova_tests/test_tree.py:233: error: Missing positional argument "node_index" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ tests/importance_tests/fanova_tests/test_tree.py:233: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "int"; expected "_FanovaTree"  [arg-type]
+ tests/importance_tests/fanova_tests/test_tree.py:234: error: Missing positional argument "node_index" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ tests/importance_tests/fanova_tests/test_tree.py:234: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "int"; expected "_FanovaTree"  [arg-type]
+ tests/importance_tests/fanova_tests/test_tree.py:235: error: Missing positional argument "node_index" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ tests/importance_tests/fanova_tests/test_tree.py:235: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "int"; expected "_FanovaTree"  [arg-type]
+ tests/importance_tests/fanova_tests/test_tree.py:237: error: Missing positional argument "node_index" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ tests/importance_tests/fanova_tests/test_tree.py:237: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "int"; expected "_FanovaTree"  [arg-type]
+ tests/importance_tests/fanova_tests/test_tree.py:238: error: Missing positional argument "node_index" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ tests/importance_tests/fanova_tests/test_tree.py:238: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "int"; expected "_FanovaTree"  [arg-type]
+ tests/importance_tests/fanova_tests/test_tree.py:239: error: Missing positional argument "node_index" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ tests/importance_tests/fanova_tests/test_tree.py:239: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "int"; expected "_FanovaTree"  [arg-type]
+ tests/importance_tests/fanova_tests/test_tree.py:240: error: Missing positional argument "node_index" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ tests/importance_tests/fanova_tests/test_tree.py:240: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "int"; expected "_FanovaTree"  [arg-type]
+ tests/importance_tests/fanova_tests/test_tree.py:241: error: Missing positional argument "node_index" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ tests/importance_tests/fanova_tests/test_tree.py:241: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "int"; expected "_FanovaTree"  [arg-type]
+ tests/importance_tests/fanova_tests/test_tree.py:243: error: Missing positional argument "node_index" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ tests/importance_tests/fanova_tests/test_tree.py:243: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "int"; expected "_FanovaTree"  [arg-type]
+ tests/importance_tests/fanova_tests/test_tree.py:244: error: Missing positional argument "node_index" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ tests/importance_tests/fanova_tests/test_tree.py:244: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "int"; expected "_FanovaTree"  [arg-type]
+ tests/importance_tests/fanova_tests/test_tree.py:245: error: Missing positional argument "node_index" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ tests/importance_tests/fanova_tests/test_tree.py:245: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "int"; expected "_FanovaTree"  [arg-type]
+ tests/importance_tests/fanova_tests/test_tree.py:246: error: Missing positional argument "node_index" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ tests/importance_tests/fanova_tests/test_tree.py:246: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "int"; expected "_FanovaTree"  [arg-type]
+ tests/importance_tests/fanova_tests/test_tree.py:247: error: Missing positional argument "node_index" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ tests/importance_tests/fanova_tests/test_tree.py:247: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "int"; expected "_FanovaTree"  [arg-type]
+ tests/importance_tests/fanova_tests/test_tree.py:249: error: Missing positional argument "node_index" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ tests/importance_tests/fanova_tests/test_tree.py:249: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "int"; expected "_FanovaTree"  [arg-type]
+ tests/importance_tests/fanova_tests/test_tree.py:250: error: Missing positional argument "node_index" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ tests/importance_tests/fanova_tests/test_tree.py:250: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "int"; expected "_FanovaTree"  [arg-type]
+ tests/importance_tests/fanova_tests/test_tree.py:251: error: Missing positional argument "node_index" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ tests/importance_tests/fanova_tests/test_tree.py:251: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "int"; expected "_FanovaTree"  [arg-type]
+ tests/importance_tests/fanova_tests/test_tree.py:252: error: Missing positional argument "node_index" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ tests/importance_tests/fanova_tests/test_tree.py:252: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "int"; expected "_FanovaTree"  [arg-type]
+ tests/importance_tests/fanova_tests/test_tree.py:253: error: Missing positional argument "node_index" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ tests/importance_tests/fanova_tests/test_tree.py:253: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "int"; expected "_FanovaTree"  [arg-type]
+ tests/importance_tests/fanova_tests/test_tree.py:255: error: Missing positional argument "node_index" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ tests/importance_tests/fanova_tests/test_tree.py:255: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "int"; expected "_FanovaTree"  [arg-type]
+ tests/importance_tests/fanova_tests/test_tree.py:256: error: Missing positional argument "node_index" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ tests/importance_tests/fanova_tests/test_tree.py:256: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "int"; expected "_FanovaTree"  [arg-type]

dacite (https://github.com/konradhalas/dacite)
+ dacite/core.py:51: error: Argument "localns" to "get_type_hints" has incompatible type "FrozenDict | None"; expected "dict[str, Any] | None"  [arg-type]

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

mkosi (https://github.com/systemd/mkosi)
+ mkosi/user.py:27:16: error: Missing positional argument "cls" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ mkosi/user.py:28:16: error: Missing positional argument "cls" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ mkosi/user.py:29:24: error: Missing positional argument "cls" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ mkosi/user.py:50:21: error: Missing positional argument "cls" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ mkosi/user.py:55:32: error: Missing positional argument "cls" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ mkosi/user.py:65:67: error: Missing positional argument "cls" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ mkosi/user.py:66:21: error: Missing positional argument "cls" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ mkosi/sandbox.py:179:77: error: Missing positional argument "cls" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ mkosi/sandbox.py:233:20: error: Missing positional argument "cls" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ mkosi/sandbox.py:236:35: error: Missing positional argument "cls" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ mkosi/config.py:481:20: error: Missing positional argument "cls" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ mkosi/__init__.py:501:22: error: Missing positional argument "cls" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ mkosi/__init__.py:1548:20: error: Missing positional argument "cls" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ mkosi/__init__.py:1549:20: error: Missing positional argument "cls" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ mkosi/__init__.py:1556:25: error: Missing positional argument "cls" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ mkosi/__init__.py:2501:61: error: Missing positional argument "cls" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ mkosi/__init__.py:3941:28: error: Missing positional argument "cls" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ mkosi/__init__.py:4125:22: error: Missing positional argument "cls" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]

psycopg (https://github.com/psycopg/psycopg)
+ psycopg/psycopg/rows.py:141: error: Argument 2 to "__call__" of "_lru_cache_wrapper" has incompatible type "*Generator[bytes | None, None, None]"; expected "bytes"  [arg-type]

core (https://github.com/home-assistant/core)
+ homeassistant/util/unit_conversion.py:78: error: Missing positional argument "to_unit" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ homeassistant/util/unit_conversion.py:78: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str | None"; expected "type[BaseUnitConverter]"  [arg-type]
+ homeassistant/util/unit_conversion.py:355: error: Signature of "converter_factory" incompatible with supertype "BaseUnitConverter"  [override]
+ homeassistant/util/unit_conversion.py:355: note:      Superclass:
+ homeassistant/util/unit_conversion.py:355: note:          _lru_cache_wrapper[[type[BaseUnitConverter], str | None, str | None], Callable[[float], float]]
+ homeassistant/util/unit_conversion.py:355: note:      Subclass:
+ homeassistant/util/unit_conversion.py:355: note:          _lru_cache_wrapper[[type[SpeedConverter], str | None, str | None], Callable[[float], float]]
+ homeassistant/util/unit_conversion.py:369: error: Signature of "converter_factory_allow_none" incompatible with supertype "BaseUnitConverter"  [override]
+ homeassistant/util/unit_conversion.py:369: note:      Superclass:
+ homeassistant/util/unit_conversion.py:369: note:          _lru_cache_wrapper[[type[BaseUnitConverter], str | None, str | None], Callable[[float | None], float | None]]
+ homeassistant/util/unit_conversion.py:369: note:      Subclass:
+ homeassistant/util/unit_conversion.py:369: note:          _lru_cache_wrapper[[type[SpeedConverter], str | None, str | None], Callable[[float | None], float | None]]
+ homeassistant/util/unit_conversion.py:436: error: Signature of "converter_factory" incompatible with supertype "BaseUnitConverter"  [override]
+ homeassistant/util/unit_conversion.py:436: note:      Superclass:
+ homeassistant/util/unit_conversion.py:436: note:          _lru_cache_wrapper[[type[BaseUnitConverter], str | None, str | None], Callable[[float], float]]
+ homeassistant/util/unit_conversion.py:436: note:      Subclass:
+ homeassistant/util/unit_conversion.py:436: note:          _lru_cache_wrapper[[type[TemperatureConverter], str | None, str | None], Callable[[float], float]]
+ homeassistant/util/unit_conversion.py:450: error: Signature of "converter_factory_allow_none" incompatible with supertype "BaseUnitConverter"  [override]
+ homeassistant/util/unit_conversion.py:450: note:      Superclass:
+ homeassistant/util/unit_conversion.py:450: note:          _lru_cache_wrapper[[type[BaseUnitConverter], str | None, str | None], Callable[[float | None], float | None]]
+ homeassistant/util/unit_conversion.py:450: note:      Subclass:
+ homeassistant/util/unit_conversion.py:450: note:          _lru_cache_wrapper[[type[TemperatureConverter], str | None, str | None], Callable[[float | None], float | None]]
+ homeassistant/util/unit_conversion.py:516: error: Missing positional argument "to_unit" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ homeassistant/util/unit_conversion.py:516: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "type[BaseUnitConverter]"  [arg-type]
+ homeassistant/helpers/temperature.py:28: error: Missing positional argument "to_unit" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ homeassistant/helpers/temperature.py:28: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "type[TemperatureConverter]"  [arg-type]
+ homeassistant/components/recorder/statistics.py:263: error: Missing positional argument "cls" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ homeassistant/components/recorder/statistics.py:278: error: Missing positional argument "cls" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ homeassistant/components/recorder/statistics.py:289: error: Missing positional argument "cls" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ homeassistant/components/sensor/__init__.py:693: error: Missing positional argument "to_unit" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ homeassistant/components/sensor/__init__.py:694: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str | None"; expected "type[BaseUnitConverter]"  [arg-type]
+ homeassistant/components/sensor/__init__.py:715: error: Missing positional argument "to_unit" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ homeassistant/components/sensor/__init__.py:716: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str | None"; expected "type[BaseUnitConverter]"  [arg-type]
+ homeassistant/components/sensor/__init__.py:785: error: Missing positional argument "to_unit" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ homeassistant/components/sensor/__init__.py:786: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str | None"; expected "type[BaseUnitConverter]"  [arg-type]
+ homeassistant/components/number/__init__.py:437: error: Missing positional argument "to_unit" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ homeassistant/components/number/__init__.py:438: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "type[BaseUnitConverter]"  [arg-type]
+ homeassistant/components/number/__init__.py:461: error: Missing positional argument "to_unit" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ homeassistant/components/number/__init__.py:462: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "type[BaseUnitConverter]"  [arg-type]
+ homeassistant/components/hassio/ingress.py:130: error: Missing positional argument "path" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ homeassistant/components/hassio/ingress.py:130: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "HassIOIngress"  [arg-type]
+ homeassistant/components/hassio/ingress.py:160: error: Missing positional argument "path" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ homeassistant/components/hassio/ingress.py:160: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "HassIOIngress"  [arg-type]
+ homeassistant/components/prometheus/__init__.py:647: error: Missing positional argument "entity_id" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ homeassistant/components/prometheus/__init__.py:647: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "EntityValues"  [arg-type]
+ homeassistant/components/nest/camera.py:195: error: Argument 1 to "async_add_executor_job" of "HomeAssistant" has incompatible type "_lru_cache_wrapper[[type[NestCamera]], bytes]"; expected "Callable[[], bytes | None]"  [arg-type]
+ homeassistant/components/nest/camera.py:195: note: "_lru_cache_wrapper[[type[NestCamera]], bytes].__call__" has type "Callable[[Arg(type[NestCamera], 'cls')], bytes]"
+ homeassistant/components/influxdb/__init__.py:243: error: Missing positional argument "entity_id" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ homeassistant/components/influxdb/__init__.py:243: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "EntityValues"  [arg-type]
+ homeassistant/components/emulated_hue/hue_api.py:890: error: Missing positional argument "entity_id" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ homeassistant/components/emulated_hue/hue_api.py:890: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "Config"  [arg-type]
+ homeassistant/components/emulated_hue/hue_api.py:891: error: Missing positional argument "self" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ homeassistant/components/mqtt/client.py:660: error: Missing positional argument "topic" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ homeassistant/components/mqtt/client.py:660: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "MQTT"  [arg-type]
+ homeassistant/components/mqtt/client.py:837: error: Missing positional argument "topic" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ homeassistant/components/mqtt/client.py:837: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str"; expected "MQTT"  [arg-type]
+ homeassistant/components/sensor/recorder.py:260: error: Missing positional argument "to_unit" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ homeassistant/components/sensor/recorder.py:260: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "Any | None"; expected "type[BaseUnitConverter]"  [arg-type]
+ homeassistant/components/mqtt_room/sensor.py:196: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "Any | None"; expected "str"  [arg-type]
+ homeassistant/components/esphome/light.py:194: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "tuple[int, ...]"; expected "list[int]"  [arg-type]
+ homeassistant/components/esphome/light.py:203: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "tuple[int, ...]"; expected "list[int]"  [arg-type]
+ homeassistant/components/esphome/light.py:214: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "tuple[int, ...]"; expected "list[int]"  [arg-type]
+ homeassistant/components/esphome/light.py:223: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "tuple[int, ...]"; expected "list[int]"  [arg-type]
+ homeassistant/components/esphome/light.py:224: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "tuple[int, ...]"; expected "list[int]"  [arg-type]
+ homeassistant/components/esphome/light.py:229: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "tuple[int, ...]"; expected "list[int]"  [arg-type]
+ homeassistant/components/esphome/light.py:241: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "tuple[int, ...]"; expected "list[int]"  [arg-type]
+ homeassistant/components/esphome/light.py:258: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "tuple[int, ...]"; expected "list[int]"  [arg-type]
+ homeassistant/components/esphome/light.py:263: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "tuple[int, ...]"; expected "list[int]"  [arg-type]
+ homeassistant/components/esphome/light.py:277: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "tuple[int, ...]"; expected "list[int]"  [arg-type]
+ homeassistant/components/esphome/light.py:358: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "tuple[int, ...]"; expected "list[int]"  [arg-type]

ibis (https://github.com/ibis-project/ibis)
+ ibis/backends/polars/__init__.py:390: error: Missing positional argument "cls" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ ibis/backends/pandas/__init__.py:276: error: Missing positional argument "cls" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ ibis/backends/tests/test_temporal.py:2390: error: Argument "exclude" to "__call__" of "_lru_cache_wrapper" has incompatible type "tuple[str, str, str, str]"; expected "tuple[str]"  [arg-type]
+ ibis/backends/tests/test_temporal.py:2408: error: Argument "exclude" to "__call__" of "_lru_cache_wrapper" has incompatible type "tuple[str, str, str, str, str, str, str, str]"; expected "tuple[str]"  [arg-type]
+ ibis/backends/tests/test_dot_sql.py:241: error: Argument "exclude" to "__call__" of "_lru_cache_wrapper" has incompatible type "tuple[str, str]"; expected "tuple[str]"  [arg-type]

jinja (https://github.com/pallets/jinja)
+ src/jinja2/environment.py:1186: error: Unused "type: ignore" comment  [unused-ignore]
+ src/jinja2/environment.py:1201: error: Unused "type: ignore" comment  [unused-ignore]

jax (https://github.com/google/jax)
+ jax/experimental/export/_shape_poly.py:1767: error: Missing positional argument "e" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ jax/experimental/export/_shape_poly.py:1767: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "_DimExpr | int"; expected "CachingShapeEvaluator"  [arg-type]
+ jax/experimental/export/_shape_poly.py:1789: error: Missing positional argument "e" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ jax/experimental/export/_shape_poly.py:1789: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "_DimExpr | int"; expected "CachingShapeEvaluator"  [arg-type]
+ jax/experimental/export/_shape_poly.py:1841: error: Missing positional argument "e" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ jax/experimental/export/_shape_poly.py:1841: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "_DimExpr | int"; expected "CachingShapeEvaluator"  [arg-type]
+ jax/experimental/export/_shape_poly.py:2015: error: Missing positional argument "e" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]
+ jax/experimental/export/_export.py:1122: error: Missing positional argument "e" in call to "__call__" of "_lru_cache_wrapper"  [call-arg]

mongo-python-driver (https://github.com/mongodb/mongo-python-driver)
+ bson/datetime_ms.py:141: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "tzinfo"; expected "timezone"  [arg-type]
+ bson/datetime_ms.py:143: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "tzinfo"; expected "timezone"  [arg-type]

@JelleZijlstra
Copy link
Member

From the mypy-primer hit on mypy, seems like this still doesn't work properly for methods: https://github.com/python/mypy/blob/99f4b8138467c9a77003369b01242c202a6599c0/mypy/find_sources.py#L162

@AlexWaygood
Copy link
Member

AlexWaygood commented Mar 26, 2024

FWIW, I still think #7771 was the most viable version of the many attempts we've had to fix this, and I'd be interested in seeing a retry of that.

It was (not unreasonably) closed after it had been open for a long time without review. But the primer report wasn't actually too bad at all.

@AlexWaygood AlexWaygood linked an issue Mar 26, 2024 that may be closed by this pull request
@cdce8p
Copy link
Contributor Author

cdce8p commented Mar 26, 2024

I looked just at #7771. Tbh I'm not sure that fix the issue, at least I wasn't able to get it working. AFAICT the issue might be more fundamental. Let's consider this example for a moment.

from typing import Generic, Callable, ParamSpec

_P = ParamSpec("_P")

class Wrapper(Generic[_P]):
    def __call__(self, *args: _P.args, **kwargs: _P.kwargs) -> None: ...

def decorator(func: Callable[_P, None]) -> Callable[_P, None]: ...
def lru_cache(func: Callable[_P, None]) -> Wrapper[_P]: ...


class A:
    @decorator
    def method1(self, val: int) -> None: ...

    @lru_cache
    def method2(self, val: str) -> None: ...

    def other(self) -> None:
        reveal_type(self.method1)
        reveal_type(self.method2)
        reveal_type(A.method1)
        reveal_type(A.method2)
        self.method1(2)
        self.method2("Hello")

Both decorator and lru_cache should pass on the arguments and yet for decorator all type checkers know that an instance of A will be passed with the call to self.method1. However, for self.method2 that doesn't seem to be the case.

The mypy output

Revealed type is "def (val: builtins.int)"
Revealed type is "test.Wrapper[[self: test.A, val: builtins.str]]"
Revealed type is "def (self: test9.A, val: builtins.int)"
Revealed type is "test.Wrapper[[self: test.A, val: builtins.str]]"

# and the error for `self.method2("Hello")
error: Missing positional argument "val" in call to "__call__" of "Wrapper"  [call-arg]
error: Argument 1 to "__call__" of "Wrapper" has incompatible type "str"; expected "A"  [arg-type]

Pyright looks similar.

--
I would assume that reveal.type(self.method2) should be Wrapper[[val: str]] instead. Am I missing something here?
Only reveal_type(A.method2) should be Wrapper[[self: A, val: str]].

@AlexWaygood
Copy link
Member

AlexWaygood commented Mar 26, 2024

Yes, I think the fundamental issue is that it was never really fully specc'd out how ParamSpec should interact with methods: python/typing#946

@Viicos
Copy link
Contributor

Viicos commented Mar 27, 2024

I think #7771 was missing some overloads for __get__. I've played a bit and here is what I came with:

Code sample in pyright playground

Show code
from typing import TypeVar, ParamSpec, Generic, Callable, Concatenate, Self, overload

_P = ParamSpec("_P")
_S = TypeVar("_S")
_R = TypeVar("_R")


class _lru_cache_wrapper_0(Generic[_P, _R]):
    __wrapped__: Callable[_P, _R]

    def __call__(self, *args: _P.args, **kwargs: _P.kwargs) -> _R: ...

    def cache_clear(self) -> None: ...


class _lru_cache_wrapper(Generic[_S, _P, _R]):
    __wrapped__: Callable[Concatenate[_S, _P], _R]

    __call__: Callable[Concatenate[_S, _P], _R]
    # Or as a method (however, the _self parameter can't be named self):
    # def __call__(self, _self: _S, *args: _P.args, **kwargs: _P.kwargs) -> _R: ...

    @overload
    def __get__(self, instance: _S, owner: type | None = ..., /) -> _lru_cache_wrapper_0[_P, _R]: ...

    @overload
    def __get__(self, instance: None, owner: type | None = ..., /) -> Self: ...

    def cache_clear(self) -> None: ...


@overload
def cache(user_function: Callable[Concatenate[_S, _P], _R], /) -> _lru_cache_wrapper[_S, _P, _R]: ...

@overload
def cache(user_function: Callable[_P, _R], /) -> _lru_cache_wrapper_0[_P, _R]: ...


class A:

    @cache
    def some_meth(self, a: int) -> int: ...


@cache
def some_func(a: int) -> int: ...


reveal_type(A.some_meth.__call__)
reveal_type(A().some_meth.__call__)

reveal_type(some_func)  # _lru_cache_wrapper[int, (), int], so it matches the first `cache` overload :/
reveal_type(some_func.__call__)  # def __call__(int) -> int, so still ok?
# ... seems to be, as `__get__` is not relevant for functions. So it uses the __call__ defined on `_lru_cache_wrapper`

I was a bit worried about the cache overloads, as they overlap in some way and the first one is used even for functions (without a self argument). However, this doesn't seem to be an issue, as described by my comment in the end.

@strangemonad
Copy link

Something like this would be great to land. It seems it would directly address at least this current issue I'm facing with pyright microsoft/pyright#7594. There's also been at least these other pyright issues microsoft/pyright#6668, microsoft/pyright#2133, and microsoft/pyright#2578

There seems to be a handful of similarly related typeshed issues (#2569, #4638, #4849, #6347, #6987, . Is there a canonical parent issue that might be helpful to reference for both this PR #11662 and #7771? Issue #6347 possibly seems like the most relevant but is still specifically focuses on deciding if the functools._lru_cache_wrapper should be a Callable and there seems to be a broader discussion along the lines of "what to do to make cache-style decorators work."

As far as test cases #11662 (review) here's at least one that I'm hoping will work (there are certainly more to elaborate)

import typing
from functools import lru_cache
from typing import Any, Generic, TypeVar

T = TypeVar("T")

class Store(Generic[T]):
    def __init__(self, entity_cls: type[T], db_session: Any):
        super().__init__()
        self._entity_cls = entity_cls
        self._db_session = db_session

    def get(self, pkey: str) -> T:
        ...

    def create(self, value: T) -> T:
        ...


class DB:
    def __init__(self, db_session: Any):
        super().__init__()
        self._db_session = db_session

    def store_of(self, entity_cls: type[T]) -> Store[T]:
        return Store(entity_cls=entity_cls, db_session=self._db_session)

    @my_decorator
    def my_decorated_store_of(self, entity_cls: type[T]) -> Store[T]:
        return Store(entity_cls=entity_cls, db_session=self._db_session)

    @lru_cache
    def cached_store_of(self, entity_cls: type[T]) -> Store[T]:
        return Store(entity_cls=entity_cls, db_session=self._db_session)


class Account:
    ...


typing.reveal_type(DB(db_session="connection").store_of(entity_cls=Account))
account_store_1: Store[Account] = DB(db_session="connection").store_of(
    entity_cls=Account,
)

typing.reveal_type(DB(db_session="connection").my_decorated_store_of(entity_cls=Account))
account_store_2: Store[Account] = DB(db_session="connection").my_decorated_store_of(
    entity_cls=Account,
)

typing.reveal_type(DB(db_session="connection").cached_store_of(entity_cls=Account))
account_store_3: Store[Account] = DB(db_session="connection").cached_store_of(
    entity_cls=Account,
)

@JelleZijlstra
Copy link
Member

Unfortunately the mypy-primer hits indicate this is still probably not mergeable. I agree it would be great to land a version of this, but it may require significant work.

If someone wants to work towards getting this issue fixed, they should be prepared to implement and champion a change to the typing spec and/or changes to ParamSpec support in mypy or other type checkers.

@cdce8p
Copy link
Contributor Author

cdce8p commented Apr 14, 2024

If someone wants to work towards getting this issue fixed, they should be prepared to implement and champion a change to the typing spec and/or changes to ParamSpec support in mypy or other type checkers.

Opened a discussion thread here: https://discuss.python.org/t/allow-self-binding-for-generic-paramspec/50948
And created a reference implementation for mypy: python/mypy#17123

@srittau srittau added the status: deferred Issue or PR deferred until some precondition is fixed label Apr 14, 2024
@srittau
Copy link
Collaborator

srittau commented Apr 14, 2024

Thanks for opening the discussion! I've marked this PR as "deferred" for now.

@cdce8p
Copy link
Contributor Author

cdce8p commented Apr 14, 2024

And created a reference implementation for mypy: python/mypy#17123

With the mypy change applied, the primer diff would look like this

mitmproxy (https://github.com/mitmproxy/mitmproxy)
+ mitmproxy/utils/asyncio_utils.py:62: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "Any | str"; expected "tuple[Any, ...] | None"  [arg-type]
+ mitmproxy/tools/console/common.py:811: error: Argument "error_message" to "__call__" of "_lru_cache_wrapper" has incompatible type "str | None"; expected "str"  [arg-type]
+ mitmproxy/tools/console/common.py:848: error: Incompatible types in assignment (expression has type "_lru_cache_wrapper[[NamedArg(RenderMode, 'render_mode'), NamedArg(bool, 'focused'), NamedArg(str, 'marked'), NamedArg(str | None, 'is_replay'), NamedArg(str, 'request_method'), NamedArg(str, 'request_scheme'), NamedArg(str, 'request_host'), NamedArg(str, 'request_path'), NamedArg(str, 'request_url'), NamedArg(str, 'request_http_version'), NamedArg(float, 'request_timestamp'), NamedArg(bool, 'request_is_push_promise'), NamedArg(bool, 'intercepted'), NamedArg(int | None, 'response_code'), NamedArg(str | None, 'response_reason'), NamedArg(int | None, 'response_content_length'), NamedArg(str | None, 'response_content_type'), NamedArg(float | None, 'duration'), NamedArg(str | None, 'error_message')], Any]", variable has type "_lru_cache_wrapper[[NamedArg(RenderMode, 'render_mode'), NamedArg(bool, 'focused'), NamedArg(str, 'marked'), NamedArg(bool, 'is_replay'), NamedArg(str, 'request_method'), NamedArg(str, 'request_scheme'), NamedArg(str, 'request_host'), NamedArg(str, 'request_path'), NamedArg(str, 'request_url'), NamedArg(str, 'request_http_version'), NamedArg(float, 'request_timestamp'), NamedArg(bool, 'request_is_push_promise'), NamedArg(bool, 'intercepted'), NamedArg(int | None, 'response_code'), NamedArg(str | None, 'response_reason'), NamedArg(int | None, 'response_content_length'), NamedArg(str | None, 'response_content_type'), NamedArg(float | None, 'duration'), NamedArg(str | None, 'error_message')], Any]")  [assignment]
+ mitmproxy/tools/console/common.py:853: error: Argument "is_replay" to "__call__" of "_lru_cache_wrapper" has incompatible type "str | None"; expected "bool"  [arg-type]

dacite (https://github.com/konradhalas/dacite)
+ dacite/core.py:51: error: Argument "localns" to "get_type_hints" has incompatible type "FrozenDict | None"; expected "dict[str, Any] | None"  [arg-type]

pip (https://github.com/pypa/pip)
+ src/pip/_internal/index/package_finder.py:909: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "str | None"; expected "str"  [arg-type]

psycopg (https://github.com/psycopg/psycopg)
+ psycopg/psycopg/rows.py:141: error: Argument 2 to "__call__" of "_lru_cache_wrapper" has incompatible type "*Generator[bytes | None, None, None]"; expected "bytes"  [arg-type]

pylint (https://github.com/pycqa/pylint)
+ pylint/checkers/utils.py:2262: error: "_lru_cache_wrapper" expects 2 type arguments, but 1 given  [type-arg]
+ pylint/checkers/utils.py:2262: error: Missing type parameters for generic type "_lru_cache_wrapper"  [type-arg]

jinja (https://github.com/pallets/jinja)
+ src/jinja2/environment.py:1186: error: Unused "type: ignore" comment  [unused-ignore]
+ src/jinja2/environment.py:1201: error: Unused "type: ignore" comment  [unused-ignore]

pandas (https://github.com/pandas-dev/pandas)
+ pandas/core/dtypes/cast.py:592: error: Unused "type: ignore" comment  [unused-ignore]
+ pandas/core/apply.py:981: error: Unused "type: ignore" comment  [unused-ignore]

manticore (https://github.com/trailofbits/manticore)
+ manticore/core/smtlib/solver.py:505: error: Signature of "can_be_true" incompatible with supertype "Solver"  [override]
+ manticore/core/smtlib/solver.py:505: note:      Superclass:
+ manticore/core/smtlib/solver.py:505: note:          def can_be_true(self, constraints: Any, expression: Any = ...) -> bool
+ manticore/core/smtlib/solver.py:505: note:      Subclass:
+ manticore/core/smtlib/solver.py:505: note:          _lru_cache_wrapper[[SMTLIBSolver, ConstraintSet, bool | Bool], bool]
+ manticore/core/smtlib/solver.py:605: error: Signature of "get_all_values" incompatible with supertype "Solver"  [override]
+ manticore/core/smtlib/solver.py:605: note:      Superclass:
+ manticore/core/smtlib/solver.py:605: note:          def get_all_values(self, constraints: Any, x: Any, maxcnt: Any = ..., silent: Any = ...) -> Any
+ manticore/core/smtlib/solver.py:605: note:      Subclass:
+ manticore/core/smtlib/solver.py:605: note:          _lru_cache_wrapper[[SMTLIBSolver, ConstraintSet, Any, int | None, bool], Any]

mongo-python-driver (https://github.com/mongodb/mongo-python-driver)
+ bson/datetime_ms.py:141: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "tzinfo"; expected "timezone"  [arg-type]
+ bson/datetime_ms.py:143: error: Argument 1 to "__call__" of "_lru_cache_wrapper" has incompatible type "tzinfo"; expected "timezone"  [arg-type]

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

ibis (https://github.com/ibis-project/ibis)
+ ibis/backends/tests/test_temporal.py:2364: error: Argument "exclude" to "__call__" of "_lru_cache_wrapper" has incompatible type "tuple[str, str, str, str]"; expected "tuple[str]"  [arg-type]
+ ibis/backends/tests/test_temporal.py:2382: error: Argument "exclude" to "__call__" of "_lru_cache_wrapper" has incompatible type "tuple[str, str, str, str, str, str, str, str]"; expected "tuple[str]"  [arg-type]
+ ibis/backends/tests/test_dot_sql.py:241: error: Argument "exclude" to "__call__" of "_lru_cache_wrapper" has incompatible type "tuple[str, str]"; expected "tuple[str]"  [arg-type]

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

@hauntsaninja
Copy link
Collaborator

@Viicos I think your approach works, although for mypy it currently needs to have def __call__ to bind correctly. Would you be interested in opening a PR?

@Viicos
Copy link
Contributor

Viicos commented Apr 16, 2024

I can give it a shot and see how the primer diff looks like 👍

@alwaysmpe
Copy link

Is this PR still deferred? I think I've got a working version in the current type system, see #11280

@cdce8p
Copy link
Contributor Author

cdce8p commented Nov 3, 2024

@alwaysmpe Feel free to open a new PR with your suggestion. That way we could test if it works and look at the mypy primer output.

@alwaysmpe
Copy link

@cdce8p I've created #12945 so see how it goes, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: deferred Issue or PR deferred until some precondition is fixed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

@functools.cache destroys the function signature
8 participants