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

Add additional dict get overload #12083

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

max-muoto
Copy link
Contributor

No description provided.

@max-muoto max-muoto force-pushed the additional-dict-get-overload branch from d0da295 to aefe538 Compare June 2, 2024 01:00
Copy link
Contributor

github-actions bot commented Jun 2, 2024

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

steam.py (https://github.com/Gobot1234/steam.py)
+ steam/ext/commands/utils.py:43: note:          @overload
+ steam/ext/commands/utils.py:43: note:          def [_T] get(self, object, _T, /) -> _VT | _T

AutoSplit (https://github.com/Toufool/AutoSplit)
+ src/capture_method/__init__.py:106:5: error: Signature of "get" incompatible with supertype "dict"  [override]
+ src/capture_method/__init__.py:106:5: note:      Superclass:
+ src/capture_method/__init__.py:106:5: note:          @overload
+ src/capture_method/__init__.py:106:5: note:          def get(self, CaptureMethodEnum, /) -> type[CaptureMethodBase] | None
+ src/capture_method/__init__.py:106:5: note:          @overload
+ src/capture_method/__init__.py:106:5: note:          def get(self, CaptureMethodEnum, type[CaptureMethodBase], /) -> type[CaptureMethodBase]
+ src/capture_method/__init__.py:106:5: note:          @overload
+ src/capture_method/__init__.py:106:5: note:          def [_T] get(self, CaptureMethodEnum, _T, /) -> type[CaptureMethodBase] | _T
+ src/capture_method/__init__.py:106:5: note:          @overload
+ src/capture_method/__init__.py:106:5: note:          def [_T] get(self, object, _T, /) -> type[CaptureMethodBase] | _T
+ src/capture_method/__init__.py:106:5: note:      Subclass:
+ src/capture_method/__init__.py:106:5: note:          def get(self, key: CaptureMethodEnum, object = ..., /) -> Any

pandas (https://github.com/pandas-dev/pandas)
+ pandas/core/arrays/arrow/array.py:2940: error: Unused "type: ignore" comment  [unused-ignore]

openlibrary (https://github.com/internetarchive/openlibrary)
+ openlibrary/tests/accounts/test_models.py:2: note: ... from here:

pwndbg (https://github.com/pwndbg/pwndbg)
+ pwndbg/commands/ai.py:76: note: ... from here:

sphinx (https://github.com/sphinx-doc/sphinx)
+ sphinx/builders/latex/transforms.py:543: error: INTERNAL ERROR -- Please try using mypy master on GitHub:
+ https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
+ Please report a bug at https://github.com/python/mypy/issues
+ version: 1.10.0
+ sphinx/builders/latex/transforms.py:543: : note: use --pdb to drop into pdb
+ sphinx/builders/linkcheck.py:19: note: ... from here:
+ Traceback (most recent call last):
+   File "mypy/checker.py", line 589, in accept
+   File "mypy/nodes.py", line 1310, in accept
+   File "mypy/checker.py", line 2850, in visit_assignment_stmt
+   File "mypy/checker.py", line 2905, in check_assignment
+   File "mypy/checker.py", line 3607, in check_assignment_to_multiple_lvalues
+   File "mypy/checker.py", line 3685, in check_multi_assignment
+   File "mypy/checker.py", line 3824, in check_multi_assignment_from_tuple
+ AssertionError: 

werkzeug (https://github.com/pallets/werkzeug)
+ src/werkzeug/datastructures/structures.pyi:31: error: Signature of "get" incompatible with supertype "dict"  [override]
+ src/werkzeug/datastructures/structures.pyi:31: note:      Superclass:
+ src/werkzeug/datastructures/structures.pyi:31: note:          @overload
+ src/werkzeug/datastructures/structures.pyi:31: note:          def get(self, K, /) -> V | None
+ src/werkzeug/datastructures/structures.pyi:31: note:          @overload
+ src/werkzeug/datastructures/structures.pyi:31: note:          def get(self, K, V, /) -> V
+ src/werkzeug/datastructures/structures.pyi:31: note:          @overload
+ src/werkzeug/datastructures/structures.pyi:31: note:          def [_T] get(self, K, _T, /) -> V | _T
+ src/werkzeug/datastructures/structures.pyi:31: note:          @overload
+ src/werkzeug/datastructures/structures.pyi:31: note:          def [_T] get(self, object, _T, /) -> V | _T
+ src/werkzeug/datastructures/structures.pyi:31: note:      Subclass:
+ src/werkzeug/datastructures/structures.pyi:31: note:          @overload
+ src/werkzeug/datastructures/structures.pyi:31: note:          def get(self, key: K, default: None = ..., type: None = ...) -> V | None
+ src/werkzeug/datastructures/structures.pyi:31: note:          @overload
+ src/werkzeug/datastructures/structures.pyi:31: note:          def [D] get(self, key: K, default: D, type: None = ...) -> D | V
+ src/werkzeug/datastructures/structures.pyi:31: note:          @overload
+ src/werkzeug/datastructures/structures.pyi:31: note:          def [D, T] get(self, key: K, default: D, type: Callable[[V], T]) -> D | T
+ src/werkzeug/datastructures/structures.pyi:31: note:          @overload
+ src/werkzeug/datastructures/structures.pyi:31: note:          def [T] get(self, key: K, type: Callable[[V], T]) -> T | None
+ src/werkzeug/exceptions.py:94: error: Unused "type: ignore" comment  [unused-ignore]

flake8 (https://github.com/pycqa/flake8)
+ tests/unit/plugins/finder_test.py:162: error: Argument 3 to "object" of "_patcher" has incompatible type overloaded function; expected overloaded function  [arg-type]

scrapy (https://github.com/scrapy/scrapy)
+ scrapy/utils/datatypes.py:88: error: Signature of "get" incompatible with supertype "dict"  [override]
+ scrapy/utils/datatypes.py:88: note:      Superclass:
+ scrapy/utils/datatypes.py:88: note:          @overload
+ scrapy/utils/datatypes.py:88: note:          def get(self, Any, /) -> Any | None
+ scrapy/utils/datatypes.py:88: note:          @overload
+ scrapy/utils/datatypes.py:88: note:          def get(self, Any, Any, /) -> Any
+ scrapy/utils/datatypes.py:88: note:          @overload
+ scrapy/utils/datatypes.py:88: note:          def [_T] get(self, Any, _T, /) -> Any | _T
+ scrapy/utils/datatypes.py:88: note:          @overload
+ scrapy/utils/datatypes.py:88: note:          def [_T] get(self, object, _T, /) -> Any | _T
+ scrapy/utils/datatypes.py:88: note:      Subclass:
+ scrapy/utils/datatypes.py:88: note:          def [AnyStr in (str, bytes)] get(self, key: AnyStr, def_val: Any = ...) -> Any
+ scrapy/http/headers.py:85: error: Signature of "get" incompatible with supertype "dict"  [override]
+ scrapy/http/headers.py:85: note:      Superclass:
+ scrapy/http/headers.py:85: note:          @overload
+ scrapy/http/headers.py:85: note:          def get(self, Any, /) -> Any | None
+ scrapy/http/headers.py:85: note:          @overload
+ scrapy/http/headers.py:85: note:          def get(self, Any, Any, /) -> Any
+ scrapy/http/headers.py:85: note:          @overload
+ scrapy/http/headers.py:85: note:          def [_T] get(self, Any, _T, /) -> Any | _T
+ scrapy/http/headers.py:85: note:          @overload
+ scrapy/http/headers.py:85: note:          def [_T] get(self, object, _T, /) -> Any | _T
+ scrapy/http/headers.py:85: note:      Subclass:
+ scrapy/http/headers.py:85: note:          def [AnyStr in (str, bytes)] get(self, key: AnyStr, def_val: Any = ...) -> bytes | None

jax (https://github.com/google/jax)
+ jax/_src/core.py:1437: error: Unused "type: ignore" comment  [unused-ignore]
+ jax/_src/core.py:3098: error: Unused "type: ignore" comment  [unused-ignore]
+ jax/_src/interpreters/partial_eval.py:643: error: Unused "type: ignore" comment  [unused-ignore]
+ jax/_src/interpreters/partial_eval.py:2677: error: Unused "type: ignore" comment  [unused-ignore]

schemathesis (https://github.com/schemathesis/schemathesis)
+ src/schemathesis/cli/cassettes.py:354: note: In module imported here:

cwltool (https://github.com/common-workflow-language/cwltool)
+ cwltool/docker.py:15: note: ... from here:
+ note: ... from here,
+ note: ... from here,
+ cwltool/utils.py:52: note: ... from here:

schema_salad (https://github.com/common-workflow-language/schema_salad)
+ schema_salad/tests/test_cwl11.py:13: note: ... from here:

streamlit (https://github.com/streamlit/streamlit)
+ lib/tests/streamlit/web/cli_test.py:31: note: ... from here:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant