Skip to content

Disallow any generic in type type context#21164

Draft
hauntsaninja wants to merge 1 commit intopython:masterfrom
hauntsaninja:typetdisallow
Draft

Disallow any generic in type type context#21164
hauntsaninja wants to merge 1 commit intopython:masterfrom
hauntsaninja:typetdisallow

Conversation

@hauntsaninja
Copy link
Copy Markdown
Collaborator

@hauntsaninja hauntsaninja commented Apr 3, 2026

Resolves #21145

Let's see what primer says

Authored by Codex

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 4, 2026

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

mongo-python-driver (https://github.com/mongodb/mongo-python-driver)
+ bson/json_util.py:992: error: Missing type arguments for generic type "Regex"  [type-arg]
+ pymongo/common.py:60: error: Missing type arguments for generic type "SON"  [type-arg]
+ pymongo/common.py:60: error: Missing type arguments for generic type "OrderedDict"  [type-arg]
+ pymongo/synchronous/mongo_client.py:751: error: Missing type arguments for generic type "dict"  [type-arg]
+ pymongo/synchronous/database.py:709: error: Missing type arguments for generic type "CommandCursor"  [type-arg]
+ pymongo/synchronous/collection.py:2543: error: Missing type arguments for generic type "SON"  [type-arg]
+ pymongo/synchronous/collection.py:2673: error: Missing type arguments for generic type "CommandCursor"  [type-arg]
+ pymongo/synchronous/collection.py:3013: error: Missing type arguments for generic type "CommandCursor"  [type-arg]
+ pymongo/synchronous/collection.py:3061: error: Missing type arguments for generic type "RawBatchCommandCursor"  [type-arg]
+ pymongo/synchronous/change_stream.py:244: error: Missing type arguments for generic type "CommandCursor"  [type-arg]
+ pymongo/asynchronous/mongo_client.py:751: error: Missing type arguments for generic type "dict"  [type-arg]
+ pymongo/asynchronous/database.py:709: error: Missing type arguments for generic type "AsyncCommandCursor"  [type-arg]
+ pymongo/asynchronous/collection.py:2546: error: Missing type arguments for generic type "SON"  [type-arg]
+ pymongo/asynchronous/collection.py:2676: error: Missing type arguments for generic type "AsyncCommandCursor"  [type-arg]
+ pymongo/asynchronous/collection.py:3020: error: Missing type arguments for generic type "AsyncCommandCursor"  [type-arg]
+ pymongo/asynchronous/collection.py:3068: error: Missing type arguments for generic type "AsyncRawBatchCommandCursor"  [type-arg]
+ pymongo/asynchronous/change_stream.py:246: error: Missing type arguments for generic type "AsyncCommandCursor"  [type-arg]

aiohttp (https://github.com/aio-libs/aiohttp)
+ aiohttp/payload.py:102:55: error: Missing type arguments for generic type "chain"  [type-arg]
+ aiohttp/payload.py:102:55: note: See https://mypy.rtfd.io/en/stable/_refs.html#code-type-arg for more info
+ aiohttp/pytest_plugin.py:376:12: error: Missing type arguments for generic type "TestClient"  [type-arg]

Tanjun (https://github.com/FasterSpeeding/Tanjun)
+ tanjun/context/slash.py:960: error: Missing type arguments for generic type "Resource"  [type-arg]
+ tanjun/context/slash.py:1067: error: Missing type arguments for generic type "ExecutableCommand"  [type-arg]
+ tanjun/context/slash.py:1068: error: Missing type arguments for generic type "AppCommand"  [type-arg]
+ tanjun/context/slash.py:1070: error: Missing type arguments for generic type "SlashCommand"  [type-arg]
+ tanjun/context/slash.py:1075: error: Missing type arguments for generic type "ExecutableCommand"  [type-arg]
+ tanjun/context/slash.py:1076: error: Missing type arguments for generic type "AppCommand"  [type-arg]
+ tanjun/context/slash.py:1078: error: Missing type arguments for generic type "SlashCommand"  [type-arg]
+ tanjun/context/message.py:188: error: Missing type arguments for generic type "ExecutableCommand"  [type-arg]
+ tanjun/context/message.py:189: error: Missing type arguments for generic type "MessageCommand"  [type-arg]
+ tanjun/context/message.py:194: error: Missing type arguments for generic type "ExecutableCommand"  [type-arg]
+ tanjun/context/message.py:195: error: Missing type arguments for generic type "MessageCommand"  [type-arg]
+ tanjun/context/menu.py:156: error: Missing type arguments for generic type "MenuCommand"  [type-arg]

flake8 (https://github.com/pycqa/flake8)
+ src/flake8/__init__.py:59: error: Missing type arguments for generic type "StreamHandler"  [type-arg]

sphinx (https://github.com/sphinx-doc/sphinx)
+ sphinx/directives/__init__.py: note: In function "setup":
+ sphinx/directives/__init__.py:375:47: error: Missing type arguments for generic type "ObjectDescription"  [type-arg]
+ sphinx/directives/__init__.py:377:45: error: Missing type arguments for generic type "ObjectDescription"  [type-arg]

pytest (https://github.com/pytest-dev/pytest)
+ src/_pytest/python_api.py:322: error: Missing type arguments for generic type "list"  [type-arg]

werkzeug (https://github.com/pallets/werkzeug)
+ src/werkzeug/sansio/request.py:78: error: Missing type arguments for generic type "ImmutableMultiDict"  [type-arg]
+ src/werkzeug/sansio/request.py:88: error: Missing type arguments for generic type "ImmutableMultiDict"  [type-arg]
+ src/werkzeug/sansio/request.py:95: error: Missing type arguments for generic type "ImmutableList"  [type-arg]
+ tests/test_wrappers.py:1017: error: Missing type arguments for generic type "dict"  [type-arg]
+ tests/test_wrappers.py:1018: error: Missing type arguments for generic type "list"  [type-arg]
+ tests/test_wrappers.py:1019: error: Missing type arguments for generic type "dict"  [type-arg]
+ tests/test_formparser.py:436: error: Missing type arguments for generic type "dict"  [type-arg]
+ tests/test_datastructures.py:305: error: Missing type arguments for generic type "ImmutableTypeConversionDict"  [type-arg]
+ tests/test_datastructures.py:309: error: Missing type arguments for generic type "ImmutableMultiDict"  [type-arg]
+ tests/test_datastructures.py:330: error: Missing type arguments for generic type "ImmutableDict"  [type-arg]
+ tests/test_datastructures.py:334: error: Missing type arguments for generic type "MultiDict"  [type-arg]

black (https://github.com/psf/black)
+ src/black/__init__.py:570:23: error: Missing type arguments for generic type "dict"  [type-arg]

koda-validate (https://github.com/keithasaurus/koda-validate)
+ koda_validate/list.py:45: error: Missing type arguments for generic type "list"  [type-arg]
+ koda_validate/list.py:53: error: Missing type arguments for generic type "list"  [type-arg]
+ koda_validate/list.py:82: error: Missing type arguments for generic type "list"  [type-arg]
+ koda_validate/list.py:90: error: Missing type arguments for generic type "list"  [type-arg]
+ koda_validate/dictionary.py:111: error: Missing type arguments for generic type "dict"  [type-arg]
+ koda_validate/dictionary.py:118: error: Missing type arguments for generic type "dict"  [type-arg]
+ koda_validate/dictionary.py:167: error: Missing type arguments for generic type "dict"  [type-arg]
+ koda_validate/dictionary.py:174: error: Missing type arguments for generic type "dict"  [type-arg]
+ koda_validate/dictionary.py:253: error: Missing type arguments for generic type "dict"  [type-arg]
+ koda_validate/dictionary.py:889: error: Missing type arguments for generic type "dict"  [type-arg]
+ koda_validate/dictionary.py:922: error: Missing type arguments for generic type "dict"  [type-arg]
+ koda_validate/dictionary.py:1056: error: Missing type arguments for generic type "dict"  [type-arg]
+ koda_validate/dictionary.py:1086: error: Missing type arguments for generic type "dict"  [type-arg]
+ koda_validate/tuple.py:21: error: Missing type arguments for generic type "list"  [type-arg]
+ koda_validate/tuple.py:21: error: Missing type arguments for generic type "tuple"  [type-arg]
+ koda_validate/tuple.py:291: error: Missing type arguments for generic type "list"  [type-arg]
+ koda_validate/tuple.py:298: error: Missing type arguments for generic type "tuple"  [type-arg]
+ koda_validate/tuple.py:332: error: Missing type arguments for generic type "list"  [type-arg]
+ koda_validate/tuple.py:339: error: Missing type arguments for generic type "tuple"  [type-arg]
+ koda_validate/tuple.py:412: error: Missing type arguments for generic type "list"  [type-arg]
+ koda_validate/tuple.py:420: error: Missing type arguments for generic type "tuple"  [type-arg]
+ koda_validate/tuple.py:456: error: Missing type arguments for generic type "list"  [type-arg]
+ koda_validate/tuple.py:464: error: Missing type arguments for generic type "tuple"  [type-arg]
+ koda_validate/typeddict.py:164: error: Missing type arguments for generic type "dict"  [type-arg]
+ koda_validate/typeddict.py:172: error: Missing type arguments for generic type "dict"  [type-arg]
+ koda_validate/typeddict.py:206: error: Missing type arguments for generic type "dict"  [type-arg]
+ koda_validate/typeddict.py:214: error: Missing type arguments for generic type "dict"  [type-arg]
+ koda_validate/set.py:42: error: Missing type arguments for generic type "set"  [type-arg]
+ koda_validate/set.py:50: error: Missing type arguments for generic type "set"  [type-arg]
+ koda_validate/set.py:85: error: Missing type arguments for generic type "set"  [type-arg]
+ koda_validate/set.py:93: error: Missing type arguments for generic type "set"  [type-arg]
+ koda_validate/namedtuple.py:163: error: Missing type arguments for generic type "dict"  [type-arg]
+ koda_validate/namedtuple.py:175: error: Missing type arguments for generic type "dict"  [type-arg]
+ koda_validate/namedtuple.py:214: error: Missing type arguments for generic type "dict"  [type-arg]
+ koda_validate/namedtuple.py:226: error: Missing type arguments for generic type "dict"  [type-arg]
+ koda_validate/dataclasses.py:170: error: Missing type arguments for generic type "dict"  [type-arg]
+ koda_validate/dataclasses.py:182: error: Missing type arguments for generic type "dict"  [type-arg]
+ koda_validate/dataclasses.py:221: error: Missing type arguments for generic type "dict"  [type-arg]
+ koda_validate/dataclasses.py:233: error: Missing type arguments for generic type "dict"  [type-arg]
+ koda_validate/serialization/errors.py:113: error: Missing type arguments for generic type "dict"  [type-arg]
+ koda_validate/serialization/errors.py:114: error: Missing type arguments for generic type "list"  [type-arg]
+ koda_validate/serialization/errors.py:115: error: Missing type arguments for generic type "tuple"  [type-arg]

bidict (https://github.com/jab/bidict)
+ bidict/_base.py: note: In class "BidictBase":
+ bidict/_base.py:84:65: error: Missing type arguments for generic type "dict"  [type-arg]
+ bidict/_base.py:85:65: error: Missing type arguments for generic type "dict"  [type-arg]
+ bidict/_orderedbidict.py:174:43: error: Missing type arguments for generic type "_OrderedBidictKeysView"  [type-arg]
+ bidict/_orderedbidict.py:175:43: error: Missing type arguments for generic type "_OrderedBidictItemsView"  [type-arg]

packaging (https://github.com/pypa/packaging)
+ src/packaging/direct_url.py:70: error: Missing type arguments for generic type "Mapping"  [type-arg]
+ src/packaging/direct_url.py:70: note: Error code "type-arg" not covered by "type: ignore" comment
+ src/packaging/direct_url.py:187: error: Missing type arguments for generic type "Mapping"  [type-arg]
+ src/packaging/direct_url.py:187: note: Error code "type-arg" not covered by "type: ignore" comment
+ src/packaging/pylock.py:122: error: Missing type arguments for generic type "Sequence"  [type-arg]
+ src/packaging/pylock.py:122: note: Error code "type-arg" not covered by "type: ignore" comment
+ src/packaging/pylock.py:195: error: Missing type arguments for generic type "Mapping"  [type-arg]
+ src/packaging/pylock.py:195: note: Error code "type-arg" not covered by "type: ignore" comment
+ src/packaging/pylock.py:207: error: Missing type arguments for generic type "Mapping"  [type-arg]
+ src/packaging/pylock.py:207: note: Error code "type-arg" not covered by "type: ignore" comment
+ src/packaging/pylock.py:414: error: Missing type arguments for generic type "Mapping"  [type-arg]
+ src/packaging/pylock.py:414: note: Error code "type-arg" not covered by "type: ignore" comment
+ src/packaging/pylock.py:456: error: Missing type arguments for generic type "Mapping"  [type-arg]
+ src/packaging/pylock.py:456: note: Error code "type-arg" not covered by "type: ignore" comment
+ src/packaging/pylock.py:505: error: Missing type arguments for generic type "Mapping"  [type-arg]
+ src/packaging/pylock.py:505: note: Error code "type-arg" not covered by "type: ignore" comment
+ src/packaging/pylock.py:573: error: Missing type arguments for generic type "Mapping"  [type-arg]
+ src/packaging/pylock.py:573: note: Error code "type-arg" not covered by "type: ignore" comment
+ src/packaging/pylock.py:581: error: Missing type arguments for generic type "Mapping"  [type-arg]
+ src/packaging/pylock.py:581: note: Error code "type-arg" not covered by "type: ignore" comment
+ src/packaging/pylock.py:582: error: Missing type arguments for generic type "Mapping"  [type-arg]
+ src/packaging/pylock.py:582: note: Error code "type-arg" not covered by "type: ignore" comment
+ src/packaging/pylock.py:702: error: Missing type arguments for generic type "Mapping"  [type-arg]
+ src/packaging/pylock.py:702: note: Error code "type-arg" not covered by "type: ignore" comment

archinstall (https://github.com/archlinux/archinstall)
+ archinstall/tui/ui/components.py:450: error: Missing type arguments for generic type "SelectionList"  [type-arg]
+ archinstall/tui/ui/components.py:503: error: Missing type arguments for generic type "SelectionList"  [type-arg]
+ archinstall/tui/ui/components.py:506: error: Missing type arguments for generic type "SelectionList"  [type-arg]
+ archinstall/tui/ui/components.py:517: error: Missing type arguments for generic type "SelectionList"  [type-arg]
+ archinstall/tui/ui/components.py:536: error: Missing type arguments for generic type "SelectionList"  [type-arg]
+ archinstall/tui/ui/components.py:978: error: Missing type arguments for generic type "DataTable"  [type-arg]
+ archinstall/tui/ui/components.py:1052: error: Missing type arguments for generic type "DataTable"  [type-arg]
+ archinstall/tui/ui/components.py:1081: error: Missing type arguments for generic type "DataTable"  [type-arg]

jinja (https://github.com/pallets/jinja)
+ src/jinja2/sandbox.py:44: error: Missing type arguments for generic type "MutableSet"  [type-arg]
+ src/jinja2/sandbox.py:59: error: Missing type arguments for generic type "MutableMapping"  [type-arg]
+ src/jinja2/sandbox.py:63: error: Missing type arguments for generic type "MutableSequence"  [type-arg]
+ src/jinja2/sandbox.py:69: error: Missing type arguments for generic type "deque"  [type-arg]

pip (https://github.com/pypa/pip)
+ src/pip/_internal/models/direct_url.py:136: error: Missing type arguments for generic type "dict"  [type-arg]
+ src/pip/_internal/models/direct_url.py:204: error: Missing type arguments for generic type "dict"  [type-arg]
+ src/pip/_internal/models/direct_url.py:205: error: Missing type arguments for generic type "dict"  [type-arg]
+ src/pip/_internal/models/direct_url.py:206: error: Missing type arguments for generic type "dict"  [type-arg]

bokeh (https://github.com/bokeh/bokeh)
+ src/bokeh/core/property/serialized.py:71:21: error: Missing type arguments for generic type "NotSerialized"  [type-arg]
+ src/bokeh/core/property/nullable.py:83:21: error: Missing type arguments for generic type "Nullable"  [type-arg]
+ src/bokeh/embed/standalone.py: note: In function "components":
+ src/bokeh/embed/standalone.py:258:39: error: Missing type arguments for generic type "dict"  [type-arg]
+ src/bokeh/core/property/required.py:66:21: error: Missing type arguments for generic type "Required"  [type-arg]
+ src/bokeh/core/property/constraints.py:110:21: error: Missing type arguments for generic type "TypeOfAttr"  [type-arg]

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.

Emit errors with --disallow-any-generics if type[T] or TypeForm[T] receives a generic T with missing type arguments

1 participant