Skip to content

allow object in Mapping.get#15380

Draft
randolf-scholz wants to merge 1 commit intopython:mainfrom
randolf-scholz:mapping_get_object
Draft

allow object in Mapping.get#15380
randolf-scholz wants to merge 1 commit intopython:mainfrom
randolf-scholz:mapping_get_object

Conversation

@randolf-scholz
Copy link
Contributor

No description provided.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 6, 2026

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

pwndbg (https://github.com/pwndbg/pwndbg)
+ pwndbg/commands/ai.py:87: note: ... from here:
+ pwndbg/commands/__init__.py:77: note: In module imported here:

mongo-python-driver (https://github.com/mongodb/mongo-python-driver)
+ pymongo/common.py:1042: error: Signature of "get" incompatible with supertype "typing.Mapping"  [override]
+ pymongo/common.py:1042: note:      Superclass:
+ pymongo/common.py:1042: note:          @overload
+ pymongo/common.py:1042: note:          def get(self, object, /) -> Any | None
+ pymongo/common.py:1042: note:          @overload
+ pymongo/common.py:1042: note:          def get(self, object, Any, /) -> Any
+ pymongo/common.py:1042: note:          @overload
+ pymongo/common.py:1042: note:          def [_T] get(self, object, _T, /) -> Any | _T
+ pymongo/common.py:1042: note:      Subclass:
+ pymongo/common.py:1042: note:          def get(self, key: str, default: Any | None = ...) -> Any

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

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

sphinx (https://github.com/sphinx-doc/sphinx)
+ sphinx/builders/linkcheck.py:18: note: ... from here:

sympy (https://github.com/sympy/sympy)
+ sympy/ntheory/factor_.py:749: error: Signature of "get" incompatible with supertype "typing.Mapping"  [override]
+ sympy/ntheory/factor_.py:749: note:      Superclass:
+ sympy/ntheory/factor_.py:749: note:          @overload
+ sympy/ntheory/factor_.py:749: note:          def get(self, object, /) -> Any | None
+ sympy/ntheory/factor_.py:749: note:          @overload
+ sympy/ntheory/factor_.py:749: note:          def get(self, object, Any, /) -> Any
+ sympy/ntheory/factor_.py:749: note:          @overload
+ sympy/ntheory/factor_.py:749: note:          def [_T] get(self, object, _T, /) -> Any | _T
+ sympy/ntheory/factor_.py:749: note:      Subclass:
+ sympy/ntheory/factor_.py:749: note:          def get(self, n: int, default: Any = ...) -> Any

xarray (https://github.com/pydata/xarray)
+ xarray/tests/test_backends.py:6531: note: ... from here:
+ xarray/core/utils.py: note: In member "get" of class "FrozenMappingWarningOnValuesAccess":
+ xarray/core/utils.py:551: error: Signature of "get" incompatible with supertype "typing.Mapping"  [override]
+ xarray/core/utils.py:551: note:      Superclass:
+ xarray/core/utils.py:551: note:          @overload
+ xarray/core/utils.py:551: note:          def get(self, object, /) -> V | None
+ xarray/core/utils.py:551: note:          @overload
+ xarray/core/utils.py:551: note:          def get(self, object, V, /) -> V
+ xarray/core/utils.py:551: note:          @overload
+ xarray/core/utils.py:551: note:          def [_T] get(self, object, _T, /) -> V | _T
+ xarray/core/utils.py:551: note:      Subclass:
+ xarray/core/utils.py:551: note:          @overload
+ xarray/core/utils.py:551: note:          def get(self, K, /) -> V | None
+ xarray/core/utils.py:551: note:          @overload
+ xarray/core/utils.py:551: note:          def [T] get(self, K, /, default: V | T) -> V | T

pyodide (https://github.com/pyodide/pyodide)
+ src/py/_pyodide/_core_docs.py:1113: error: Signature of "get" incompatible with supertype "typing.Mapping"  [override]
+ src/py/_pyodide/_core_docs.py:1113: note:      Superclass:
+ src/py/_pyodide/_core_docs.py:1113: note:          @overload
+ src/py/_pyodide/_core_docs.py:1113: note:          def get(self, object, /) -> VT_co | None
+ src/py/_pyodide/_core_docs.py:1113: note:          @overload
+ src/py/_pyodide/_core_docs.py:1113: note:          def get(self, object, VT_co, /) -> VT_co
+ src/py/_pyodide/_core_docs.py:1113: note:          @overload
+ src/py/_pyodide/_core_docs.py:1113: note:          def [_T] get(self, object, _T, /) -> VT_co | _T
+ src/py/_pyodide/_core_docs.py:1113: note:      Subclass:
+ src/py/_pyodide/_core_docs.py:1113: note:          @overload
+ src/py/_pyodide/_core_docs.py:1113: note:          def get(self, KT, /) -> VT_co | None
+ src/py/_pyodide/_core_docs.py:1113: note:          @overload
+ src/py/_pyodide/_core_docs.py:1113: note:          def [T] get(self, KT, VT_co | T, /) -> VT_co | T

django-stubs (https://github.com/typeddjango/django-stubs)
+ django-stubs/utils/datastructures.pyi:65: error: Signature of "get" incompatible with supertype "typing.Mapping"  [override]
+ django-stubs/utils/datastructures.pyi:65: note:      Superclass:
+ django-stubs/utils/datastructures.pyi:65: note:          @overload
+ django-stubs/utils/datastructures.pyi:65: note:          def get(self, object, /) -> _V | None
+ django-stubs/utils/datastructures.pyi:65: note:          @overload
+ django-stubs/utils/datastructures.pyi:65: note:          def get(self, object, _V, /) -> _V
+ django-stubs/utils/datastructures.pyi:65: note:          @overload
+ django-stubs/utils/datastructures.pyi:65: note:          def [_T] get(self, object, _T, /) -> _V | _T
+ django-stubs/utils/datastructures.pyi:65: note:      Subclass:
+ django-stubs/utils/datastructures.pyi:65: note:          @overload
+ django-stubs/utils/datastructures.pyi:65: note:          def get(self, key: _K, default: None = ...) -> _V | None
+ django-stubs/utils/datastructures.pyi:65: note:          @overload
+ django-stubs/utils/datastructures.pyi:65: note:          def get(self, key: _K, default: _V) -> _V
+ django-stubs/utils/datastructures.pyi:65: note:          @overload
+ django-stubs/utils/datastructures.pyi:65: note:          def [_Z] get(self, key: _K, default: _Z) -> _V | _Z

starlette (https://github.com/encode/starlette)
- tests/test_datastructures.py:171: note:     def get(self, str, /) -> str | None
+ tests/test_datastructures.py:171: note:     def get(self, object, /) -> str | None
- tests/test_datastructures.py:171: note:     def get(self, str, str, /) -> str
+ tests/test_datastructures.py:171: note:     def get(self, object, str, /) -> str
- tests/test_datastructures.py:171: note:     def [_T] get(self, str, _T, /) -> str | _T
+ tests/test_datastructures.py:171: note:     def [_T] get(self, object, _T, /) -> str | _T
- tests/test_datastructures.py:287: note:     def get(self, str, /) -> str | None
+ tests/test_datastructures.py:287: note:     def get(self, object, /) -> str | None
- tests/test_datastructures.py:287: note:     def get(self, str, str, /) -> str
+ tests/test_datastructures.py:287: note:     def get(self, object, str, /) -> str
- tests/test_datastructures.py:287: note:     def [_T] get(self, str, _T, /) -> str | _T
+ tests/test_datastructures.py:287: note:     def [_T] get(self, object, _T, /) -> str | _T
- tests/test_datastructures.py:371: note:     def get(self, str, /) -> UploadFile | str | None
+ tests/test_datastructures.py:371: note:     def get(self, object, /) -> UploadFile | str | None
- tests/test_datastructures.py:371: note:     def get(self, str, UploadFile | str, /) -> UploadFile | str
+ tests/test_datastructures.py:371: note:     def get(self, object, UploadFile | str, /) -> UploadFile | str
- tests/test_datastructures.py:371: note:     def [_T] get(self, str, _T, /) -> UploadFile | str | _T
+ tests/test_datastructures.py:371: note:     def [_T] get(self, object, _T, /) -> UploadFile | str | _T
- tests/test_datastructures.py:406: note:     def get(self, Any, /) -> Any | None
+ tests/test_datastructures.py:406: note:     def get(self, object, /) -> Any | None
- tests/test_datastructures.py:406: note:     def get(self, Any, Any, /) -> Any
+ tests/test_datastructures.py:406: note:     def get(self, object, Any, /) -> Any
- tests/test_datastructures.py:406: note:     def [_T] get(self, Any, _T, /) -> Any | _T
+ tests/test_datastructures.py:406: note:     def [_T] get(self, object, _T, /) -> Any | _T

cwltool (https://github.com/common-workflow-language/cwltool)
+ cwltool/docker.py:16: note: ... from here:

scrapy (https://github.com/scrapy/scrapy)
+ scrapy/utils/datatypes.py:82: error: Signature of "get" incompatible with supertype "typing.Mapping"  [override]
+ scrapy/utils/datatypes.py:82: note:      Superclass:
+ scrapy/utils/datatypes.py:82: note:          @overload
+ scrapy/utils/datatypes.py:82: note:          def get(self, object, /) -> Any | None
+ scrapy/utils/datatypes.py:82: note:          @overload
+ scrapy/utils/datatypes.py:82: note:          def get(self, object, Any, /) -> Any
+ scrapy/utils/datatypes.py:82: note:          @overload
+ scrapy/utils/datatypes.py:82: note:          def [_T] get(self, object, _T, /) -> Any | _T
+ scrapy/utils/datatypes.py:82: note:      Subclass:
+ scrapy/utils/datatypes.py:82: note:          def [AnyStr: (str, bytes)] get(self, key: AnyStr, def_val: Any = ...) -> Any
+ scrapy/http/headers.py:76: error: Signature of "get" incompatible with supertype "typing.Mapping"  [override]
+ scrapy/http/headers.py:76: note:      Superclass:
+ scrapy/http/headers.py:76: note:          @overload
+ scrapy/http/headers.py:76: note:          def get(self, object, /) -> Any | None
+ scrapy/http/headers.py:76: note:          @overload
+ scrapy/http/headers.py:76: note:          def get(self, object, Any, /) -> Any
+ scrapy/http/headers.py:76: note:          @overload
+ scrapy/http/headers.py:76: note:          def [_T] get(self, object, _T, /) -> Any | _T
+ scrapy/http/headers.py:76: note:      Subclass:
+ scrapy/http/headers.py:76: note:          def [AnyStr: (str, bytes)] get(self, key: AnyStr, def_val: Any = ...) -> bytes | None
+ scrapy/settings/__init__.py:142: error: Signature of "get" incompatible with supertype "typing.Mapping"  [override]
+ scrapy/settings/__init__.py:142: note:      Superclass:
+ scrapy/settings/__init__.py:142: note:          @overload
+ scrapy/settings/__init__.py:142: note:          def get(self, object, /) -> Any | None
+ scrapy/settings/__init__.py:142: note:          @overload
+ scrapy/settings/__init__.py:142: note:          def get(self, object, Any, /) -> Any
+ scrapy/settings/__init__.py:142: note:          @overload
+ scrapy/settings/__init__.py:142: note:          def [_T] get(self, object, _T, /) -> Any | _T
+ scrapy/settings/__init__.py:142: note:      Subclass:
+ scrapy/settings/__init__.py:142: note:          def get(self, name: bool | float | int | str | None, default: Any = ...) -> Any

schemathesis (https://github.com/schemathesis/schemathesis)
+ src/schemathesis/core/curl.py:87: note: In module imported here:

pydantic (https://github.com/pydantic/pydantic)
+ pydantic/_internal/_utils.py:204: error: Unused "type: ignore" comment  [unused-ignore]

steam.py (https://github.com/Gobot1234/steam.py)
- steam/ext/commands/utils.py:43: note:          def get(self, str, /) -> _VT | None
+ steam/ext/commands/utils.py:43: note:          def get(self, object, /) -> _VT | None
- steam/ext/commands/utils.py:43: note:          def get(self, str, _VT, /) -> _VT
+ steam/ext/commands/utils.py:43: note:          def get(self, object, _VT, /) -> _VT
- steam/ext/commands/utils.py:43: note:          def [_T] get(self, str, _T, /) -> _VT | _T
+ steam/ext/commands/utils.py:43: note:          def [_T] get(self, object, _T, /) -> _VT | _T
+ steam/package.py:215: error: Unused "type: ignore" comment  [unused-ignore]
+ steam/package.py:216: error: Unused "type: ignore" comment  [unused-ignore]

operator (https://github.com/canonical/operator)
- ops/model.py:1016: note:          def get(self, str, /) -> Binding | None
+ ops/model.py:1016: note:          def get(self, object, /) -> Binding | None
- ops/model.py:1016: note:          def get(self, str, Binding, /) -> Binding
+ ops/model.py:1016: note:          def get(self, object, Binding, /) -> Binding
- ops/model.py:1016: note:          def [_T] get(self, str, _T, /) -> Binding | _T
+ ops/model.py:1016: note:          def [_T] get(self, object, _T, /) -> Binding | _T

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.

1 participant