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

Fix annotations for builtins.reversed.__new__ #11646

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

Conversation

jorenham
Copy link

@jorenham jorenham commented Mar 21, 2024

fixes #11645


Deferred due to a mypy bug: python/mypy#15182

This comment has been minimized.

This comment has been minimized.

@srittau
Copy link
Collaborator

srittau commented Mar 23, 2024

It seems that mypy has problems with the first overload, but I'm not sure why. Everything seems correct to me and pyright seems to agree. For now, I would suggest to split this PR in two, one PR for the second overload and a separate PR for the first one. This should allow us to get part of the changes into typeshed soon, and will make it easier to debug the mypy problem.

@jorenham
Copy link
Author

jorenham commented Mar 25, 2024

@srittau I have tried many different approaches, but none of them seem to be accepted by mypy. As you said, pyright has no problem with this. I can't draw any other conclusions than this being a mypy bug, and it's easy to reproduce:

https://mypy-play.net/?mypy=latest&python=3.12&gist=0c754a7826a80f50ced671c26d891950&flags=strict

The expected behavior can be illustrated by pyright, which works as expected and doesn't require the type: ignore[misc]:
https://pyright-play.net/?strict=true&code=GYJw9gtgBALgngBwJYDsDmUkQWEMoAqiApgGoCGIAUFQVALyEkUgAUA5AewJQ1UDGAG3IBnEVAByYGAEEiCYgC4qUVVAAmxYFAD6OlMQDue1kJEAaKJTSLC3KAFoAfIWVr3UEMRgBXECisQNBUPVRDQqi8AN2JyQR14BVYpWXliVgAWACZubiA

I wasn't able to find anything on https://typing.readthedocs.io/ that would restrict the type of the return value from a (non-meta) class' __new__ method.
But for some reason, mypy blindly assumes that this is always a covariant type that is bound to the class at hand (i.e. __new__: (cls, ...) -> Self with Self somehow being covariant). Any annotations that suggest otherwise result in a type error in the misc category. But even if that error is explicitly suppressed, mypy will implicitly ignore it.

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

srittau commented Mar 25, 2024

I've marked this PR as deferred for now due to the mypy bug.

@jorenham
Copy link
Author

@srittau I don't quite follow.

Currently, all typecheckers will reject a reversed call, if its argument isn't iterable or a sequence, even if implements __reversed__. The reason why the typetests did not complain here, is because it simply wasn't tested.

This PR makes it so that (presumably) only mypy will incorrectly reject it, due to a bug. But the new tests that I included only fail because of mypy's bug.

So I don't see how deferring this would be any better than mergin this. I believe it's reasonable to ignore mypy's false negatives, since they're directly caused by a known bug.

@srittau
Copy link
Collaborator

srittau commented Mar 25, 2024

The mypy primer output above shows the real-world impact this change has on a selected number of packages. Each green line is a new mypy warning. As you can see, this change unfortunately leads to an excessive amount of new errors. As far as I understand, many reversed(...) calls now return ...[Never], which leads to all the errors above.

@jorenham
Copy link
Author

@srittau ah ok I see. I blindly assumed that "green is good" for some reason 🤷🏻

@jorenham
Copy link
Author

According to the updated typing spec, it is indeed allowed for __new__ to return some non Self type:
https://typing.readthedocs.io/en/latest/spec/constructors.html#new-method

Copy link
Contributor

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

vision (https://github.com/pytorch/vision)
+ torchvision/models/feature_extraction.py:537: error: Need type annotation for "output_nodes"  [var-annotated]
+ torchvision/prototype/models/depth/stereo/raft_stereo.py:192: error: Need type annotation for "i"  [var-annotated]
+ torchvision/prototype/models/depth/stereo/crestereo.py:739: error: Need type annotation for "resolution"  [var-annotated]

python-chess (https://github.com/niklasf/python-chess)
+ chess/__init__.py:2140: error: Need type annotation for "state"  [var-annotated]
+ chess/variant.py:845: error: Need type annotation for "pt"  [var-annotated]

parso (https://github.com/davidhalter/parso)
+ parso/utils.py:54: error: Need type annotation for "index"  [var-annotated]

paroxython (https://github.com/laowantong/paroxython)
+ paroxython/map_taxonomy.py:353: error: Never object is not iterable  [misc]
+ paroxython/map_taxonomy.py:356: error: Cannot determine type of "previous_name"  [has-type]
+ paroxython/map_taxonomy.py:359: error: Cannot determine type of "previous_name"  [has-type]
+ paroxython/map_taxonomy.py:360: error: Cannot determine type of "previous_spans"  [has-type]
+ paroxython/map_taxonomy.py:361: error: Cannot determine type of "previous_spans"  [has-type]

bidict (https://github.com/jab/bidict)
+ bidict/_base.py: note: In member "_update" of class "BidictBase":
+ bidict/_base.py:457:21: error: Never object is not iterable  [misc]
+ bidict/_base.py:458:25: error: Cannot determine type of "fn"  [has-type]
+ bidict/_base.py:458:29: error: Cannot determine type of "args"  [has-type]
+ bidict/_orderedbidict.py: note: In member "__reversed__" of class "_OrderedBidictItemsView":
+ bidict/_orderedbidict.py:120:9: error: Need type annotation for "key"  [var-annotated]

pip (https://github.com/pypa/pip)
+ src/pip/_internal/build_env.py:94: error: Need type annotation for "prefix"  [var-annotated]
+ src/pip/_internal/network/lazy_wheel.py:156: error: Need type annotation for "start"  [var-annotated]
+ src/pip/_internal/resolution/resolvelib/factory.py:323: error: Need type annotation for "ican"  [var-annotated]

itsdangerous (https://github.com/pallets/itsdangerous)
+ src/itsdangerous/signer.py:236: error: Need type annotation for "secret_key"  [var-annotated]

steam.py (https://github.com/Gobot1234/steam.py)
+ steam/gateway.py:767: error: Need type annotation for "idx"  [var-annotated]
+ steam/state.py:119: error: Need type annotation for "item"  [var-annotated]
+ steam/_gc/state.py:165: error: Need type annotation for "idx"  [var-annotated]
+ steam/_gc/client.py:55: error: Need type annotation for "base"  [var-annotated]
+ steam/ext/csgo/models.py:120: error: Need type annotation for "round"  [var-annotated]

prefect (https://github.com/PrefectHQ/prefect)
+ src/prefect/_vendor/starlette/routing.py:247: error: Never object is not iterable  [misc]
+ src/prefect/_vendor/starlette/routing.py:248: error: Cannot determine type of "cls"  [has-type]
+ src/prefect/_vendor/starlette/routing.py:248: error: Cannot determine type of "options"  [has-type]
+ src/prefect/_vendor/starlette/routing.py:344: error: Never object is not iterable  [misc]
+ src/prefect/_vendor/starlette/routing.py:345: error: Cannot determine type of "cls"  [has-type]
+ src/prefect/_vendor/starlette/routing.py:345: error: Cannot determine type of "options"  [has-type]
+ src/prefect/_vendor/starlette/routing.py:413: error: Never object is not iterable  [misc]
+ src/prefect/_vendor/starlette/routing.py:414: error: Cannot determine type of "cls"  [has-type]
+ src/prefect/_vendor/starlette/routing.py:414: error: Cannot determine type of "options"  [has-type]
+ src/prefect/_vendor/starlette/routing.py:681: error: Never object is not iterable  [misc]
+ src/prefect/_vendor/starlette/routing.py:682: error: Cannot determine type of "cls"  [has-type]
+ src/prefect/_vendor/starlette/routing.py:682: error: Cannot determine type of "options"  [has-type]
+ src/prefect/_vendor/starlette/middleware/errors.py:240: error: Need type annotation for "frame"  [var-annotated]
+ src/prefect/_vendor/starlette/applications.py:108: error: Never object is not iterable  [misc]
+ src/prefect/_vendor/starlette/applications.py:109: error: Cannot determine type of "cls"  [has-type]
+ src/prefect/_vendor/starlette/applications.py:109: error: Cannot determine type of "options"  [has-type]
+ src/prefect/_vendor/fastapi/applications.py:215: error: Never object is not iterable  [misc]
+ src/prefect/_vendor/fastapi/applications.py:216: error: Cannot determine type of "cls"  [has-type]
+ src/prefect/_vendor/fastapi/applications.py:216: error: Cannot determine type of "options"  [has-type]
+ src/prefect/utilities/services.py:123: error: Need type annotation for "failures_by_type"  [var-annotated]
+ src/prefect/utilities/services.py:125: error: Value of type Never is not indexable  [index]
+ src/prefect/events/schemas/events.py:147: error: Need type annotation for "related"  [var-annotated]
+ src/prefect/server/events/schemas/events.py:143: error: Need type annotation for "related"  [var-annotated]
+ src/prefect/server/events/clients.py:118: error: Need type annotation for "event"  [var-annotated]

CPython (peg_generator) (https://github.com/python/cpython)
+ Tools/peg_generator/pegen/tokenizer.py:68: error: Need type annotation for "tok"  [var-annotated]

mkdocs (https://github.com/mkdocs/mkdocs)
+ mkdocs/localization.py:76: error: Need type annotation for "theme_dir"  [var-annotated]
+ mkdocs/config/config_options.py:1034: error: Need type annotation for "frame"  [var-annotated]

paasta (https://github.com/yelp/paasta)
+ paasta_tools/mesos_tools.py:637: error: Need type annotation for "non_running_tasks_ordered" (hint: "non_running_tasks_ordered: List[<type>] = ...")  [var-annotated]

manticore (https://github.com/trailofbits/manticore)
+ manticore/wasm/structure.py:1815: error: Need type annotation for "v"  [var-annotated]
+ manticore/wasm/structure.py:1827: error: Need type annotation for "v"  [var-annotated]
+ manticore/wasm/structure.py:1841: error: Need type annotation for "v"  [var-annotated]
+ manticore/wasm/structure.py:1844: error: Incompatible return value type (got "object", expected "I32 | I64 | F32 | F64 | BitVec | Label | Activation | None")  [return-value]
+ manticore/wasm/structure.py:1852: error: Need type annotation for "item"  [var-annotated]
+ manticore/ethereum/abi.py:329: error: Need type annotation for "position"  [var-annotated]

aiortc (https://github.com/aiortc/aiortc)
+ src/aiortc/rtcrtptransceiver.py:118: error: Need type annotation for "codec"  [var-annotated]

pylox (https://github.com/sco1/pylox)
+ pylox/resolver.py:80: error: Need type annotation for "scope"  [var-annotated]

pandas (https://github.com/pandas-dev/pandas)
+ pandas/util/version/__init__.py:533: error: Need type annotation for "_release"  [var-annotated]
+ pandas/io/formats/printing.py:425: error: Need type annotation for "num_items"  [var-annotated]
+ pandas/core/sorting.py:256: error: Need type annotation for "i"  [var-annotated]
+ pandas/core/indexes/multi.py:1638: error: Need type annotation for "i"  [var-annotated]
+ pandas/core/groupby/groupby.py:1289: error: Need type annotation for "name"  [var-annotated]
+ pandas/core/groupby/groupby.py:1289: error: Need type annotation for "lev"  [var-annotated]
+ pandas/core/groupby/groupby.py:1289: error: Need type annotation for "in_axis"  [var-annotated]

mitmproxy (https://github.com/mitmproxy/mitmproxy)
+ mitmproxy/tools/console/common.py:254: error: Need type annotation for "letter"  [var-annotated]

porcupine (https://github.com/Akuli/porcupine)
+ porcupine/textutils.py:314: error: Never object is not iterable  [misc]
+ porcupine/textutils.py:315: error: Cannot determine type of "start"  [has-type]
+ porcupine/textutils.py:315: error: Cannot determine type of "end"  [has-type]
+ porcupine/plugins/underlines.py:76: error: Need type annotation for "tag"  [var-annotated]
+ porcupine/plugins/aboutdialog.py:157: error: Never object is not iterable  [misc]
+ porcupine/plugins/aboutdialog.py:158: error: Cannot determine type of "start"  [has-type]
+ porcupine/plugins/aboutdialog.py:158: error: Cannot determine type of "end"  [has-type]
+ porcupine/plugins/aboutdialog.py:160: error: Cannot determine type of "start"  [has-type]
+ porcupine/plugins/aboutdialog.py:160: error: Cannot determine type of "end"  [has-type]
+ porcupine/plugins/find.py:333: error: Never object is not iterable  [misc]
+ porcupine/plugins/find.py:334: error: Cannot determine type of "i"  [has-type]
+ porcupine/plugins/find.py:336: error: Cannot determine type of "tag"  [has-type]

pylint (https://github.com/pycqa/pylint)
+ pylint/lint/message_state_handler.py:288: error: Need type annotation for "closest_lines"  [var-annotated]
+ pylint/lint/pylinter.py:959: error: Never has no attribute "close"  [attr-defined]
+ pylint/checkers/classes/class_checker.py:924: error: Need type annotation for "c"  [var-annotated]
+ pylint/checkers/refactoring/refactoring_checker.py:110: error: Need type annotation for "token"  [var-annotated]

pwndbg (https://github.com/pwndbg/pwndbg)
+ pwndbg/gdblib/heap_tracking.py: note: In member "malloc" of class "Tracker":
+ pwndbg/gdblib/heap_tracking.py:262: error: Need type annotation for "i"  [var-annotated]

pandera (https://github.com/pandera-dev/pandera)
- pandera/api/dataframe/model.py:328: error: Need type annotation for "attrs" (hint: "attrs: Dict[<type>, <type>] = ...")  [var-annotated]
+ pandera/api/dataframe/model.py:329: error: Need type annotation for "base"  [var-annotated]
+ pandera/api/dataframe/model.py:392: error: Need type annotation for "models" (hint: "models: List[<type>] = ...")  [var-annotated]
+ pandera/api/dataframe/model.py:392: error: Need type annotation for "root_model"  [var-annotated]

sphinx (https://github.com/sphinx-doc/sphinx)
+ sphinx/util/images.py:28:21: error: Never object is not iterable  [misc]
+ sphinx/util/images.py:28:22: error: Cannot determine type of "v"  [has-type]
+ sphinx/util/images.py:28:25: error: Cannot determine type of "k"  [has-type]
+ sphinx/theming.py: note: In member "__init__" of class "Theme":
+ sphinx/theming.py:86:9: error: Need type annotation for "config"  [var-annotated]
+ sphinx/domains/python/__init__.py: note: In function "filter_meta_fields":
+ sphinx/domains/python/__init__.py:503:13: error: Need type annotation for "field"  [var-annotated]
+ sphinx/builders/html/__init__.py: note: In member "copy_theme_static_files" of class "StandaloneHTMLBuilder":
+ sphinx/builders/html/__init__.py:821:13: error: Need type annotation for "entry"  [var-annotated]
+ sphinx/writers/manpage.py: note: In member "apply" of class "NestedInlineTransform":
+ sphinx/writers/manpage.py:61:17: error: Need type annotation for "subnode"  [var-annotated]
+ sphinx/ext/autosummary/__init__.py: note: In function "_import_by_name":
+ sphinx/ext/autosummary/__init__.py:680:9: error: Need type annotation for "j"  [var-annotated]
+ sphinx/builders/latex/transforms.py: note: In member "depart_table" of class "LaTeXFootnoteVisitor":
+ sphinx/builders/latex/transforms.py:441:9: error: Need type annotation for "footnote"  [var-annotated]

aiohttp (https://github.com/aio-libs/aiohttp)
+ aiohttp/web_request.py:907:9: error: Need type annotation for "sublist" (hint: "sublist: List[<type>] = ...")  [var-annotated]
+ aiohttp/web_request.py:907:9: note: See https://mypy.rtfd.io/en/stable/_refs.html#code-var-annotated for more info
+ aiohttp/web_app.py:427:9: error: Need type annotation for "it"  [var-annotated]

mypy (https://github.com/python/mypy)
+ mypy/typestate.py:119: error: Never object is not iterable  [misc]
+ mypy/typestate.py:120: error: Cannot determine type of "l"  [has-type]
+ mypy/typestate.py:120: note: See https://mypy.rtfd.io/en/stable/_refs.html#code-has-type for more info
+ mypy/typestate.py:121: error: Cannot determine type of "r"  [has-type]
+ mypy/typestate.py:127: error: Never object is not iterable  [misc]
+ mypy/typestate.py:128: error: Cannot determine type of "l"  [has-type]
+ mypy/typestate.py:129: error: Cannot determine type of "r"  [has-type]
+ mypy/renaming.py:531: error: Need type annotation for "scope"  [var-annotated]
+ mypy/renaming.py:531: note: See https://mypy.rtfd.io/en/stable/_refs.html#code-var-annotated for more info
+ mypyc/irbuild/prebuildvisitor.py:112: error: Need type annotation for "i"  [var-annotated]
+ mypyc/codegen/emitwrapper.py:921: error: Need type annotation for "i"  [var-annotated]
+ mypyc/codegen/emitclass.py:387: error: Need type annotation for "base"  [var-annotated]
+ mypyc/codegen/emitclass.py:582: error: Need type annotation for "base"  [var-annotated]
+ mypyc/codegen/emitclass.py:733: error: Need type annotation for "base"  [var-annotated]
+ mypyc/codegen/emitclass.py:756: error: Need type annotation for "base"  [var-annotated]
+ mypy/subtypes.py:1138: error: Never object is not iterable  [misc]
+ mypy/subtypes.py:1139: error: Cannot determine type of "l"  [has-type]
+ mypy/subtypes.py:1139: error: Cannot determine type of "r"  [has-type]
+ mypy/constraints.py:298: error: Never object is not iterable  [misc]
+ mypy/constraints.py:299: error: Cannot determine type of "t"  [has-type]
+ mypy/constraints.py:300: error: Cannot determine type of "a"  [has-type]
+ mypy/constraints.py:913: error: Need type annotation for "t"  [var-annotated]
+ mypy/constraints.py:929: error: Need type annotation for "i"  [var-annotated]
+ mypy/semanal_typeddict.py:157: error: Need type annotation for "base"  [var-annotated]
+ mypy/plugins/dataclasses.py:526: error: Need type annotation for "info"  [var-annotated]
+ mypy/semanal.py:2835: error: Need type annotation for "is_comprehension"  [var-annotated]
+ mypy/semanal.py:5090: error: Need type annotation for "table"  [var-annotated]
+ mypy/semanal.py:5773: error: Need type annotation for "table"  [var-annotated]
+ mypy/semanal.py:5775: error: Returning Any from function declared to return "Optional[SymbolTableNode]"  [no-any-return]
+ mypy/semanal.py:5775: note: See https://mypy.rtfd.io/en/stable/_refs.html#code-no-any-return for more info
+ mypy/semanal.py:5795: error: Returning Any from function declared to return "Optional[SymbolTableNode]"  [no-any-return]
+ mypy/semanal.py:6542: error: Need type annotation for "is_comprehension"  [var-annotated]
+ mypy/checker.py:2354: error: Need type annotation for "decorator"  [var-annotated]
+ mypy/checker.py:3019: error: Need type annotation for "frame"  [var-annotated]
+ mypy/checker.py:4928: error: Need type annotation for "d"  [var-annotated]
+ mypy/checker.py:6860: error: Need type annotation for "m"  [var-annotated]
+ mypy/checker.py:6863: error: Need type annotation for "m"  [var-annotated]
+ mypy/checker.py:6865: error: Returning Any from function declared to return "Optional[Type]"  [no-any-return]
+ mypy/checker.py:6869: error: Need type annotation for "m"  [var-annotated]
+ mypy/checker.py:6872: error: Returning Any from function declared to return "Type"  [no-any-return]
+ mypy/checker.py:7058: error: Need type annotation for "scope"  [var-annotated]
+ mypy/checker.py:8011: error: Need type annotation for "e"  [var-annotated]
+ mypy/checker.py:8017: error: Need type annotation for "e"  [var-annotated]
+ mypyc/irbuild/ll_builder.py:1113: error: Need type annotation for "i"  [var-annotated]
+ mypyc/irbuild/env_class.py:184: error: Need type annotation for "i"  [var-annotated]
+ mypyc/irbuild/function.py:560: error: Need type annotation for "d"  [var-annotated]
+ mypyc/irbuild/classdef.py:667: error: Need type annotation for "info"  [var-annotated]
+ mypyc/irbuild/classdef.py:812: error: Need type annotation for "d"  [var-annotated]
+ mypyc/codegen/emitmodule.py:967: error: Need type annotation for "fn"  [var-annotated]

rich (https://github.com/Textualize/rich)
+ rich/markup.py:148: error: Never object is not iterable  [misc]
+ rich/markup.py:149: error: Cannot determine type of "tag"  [has-type]
+ rich/traceback.py:517: error: Need type annotation for "stack"  [var-annotated]

optuna (https://github.com/optuna/optuna)
+ optuna/importance/_fanova/_tree.py:231: error: Need type annotation for "node_index"  [var-annotated]
+ optuna/search_space/intersection.py:36: error: Need type annotation for "trial"  [var-annotated]
+ optuna/samplers/_search_space/intersection.py:87: error: Need type annotation for "trial"  [var-annotated]
+ optuna/samplers/nsgaii/_elite_population_selection_strategy.py:97: error: Need type annotation for "x"  [var-annotated]
+ optuna/samplers/_cmaes.py:619: error: Need type annotation for "trial"  [var-annotated]
+ tests/importance_tests/pedanova_tests/test_evaluator.py:17: error: Need type annotation for "j"  [var-annotated]

antidote (https://github.com/Finistere/antidote)
+ src/antidote/core/_raw/onion.py:116: error: Need type annotation for "release"  [var-annotated]

trio (https://github.com/python-trio/trio)
+ src/trio/_core/_concat_tb.py:127: error: Need type annotation for "head_tb"  [var-annotated]

pytest (https://github.com/pytest-dev/pytest)
+ src/_pytest/_py/path.py:731: error: Need type annotation for "arg"  [var-annotated]
+ src/_pytest/config/__init__.py:654: error: Need type annotation for "parent"  [var-annotated]
+ src/_pytest/config/__init__.py:677: error: Need type annotation for "mod"  [var-annotated]
+ src/_pytest/mark/structures.py:378: error: Need type annotation for "x"  [var-annotated]
+ src/_pytest/fixtures.py:267: error: Need type annotation for "i"  [var-annotated]
+ src/_pytest/terminal.py:789: error: Need type annotation for "line_or_lines"  [var-annotated]
+ src/_pytest/monkeypatch.py:393: error: Never object is not iterable  [misc]
+ src/_pytest/monkeypatch.py:394: error: Cannot determine type of "value"  [has-type]
+ src/_pytest/monkeypatch.py:395: error: Cannot determine type of "obj"  [has-type]
+ src/_pytest/monkeypatch.py:395: error: Cannot determine type of "name"  [has-type]
+ src/_pytest/monkeypatch.py:395: error: Cannot determine type of "value"  [has-type]
+ src/_pytest/monkeypatch.py:397: error: Cannot determine type of "obj"  [has-type]
+ src/_pytest/monkeypatch.py:397: error: Cannot determine type of "name"  [has-type]
+ src/_pytest/monkeypatch.py:403: error: Unused "type: ignore" comment  [unused-ignore]
+ src/_pytest/monkeypatch.py:408: error: Unused "type: ignore" comment  [unused-ignore]
+ src/_pytest/main.py:926: error: Need type annotation for "node"  [var-annotated]
+ src/_pytest/python.py:426: error: Need type annotation for "result" (hint: "result: List[<type>] = ...")  [var-annotated]
+ src/_pytest/setuponly.py:74: error: Argument 1 to "index" of "list" has incompatible type "Scope"; expected Never  [arg-type]

com2ann (https://github.com/ilevkivskyi/com2ann)
+ src/com2ann.py:646: error: Need type annotation for "i"  [var-annotated]
+ src/com2ann.py:674: error: Need type annotation for "arg"  [var-annotated]
+ src/com2ann.py:697: error: Need type annotation for "found" (hint: "found: List[<type>] = ...")  [var-annotated]

scikit-learn (https://github.com/scikit-learn/scikit-learn)
+ sklearn/externals/_packaging/version.py:489: error: Need type annotation for "_release"  [var-annotated]

spack (https://github.com/spack/spack)
+ lib/spack/spack/util/archive.py:162: error: Need type annotation for "parent_dirs"  [var-annotated]
+ lib/spack/spack/util/environment.py:631: error: Need type annotation for "envmod"  [var-annotated]
+ lib/spack/llnl/util/filesystem.py:988: error: Need type annotation for "intermediate_path"  [var-annotated]
+ lib/spack/spack/version/version_types.py:872: error: Need type annotation for "v"  [var-annotated]
+ lib/spack/spack/version/version_types.py:876: error: Need type annotation for "v"  [var-annotated]
+ lib/spack/spack/store.py:267: error: Need type annotation for "install_root"  [var-annotated]
+ lib/spack/spack/config.py:270: error: Need type annotation for "key"  [var-annotated]
+ lib/spack/spack/config.py:459: error: Need type annotation for "generator"  [var-annotated]
+ lib/spack/spack/config.py:937: error: Need type annotation for "component"  [var-annotated]
+ lib/spack/spack/detection/common.py:137: error: Need type annotation for "search_path"  [var-annotated]
+ lib/spack/spack/cmd/buildcache.py:735: error: Need type annotation for "installed_specs_with_deps" (hint: "installed_specs_with_deps': List[<type>] = ...")  [var-annotated]

CPython (Argument Clinic) (https://github.com/python/cpython)
+ Tools/clinic/libclinic/function.py:258: error: Need type annotation for "group"  [var-annotated]
+ Tools/clinic/libclinic/block_parser.py:107: error: Need type annotation for "input"  [var-annotated]
+ Tools/clinic/libclinic/block_parser.py:156: error: Returning Any from function declared to return "str"  [no-any-return]
+ Tools/clinic/libclinic/dsl_parser.py:1248: error: Need type annotation for "p"  [var-annotated]
+ Tools/clinic/libclinic/dsl_parser.py:1316: error: Need type annotation for "last_param"  [var-annotated]
+ Tools/clinic/libclinic/dsl_parser.py:1386: error: Never has no attribute "converter"  [attr-defined]
+ Tools/clinic/libclinic/dsl_parser.py:1388: error: Never has no attribute "is_positional_only"  [attr-defined]
+ Tools/clinic/libclinic/dsl_parser.py:1564: error: Need type annotation for "p"  [var-annotated]
+ Tools/clinic/libclinic/clanguage.py:105: error: Need type annotation for "last_pos"  [var-annotated]
+ Tools/clinic/libclinic/clanguage.py:159: error: Need type annotation for "last_param"  [var-annotated]

pegen (https://github.com/we-like-parsers/pegen)
+ src/pegen/tokenizer.py:68: error: Need type annotation for "tok"  [var-annotated]

pyinstrument (https://github.com/joerick/pyinstrument)
+ pyinstrument/frame.py:242: error: Need type annotation for "frame"  [var-annotated]

isort (https://github.com/pycqa/isort)
+ isort/settings.py:660: error: Need type annotation for "placement"  [var-annotated]
+ isort/deprecated/finders.py:79: error: Need type annotation for "placement"  [var-annotated]

werkzeug (https://github.com/pallets/werkzeug)
+ src/werkzeug/debug/tbtools.py:286: error: Never object is not iterable  [misc]
+ src/werkzeug/debug/tbtools.py:289: error: Cannot determine type of "msg"  [has-type]
+ src/werkzeug/debug/tbtools.py:290: error: Cannot determine type of "msg"  [has-type]
+ src/werkzeug/debug/tbtools.py:292: error: Cannot determine type of "current"  [has-type]

starlette (https://github.com/encode/starlette)
+ starlette/routing.py:243: error: Never object is not iterable  [misc]
+ starlette/routing.py:244: error: Cannot determine type of "cls"  [has-type]
+ starlette/routing.py:244: error: Cannot determine type of "args"  [has-type]
+ starlette/routing.py:244: error: Cannot determine type of "kwargs"  [has-type]
+ starlette/routing.py:339: error: Never object is not iterable  [misc]
+ starlette/routing.py:340: error: Cannot determine type of "cls"  [has-type]
+ starlette/routing.py:340: error: Cannot determine type of "args"  [has-type]
+ starlette/routing.py:340: error: Cannot determine type of "kwargs"  [has-type]
+ starlette/routing.py:407: error: Never object is not iterable  [misc]
+ starlette/routing.py:408: error: Cannot determine type of "cls"  [has-type]
+ starlette/routing.py:408: error: Cannot determine type of "args"  [has-type]
+ starlette/routing.py:408: error: Cannot determine type of "kwargs"  [has-type]
+ starlette/routing.py:677: error: Never object is not iterable  [misc]
+ starlette/routing.py:678: error: Cannot determine type of "cls"  [has-type]
+ starlette/routing.py:678: error: Cannot determine type of "args"  [has-type]
+ starlette/routing.py:678: error: Cannot determine type of "kwargs"  [has-type]
+ starlette/middleware/errors.py:236: error: Need type annotation for "frame"  [var-annotated]
+ starlette/applications.py:108: error: Never object is not iterable  [misc]
+ starlette/applications.py:109: error: Cannot determine type of "cls"  [has-type]
+ starlette/applications.py:109: error: Cannot determine type of "args"  [has-type]
+ starlette/applications.py:109: error: Cannot determine type of "kwargs"  [has-type]

kopf (https://github.com/nolar/kopf)
+ kopf/_kits/webhacks.py:71: error: Need type annotation for "generator"  [var-annotated]

PyWinCtl (https://github.com/Kalmat/PyWinCtl)
+ src/pywinctl/_pywinctl_linux.py:275: error: Need type annotation for "window"  [var-annotated]

dragonchain (https://github.com/dragonchain/dragonchain)
+ dragonchain/lib/interfaces/aws/s3.py:132:5: error: Need type annotation for "x"  [var-annotated]

poetry (https://github.com/python-poetry/poetry)
+ src/poetry/repositories/installed_repository.py:241: error: Need type annotation for "entry"  [var-annotated]
+ src/poetry/mixology/version_solver.py:199: error: Need type annotation for "incompatibility"  [var-annotated]

spark (https://github.com/apache/spark)
+ python/pyspark/util.py:257: error: Never object is not iterable  [misc]
+ python/pyspark/sql/column.py:207: error: Need type annotation for "stack" (hint: "stack: List[<type>] = ...")  [var-annotated]
+ python/pyspark/pandas/base.py:1663: error: Unused "type: ignore" comment  [unused-ignore]

operator (https://github.com/canonical/operator)
+ ops/testing.py:3296: error: Need type annotation for "prefix_len"  [var-annotated]

Tanjun (https://github.com/FasterSpeeding/Tanjun)
+ tanjun/_internal/__init__.py:722: error: Never object is not iterable  [misc]

bandersnatch (https://github.com/pypa/bandersnatch)
+ src/bandersnatch/package.py: note: In member "filter_all_releases_files" of class "Package":
+ src/bandersnatch/package.py:140: error: Need type annotation for "rfindex"  [var-annotated]
+ src/bandersnatch/delete.py: note: In function "delete_simple_page":
+ src/bandersnatch/delete.py:71: error: Need type annotation for "p"  [var-annotated]

mkosi (https://github.com/systemd/mkosi)
+ mkosi/mounts.py:101:33: error: Need type annotation for "p"  [var-annotated]

websockets (https://github.com/aaugustin/websockets)
+ src/websockets/frames.py:272: error: Need type annotation for "extension"  [var-annotated]
+ src/websockets/legacy/framing.py:106: error: Need type annotation for "extension"  [var-annotated]

CPython (cases_generator) (https://github.com/python/cpython)
+ Tools/cases_generator/stack.py:216: error: Need type annotation for "var"  [var-annotated]
+ Tools/cases_generator/uop_metadata_generator.py:53: error: Need type annotation for "var"  [var-annotated]
+ Tools/cases_generator/tier2_generator.py:55: error: Need type annotation for "var"  [var-annotated]
+ Tools/cases_generator/tier2_generator.py:165: error: Need type annotation for "var"  [var-annotated]
+ Tools/cases_generator/tier1_generator.py:42: error: Need type annotation for "var"  [var-annotated]
+ Tools/cases_generator/tier1_generator.py:72: error: Need type annotation for "var"  [var-annotated]
+ Tools/cases_generator/optimizer_generator.py:49: error: Need type annotation for "var"  [var-annotated]
+ Tools/cases_generator/optimizer_generator.py:109: error: Need type annotation for "var"  [var-annotated]

black (https://github.com/psf/black)
+ src/black/lines.py:326:13: error: Need type annotation for "leaf"  [var-annotated]
+ src/black/lines.py:773:5: error: Need type annotation for "element"  [var-annotated]
+ src/black/lines.py:944:5: error: Need type annotation for "leaf"  [var-annotated]
+ src/black/trans.py:1238:17: error: Need type annotation for "leaf"  [var-annotated]
+ src/black/linegen.py:792:5: error: Need type annotation for "leaf"  [var-annotated]
+ src/black/linegen.py:979:5: error: Need type annotation for "leaf"  [var-annotated]

jinja (https://github.com/pallets/jinja)
+ src/jinja2/debug.py:70: error: Never has no attribute "tb_next"  [attr-defined]
+ src/jinja2/environment.py:1486: error: Never object is not iterable  [misc]
+ src/jinja2/environment.py:1487: error: Cannot determine type of "code_line"  [has-type]
+ src/jinja2/environment.py:1488: error: Returning Any from function declared to return "int"  [no-any-return]
+ src/jinja2/environment.py:1488: error: Cannot determine type of "template_line"  [has-type]
+ src/jinja2/ext.py:750: error: Never object is not iterable  [misc]
+ src/jinja2/ext.py:753: error: Cannot determine type of "token_type"  [has-type]
+ src/jinja2/ext.py:755: error: Cannot determine type of "token_value"  [has-type]

ibis (https://github.com/ibis-project/ibis)
+ ibis/common/graph.py:628: error: Argument 1 to "deque" has incompatible type "Iterable[Iterable[Node] | Node]"; expected "Iterable[Node]"  [arg-type]
+ ibis/expr/rules.py:127: error: Need type annotation for "unit"  [var-annotated]

speedrun.com_global_scoreboard_webapp (https://github.com/Avasam/speedrun.com_global_scoreboard_webapp)
+ backend/services/user_updater_helpers.py:156: error: Need type annotation for "run"  [var-annotated]

jax (https://github.com/google/jax)
+ jax/_src/traceback_util.py:76: error: Never object is not iterable  [misc]
+ jax/_src/traceback_util.py:77: error: Cannot determine type of "f"  [has-type]
+ jax/_src/traceback_util.py:78: error: Cannot determine type of "f"  [has-type]
+ jax/_src/traceback_util.py:78: error: Cannot determine type of "lineno"  [has-type]
+ jax/_src/pretty_printer.py:187: error: Need type annotation for "d"  [var-annotated]
+ jax/_src/pretty_printer.py:307: error: Need type annotation for "d"  [var-annotated]
+ jax/_src/interpreters/pxla.py:381: error: Never object is not iterable  [misc]
+ jax/_src/interpreters/pxla.py:382: error: Cannot determine type of "i"  [has-type]
+ jax/_src/interpreters/pxla.py:387: error: Cannot determine type of "name"  [has-type]
+ jax/_src/interpreters/pxla.py:391: error: Cannot determine type of "name"  [has-type]
+ jax/_src/interpreters/pxla.py:392: error: Need type annotation for "name"  [var-annotated]
+ jax/_src/scipy/special.py:479: error: Need type annotation for "p0" (hint: "p0: List[<type>] = ...")  [var-annotated]
+ jax/_src/scipy/special.py:484: error: Need type annotation for "q0" (hint: "q0: List[<type>] = ...")  [var-annotated]
+ jax/_src/scipy/special.py:493: error: Need type annotation for "p1" (hint: "p1: List[<type>] = ...")  [var-annotated]
+ jax/_src/scipy/special.py:502: error: Need type annotation for "q1" (hint: "q1: List[<type>] = ...")  [var-annotated]
+ jax/_src/scipy/special.py:511: error: Need type annotation for "p2" (hint: "p2: List[<type>] = ...")  [var-annotated]
+ jax/_src/scipy/special.py:520: error: Need type annotation for "q2" (hint: "q2: List[<type>] = ...")  [var-annotated]
+ jax/experimental/mesh_utils.py:165: error: Never object is not iterable  [misc]
+ jax/experimental/mesh_utils.py:182: error: Cannot determine type of "logical_axis_size"  [has-type]
+ jax/experimental/mesh_utils.py:183: error: Cannot determine type of "logical_axis_index"  [has-type]
+ jax/experimental/mesh_utils.py:190: error: Cannot determine type of "logical_axis_index"  [has-type]
+ jax/experimental/mesh_utils.py:196: error: Cannot determine type of "logical_axis_size"  [has-type]
+ jax/experimental/mesh_utils.py:201: error: Cannot determine type of "logical_axis_index"  [has-type]
+ jax/experimental/mesh_utils.py:201: error: Cannot determine type of "logical_axis_size"  [has-type]
+ jax/experimental/mesh_utils.py:281: error: Never object is not iterable  [misc]
+ jax/experimental/mesh_utils.py:288: error: Cannot determine type of "logical_axis_size"  [has-type]
+ jax/experimental/mesh_utils.py:302: error: Cannot determine type of "logical_axis"  [has-type]
+ jax/experimental/export/_serialization.py:146: error: Need type annotation for "sc"  [var-annotated]
+ jax/_src/pallas/mosaic/pipeline.py:141: error: Never object is not iterable  [misc]
+ jax/_src/pallas/mosaic/pipeline.py:142: error: Cannot determine type of "index"  [has-type]
+ jax/_src/pallas/mosaic/pipeline.py:143: error: Cannot determine type of "dim_size"  [has-type]

discord.py (https://github.com/Rapptz/discord.py)
+ discord/enums.py:153: error: Need type annotation for "name"  [var-annotated]
- discord/utils.py:724: error: "type" has no attribute "__slots__"  [attr-defined]
+ discord/utils.py:722: error: Need type annotation for "mro"  [var-annotated]
+ discord/reaction.py:264: error: Need type annotation for "raw_user"  [var-annotated]
+ discord/member.py:556: error: Need type annotation for "role"  [var-annotated]
+ discord/member.py:598: error: Need type annotation for "role"  [var-annotated]
+ discord/state.py:510: error: Never has no attribute "id"  [attr-defined]
+ discord/guild.py:2342: error: Need type annotation for "raw_member"  [var-annotated]
+ discord/client.py:494: error: Need type annotation for "idx"  [var-annotated]
+ discord/ui/view.py:166: error: Need type annotation for "base"  [var-annotated]
+ discord/ui/modal.py:109: error: Need type annotation for "base"  [var-annotated]
+ discord/ext/commands/flags.py:305: error: Need type annotation for "base"  [var-annotated]
+ discord/ext/commands/cog.py:212: error: Need type annotation for "base"  [var-annotated]
- discord/ext/commands/cog.py:244: error: Argument 1 to "list" has incompatible type "dict_values[str, _BaseCommand]"; expected "Iterable[Command[Any, [VarArg(Any), KwArg(Any)], Any]]"  [arg-type]
+ discord/ext/commands/cog.py:244: error: Argument 1 to "list" has incompatible type "dict_values[Any, _BaseCommand]"; expected "Iterable[Command[Any, [VarArg(Any), KwArg(Any)], Any]]"  [arg-type]

schemathesis (https://github.com/schemathesis/schemathesis)
+ src/schemathesis/utils.py: note: In function "merge_given_args":
+ src/schemathesis/utils.py:132: error: Need type annotation for "name"  [var-annotated]
+ src/schemathesis/utils.py: note: At top level:
+ src/schemathesis/runner/serialization.py: note: In function "deduplicate_failures":
+ src/schemathesis/runner/serialization.py:430: error: Need type annotation for "check"  [var-annotated]

cwltool (https://github.com/common-workflow-language/cwltool)
+ cwltool/utils.py: note: In member "get_requirement" of class "HasReqsHints":
+ cwltool/utils.py:492:9: error: Need type annotation for "item"  [var-annotated]
+ cwltool/command_line_tool.py: note: In member "job" of class "CommandLineTool":
+ cwltool/command_line_tool.py:897:17: error: Need type annotation for "r"  [var-annotated]

urllib3 (https://github.com/urllib3/urllib3)
+ src/urllib3/util/retry.py:295: error: Never has no attribute "redirect_location"  [attr-defined]
+ src/urllib3/response.py:204: error: Need type annotation for "d"  [var-annotated]
+ test/with_dummyserver/test_socketlevel.py:1805: error: Need type annotation for "i"  [var-annotated]
+ test/with_dummyserver/test_socketlevel.py:1836: error: Need type annotation for "i"  [var-annotated]

bokeh (https://github.com/bokeh/bokeh)
+ src/bokeh/document/callbacks.py: note: In function "_combine_document_events":
+ src/bokeh/document/callbacks.py:472:5: error: Need type annotation for "event"  [var-annotated]

streamlit (https://github.com/streamlit/streamlit)
+ lib/streamlit/runtime/legacy_caching/hashing.py: note: In member "pretty_print" of class "_HashStack":
+ lib/streamlit/runtime/legacy_caching/hashing.py:158:25: error: Need type annotation for "x"  [var-annotated]
+ lib/streamlit/runtime/caching/hashing.py: note: In member "pretty_print" of class "_HashStack":
+ lib/streamlit/runtime/caching/hashing.py:198:25: error: Need type annotation for "x"  [var-annotated]
+ lib/streamlit/elements/form.py: note: In function "_current_form":
+ lib/streamlit/elements/form.py:56:9: error: Need type annotation for "dg"  [var-annotated]
+ lib/streamlit/elements/form.py:58:17: error: Returning Any from function declared to return "Optional[FormData]"  [no-any-return]
+ lib/streamlit/web/cli.py: note: In function "configurator_options":
+ lib/streamlit/web/cli.py:79:5: error: Never object is not iterable  [misc]
+ lib/streamlit/web/cli.py:80:67: error: Cannot determine type of "value"  [has-type]
+ lib/streamlit/web/cli.py:81:12: error: Cannot determine type of "value"  [has-type]
+ lib/streamlit/web/cli.py:88:61: error: Cannot determine type of "value"  [has-type]

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.

incorrect annotations for builtins.reversed
2 participants