-
Type:
Bug
-
Resolution: Unresolved
-
Priority:
Unknown
-
None
-
Affects Version/s: None
-
Component/s: Typing
-
None
-
Python Drivers
-
None
-
None
-
None
-
None
-
None
-
None
Our type hint for "let" is incorrect because they're missing generics:
$ git grep '\[Mapping\]'
pymongo/asynchronous/collection.py:707: let: Optional[Mapping] = None,
pymongo/asynchronous/collection.py:3205: let: Optional[Mapping] = None,
pymongo/asynchronous/mongo_client.py:2405: let: Optional[Mapping] = None,
pymongo/synchronous/collection.py:706: let: Optional[Mapping] = None,
pymongo/synchronous/collection.py:3198: let: Optional[Mapping] = None,
pymongo/synchronous/mongo_client.py:2393: let: Optional[Mapping] = None,
We should update them to something like: "let: Optional[Mapping[str, Any]] = None,"
A user commented on how pyright raises errors on partially unknown types (for example Mapping and List instead of Mapping[str, Any] and List[int])
It would be nice to eventually turn on the appropriate flags in mypy (disallow_any_generics) and pyright (reportMissingTypeArgument) that enforces typed containers.
As of the creation of this ticket, turning on the flag in pyright seemed to produce ~250 errors (and i'd guess about half of these errors are duplicated sync errors)
- is related to
-
PYTHON-5124 _DocumentType is bound to Mapping, but some methods violate the protocol
-
- Blocked
-