forked from python/mypy
-
Notifications
You must be signed in to change notification settings - Fork 1
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
The Final patch #7
Open
tushar-deepsource
wants to merge
120
commits into
base
Choose a base branch
from
final
base: base
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tushar-deepsource
force-pushed
the
final
branch
from
January 20, 2022 17:49
ed5b36c
to
e178323
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Fixes python#10189 Produce an error when encountering a yield expression (both `yield` and `yield from` clauses) in comprehensions and generator expressions. The latter is a syntax error in python 3.8+; see python#10189 and also [python issue 10544](https://bugs.python.org/issue10544).
…n#12047) As far as I can tell, the nugget exposed by this commit lives only in PEP 544. This copies that nugget closer to where it is likely to be spotted by the intended audience. PEPs may not be accessible to customers who reasonably expect relevant information to be surfaced in featured documentation. Even if customers are aware of PEPs, they may not think to look there, and don't likely consider them primary sources. It is reasonable to assume that is the job of the docs, with PEPs capturing more esoteric nuances, rationales and other then-relevant details of decision-making, etc. It's also reasonable to expect that where further study may be helpful, links from relevant sections of primary sources to secondary materials like PEPs should exist. This commit fills in both gaps for the subject shorthand.
When we erase last known values in an union with multiple Instance types, make sure that the resulting union doesn't have duplicate erased types. The duplicate items weren't incorrect as such, but they could cause overly complex error messages and potentially slow type checking performance. This is one of the fixes extracted from python#12054. Since some of the changes may cause regressions, it's better to split the PR. Work on python#12051. Co-authored-by: Nikita Sobolev <[email protected]>
Make the join of a union type and Any commutative. Previously the result depended on the order of the operands, which was clearly incorrect. Fix python#12051, but other use cases are affected as well. This change was split off from python#12054.
If we change the error code of a message, it can result in existing "type: ignore" comments being ignored. If this seems to be the case, add a note that hints about changing the ignored error code. Give a more specific message for a set of special cased error codes where we know the original error code. In other cases give a more vague message.
Co-authored-by: Mehdi Drissi <[email protected]>
### Description This PR allows users to define overloads conditionally, e.g., based on the Python version. At the moment this is only possible if all overloads are contained in the same block which requires duplications. ```py from typing import overload, Any import sys class A: ... class B: ... if sys.version_info >= (3, 9): class C: ... @overload def func(g: int) -> A: ... @overload def func(g: bytes) -> B: ... if sys.version_info >= (3, 9): @overload def func(g: str) -> C: ... def func(g: Any) -> Any: ... ``` Closes python#9744 ## Test Plan Unit tests have been added. ## Limitations Only `if` is supported. Support for `elif` and `else` might be added in the future. However, I believe that the single if as shown in the example is also the most common use case. The change itself is fully backwards compatible, i.e. the current workaround (see below) will continue to function as expected. ~~**Update**: Seems like support for `elif` and `else` is required for the tests to pass.~~ **Update**: Added support for `elif` and `else`. ## Current workaround ```py from typing import overload, Any import sys class A: ... class B: ... if sys.version_info >= (3, 9): class C: ... if sys.version_info >= (3, 9): @overload def func(g: int) -> A: ... @overload def func(g: bytes) -> B: ... @overload def func(g: str) -> C: ... def func(g: Any) -> Any: ... else: @overload def func(g: int) -> A: ... @overload def func(g: bytes) -> B: ... def func(g: Any) -> Any: ... ```
Fixes python#11019 `run_stubtest` creates temp directory and prepend `sys.path` with relative path (dot `.`) wrongly assuming that the dot will be resolved to absolute path on *every* import attempt. But in Python dot(`.`) in sys.path is actually resolved by PathFinder and cached in `sys.path_importer_cache` like: ``` sys.path_importer_cache['.'] FileFinder('/somepath/.') ``` later calls for `find_module` return None and import of `test_module` fails. This resulted in only the first test in stubtest's suite passed in non-pytest-xdist environments. This issue was hidden with bug or feature in pytest-xdist < 2.3.0: pytest-dev/pytest-xdist#421 It was fixed in pytest-xdist 2.3.0: pytest-dev/pytest-xdist#667 - sys.path for pytest-xdist < 2.3.0 `'.', 'project_path', ''` - sys.path for pytest-xdist >= 2.3.0 or without xdist `'.', 'project_path'` In Python for denoting cwd the empty path `''` can be used as a special case, but for readability `sys.path` is prepended with resolved absolute path of temp directory. Also it's essential to restore back `sys.path` after a test to not break subsequent tests. Signed-off-by: Stanislav Levin <[email protected]>
Basically a follow up to python#12282 Co-authored-by: hauntsaninja <>
…hon#12293) This reverts commit 777885f. To help with python/typeshed#7441 and reduce risk of stubtest issues interfering with a mypy release. The extra type correctness here is really minimal. Co-authored-by: hauntsaninja <>
This isn't actually a reversion. This logic was asymmetrical for reasons lost to time. Although I suspect it was this way because the delta only a few errors on typeshed. What changed was that as a result of python#12203 we actually started checking a lot more dunder methods. Previously, we only checked dunders if either: a) it was a special dunder, like `__init__` or `__call__`, or b) the dunder was defined on the actual stub class itself In particular, we started checking every dunder redefined at runtime that the stub just inherited from object. A possible intermediate option would be to not check positional-only arguments in the case where a stub inherits the definition. I'll experiment with that once typeshed CI is green. Co-authored-by: hauntsaninja <>
PRs that only affect stubtest or stubgen are never going to have any effect on mypy_primer's output, so we can safely skip the CI check for those PRs. The same goes for PRs that only alter files in the tests directory.
Closes python#12010. Mypy can now detect if a match statement covers all the possible values. Example: ``` def f(x: int | str) -> int: match x: case str(): return 0 case int(): return 1 # Mypy knows that we can't reach here ``` Most of the work was done by @freundTech. I did various minor updates and changes to tests. This doesn't handle some cases properly, including these: 1. We don't recognize that `match [*args]` fully covers a list type 2. Fake intersections don't work quite right (some tests are skipped) 3. We assume enums don't have custom `__eq__` methods Co-authored-by: Adrian Freund <[email protected]>
* Some minor documentation updates * Add more discussion of exhaustiveness checking * Update docs/source/literal_types.rst * Simplify docs for legacy async Co-authored-by: Jelle Zijlstra <[email protected]>
…age.pyi` (python#7022) (python#12340) Co-authored-by: Chris Rose <[email protected]>
Don't merge conditional FuncDef after an unconditional one.
Allow subclasses to override `__match_args__` freely, and don't require `__match_args__` to be final. This matches runtime behavior. For example, if `B` subclasses `A`, `case A(...)` also matches instances of `B`, using the `__match_args__` from `A`. The issue was brough up by @AlexWaygood in python#12411 (comment).
Allows any dunder (`__name__`) attributes except `__members__` (due to it being read-only) to be overridden in enum subclasses. Fixes python#12132.
Multiple inheritance from dataclasses and attrs classes works at runtime, so don't complain about `__match_args__` or `__attrs_attrs__` which tend to have incompatible types in subclasses. Fixes python#12349. Fixes python#12008. Fixes python#12065.
Various things can go wrong if the order of modules in the builtins SCC that also includes typing, _typeshed and others is adjusted. Hopefully fixes python#12422. May also fix python#12421.
…n#12435) A wider return type can be useful if a decorator used for the overload implementation gets a more precise return type as part of a typeshed update. Closes python#12434.
Diff from mypy_primer, showing the effect of this PR on open source code: ignite (https://github.com/pytorch/ignite)
- ignite/engine/events.py:141: error: Definition of "name" in base class "CallableEventWithFilter" is incompatible with definition in base class "Enum" [misc]
- ignite/engine/deterministic.py:227: error: unused "type: ignore" comment
+ ignite/engine/deterministic.py:227: error: Unused "type: ignore" comment
- ignite/engine/deterministic.py:254: error: unused "type: ignore" comment
+ ignite/engine/deterministic.py:254: error: Unused "type: ignore" comment
- ignite/engine/deterministic.py:259: error: unused "type: ignore" comment
+ ignite/engine/deterministic.py:259: error: Unused "type: ignore" comment
- ignite/distributed/auto.py:308: error: unused "type: ignore" comment
+ ignite/distributed/auto.py:308: error: Unused "type: ignore" comment
- ignite/distributed/auto.py:353: error: unused "type: ignore" comment
+ ignite/distributed/auto.py:353: error: Unused "type: ignore" comment
- ignite/metrics/ssim.py:186: error: unused "type: ignore" comment
+ ignite/metrics/ssim.py:186: error: Unused "type: ignore" comment
- ignite/metrics/precision.py:50: error: unused "type: ignore" comment
+ ignite/metrics/precision.py:50: error: Unused "type: ignore" comment
- ignite/metrics/precision.py:51: error: unused "type: ignore" comment
+ ignite/metrics/precision.py:51: error: Unused "type: ignore" comment
- ignite/engine/__init__.py:372: error: unused "type: ignore" comment
+ ignite/engine/__init__.py:372: error: Unused "type: ignore" comment
- ignite/handlers/param_scheduler.py:851: error: unused "type: ignore" comment
+ ignite/handlers/param_scheduler.py:851: error: Unused "type: ignore" comment
- ignite/handlers/param_scheduler.py:858: error: unused "type: ignore" comment
+ ignite/handlers/param_scheduler.py:858: error: Unused "type: ignore" comment
- ignite/handlers/param_scheduler.py:864: error: unused "type: ignore" comment
+ ignite/handlers/param_scheduler.py:864: error: Unused "type: ignore" comment
- ignite/handlers/param_scheduler.py:866: error: unused "type: ignore" comment
+ ignite/handlers/param_scheduler.py:866: error: Unused "type: ignore" comment
- ignite/handlers/param_scheduler.py:900: error: unused "type: ignore" comment
+ ignite/handlers/param_scheduler.py:900: error: Unused "type: ignore" comment
- ignite/handlers/param_scheduler.py:913: error: unused "type: ignore" comment
+ ignite/handlers/param_scheduler.py:913: error: Unused "type: ignore" comment
- ignite/handlers/param_scheduler.py:1391: error: unused "type: ignore" comment
+ ignite/handlers/param_scheduler.py:1391: error: Unused "type: ignore" comment
- ignite/handlers/param_scheduler.py:1396: error: unused "type: ignore" comment
+ ignite/handlers/param_scheduler.py:1396: error: Unused "type: ignore" comment
- ignite/handlers/param_scheduler.py:1398: error: unused "type: ignore" comment
+ ignite/handlers/param_scheduler.py:1398: error: Unused "type: ignore" comment
- ignite/handlers/param_scheduler.py:1405: error: unused "type: ignore" comment
+ ignite/handlers/param_scheduler.py:1405: error: Unused "type: ignore" comment
- ignite/handlers/param_scheduler.py:1529: error: unused "type: ignore" comment
+ ignite/handlers/param_scheduler.py:1529: error: Unused "type: ignore" comment
- ignite/handlers/param_scheduler.py:1549: error: unused "type: ignore" comment
+ ignite/handlers/param_scheduler.py:1549: error: Unused "type: ignore" comment
- ignite/handlers/param_scheduler.py:1550: error: unused "type: ignore" comment
+ ignite/handlers/param_scheduler.py:1550: error: Unused "type: ignore" comment
- ignite/handlers/lr_finder.py:498: error: unused "type: ignore" comment
+ ignite/handlers/lr_finder.py:498: error: Unused "type: ignore" comment
- ignite/handlers/lr_finder.py:499: error: unused "type: ignore" comment
+ ignite/handlers/lr_finder.py:499: error: Unused "type: ignore" comment
- ignite/contrib/handlers/wandb_logger.py:138: error: unused "type: ignore" comment
+ ignite/contrib/handlers/wandb_logger.py:138: error: Unused "type: ignore" comment
+ ignite/contrib/handlers/visdom_logger.py:188: error: Unused "type: ignore" comment
+ ignite/contrib/handlers/visdom_logger.py:196: error: Unused "type: ignore" comment
+ ignite/contrib/handlers/visdom_logger.py:241: error: Unused "type: ignore" comment
- ignite/contrib/handlers/tensorboard_logger.py:155: error: unused "type: ignore" comment
+ ignite/contrib/handlers/tensorboard_logger.py:155: error: Unused "type: ignore" comment
+ ignite/contrib/handlers/tensorboard_logger.py:155: note: Error code "import" not covered by "type: ignore" comment
- ignite/contrib/handlers/visdom_logger.py:188: error: unused "type: ignore" comment
- ignite/contrib/handlers/visdom_logger.py:196: error: unused "type: ignore" comment
- ignite/contrib/handlers/visdom_logger.py:241: error: unused "type: ignore" comment
bidict (https://github.com/jab/bidict)
- bidict/_bidict.py:138: error: unused "type: ignore" comment
graphql-core (https://github.com/graphql-python/graphql-core)
- src/graphql/utilities/extend_schema.py:644: error: TypedDict key must be a string literal; expected one of ("query", "mutation", "subscription", "types", "directives", ...)
- src/graphql/execution/execute.py:216: error: unused "type: ignore" comment
- src/graphql/execution/execute.py:217: error: unused "type: ignore" comment
- src/graphql/execution/execute.py:218: error: unused "type: ignore" comment
- src/graphql/execution/execute.py:796: error: unused "type: ignore" comment
- tests/execution/test_union_interface.py:69: error: unused "type: ignore" comment
- tests/execution/test_union_interface.py:75: error: unused "type: ignore" comment
- tests/execution/test_union_interface.py:76: error: unused "type: ignore" comment
- tests/execution/test_union_interface.py:77: error: unused "type: ignore" comment
- tests/execution/test_union_interface.py:87: error: unused "type: ignore" comment
- tests/execution/test_union_interface.py:88: error: unused "type: ignore" comment
- tests/execution/test_union_interface.py:89: error: unused "type: ignore" comment
- tests/execution/test_union_interface.py:100: error: unused "type: ignore" comment
- tests/execution/test_union_interface.py:101: error: unused "type: ignore" comment
- tests/execution/test_union_interface.py:102: error: unused "type: ignore" comment
- tests/execution/test_union_interface.py:127: error: unused "type: ignore" comment
- tests/execution/test_union_interface.py:128: error: unused "type: ignore" comment
- tests/execution/test_union_interface.py:129: error: unused "type: ignore" comment
python-sop (https://gitlab.com/dkg/python-sop)
+ sop/__init__.py:224: error: Missing type parameters for generic type "_SubParsersAction"
+ sop/__init__.py:387: error: Missing type parameters for generic type "_SubParsersAction"
mypy_primer (https://github.com/hauntsaninja/mypy_primer)
- mypy_primer.py:118: error: "BinaryIO" has no attribute "raw"
- mypy_primer.py:118: error: Returning Any from function declared to return "object"
- mypy_primer.py:119: error: unused "type: ignore" comment
poetry (https://github.com/python-poetry/poetry)
- src/poetry/packages/locker.py:342: error: Argument 3 to "get_extra_package_names" has incompatible type "Union[bool, Sequence[str]]"; expected "Sequence[str]" [arg-type]
paasta (https://github.com/yelp/paasta)
- paasta_tools/kubernetes_tools.py:2269: error: Need type annotation for "stream_lines"
- paasta_tools/metrics/metastatus_lib.py:672: error: Argument "key" to "sorted" has incompatible type "Callable[[Any], Sequence[Tuple[str, str]]]"; expected "Callable[[_SlaveT], SupportsLessThan]"
+ paasta_tools/metrics/metastatus_lib.py:672: error: Argument "key" to "sorted" has incompatible type "Callable[[Any], Sequence[Tuple[str, str]]]"; expected "Callable[[_SlaveT], Union[SupportsDunderLT, SupportsDunderGT]]"
- paasta_tools/metrics/metastatus_lib.py:672: error: Argument "key" to "sorted" has incompatible type "Callable[[Any], Sequence[Tuple[str, str]]]"; expected "Callable[[Any], SupportsLessThan]"
+ paasta_tools/metrics/metastatus_lib.py:672: error: Argument "key" to "sorted" has incompatible type "Callable[[Any], Sequence[Tuple[str, str]]]"; expected "Callable[[Any], Union[SupportsDunderLT, SupportsDunderGT]]"
pandera (https://github.com/pandera-dev/pandera)
- pandera/model.py:421: error: Need type annotation for "config" [var-annotated]
SinbadCogs (https://github.com/mikeshardmind/SinbadCogs)
- devtools/patches.py:22: error: unused "type: ignore" comment
+ devtools/patches.py:22: error: Unused "type: ignore" comment
- devtools/patches.py:30: error: unused "type: ignore" comment
+ devtools/patches.py:30: error: Unused "type: ignore" comment
- devtools/runner.py:26: error: unused "type: ignore" comment
+ devtools/runner.py:26: error: Unused "type: ignore" comment
- scheduler/message.py:87: error: unused "type: ignore" comment
+ scheduler/message.py:87: error: Unused "type: ignore" comment
- scheduler/message.py:89: error: unused "type: ignore" comment
+ scheduler/message.py:89: error: Unused "type: ignore" comment
- scheduler/message.py:111: error: unused "type: ignore" comment
+ scheduler/message.py:111: error: Unused "type: ignore" comment
- rolemanagement/core.py:800: error: unused "type: ignore" comment
+ rolemanagement/core.py:800: error: Unused "type: ignore" comment
- anticommandspam/core.py:136: error: unused "type: ignore" comment
+ anticommandspam/core.py:136: error: Unused "type: ignore" comment
- scheduler/scheduler.py:116: error: unused "type: ignore" comment
+ scheduler/scheduler.py:116: error: Unused "type: ignore" comment
- scheduler/__init__.py:31: error: unused "type: ignore" comment
+ scheduler/__init__.py:31: error: Unused "type: ignore" comment
rotki (https://github.com/rotki/rotki)
- rotkehlchen/api/v1/parser.py:62: error: unused "type: ignore" comment
+ rotkehlchen/api/v1/parser.py:62: error: Unused "type: ignore" comment
- rotkehlchen/api/v1/parser.py:63: error: unused "type: ignore" comment
+ rotkehlchen/api/v1/parser.py:63: error: Unused "type: ignore" comment
- rotkehlchen/api/v1/parser.py:72: error: unused "type: ignore" comment
+ rotkehlchen/api/v1/parser.py:72: error: Unused "type: ignore" comment
- rotkehlchen/api/v1/parser.py:89: error: unused "type: ignore" comment
+ rotkehlchen/api/v1/parser.py:89: error: Unused "type: ignore" comment
- rotkehlchen/api/v1/parser.py:131: error: unused "type: ignore" comment
+ rotkehlchen/api/v1/parser.py:131: error: Unused "type: ignore" comment
- rotkehlchen/utils/hexbytes.py:72: error: unused "type: ignore" comment
+ rotkehlchen/utils/hexbytes.py:72: error: Unused "type: ignore" comment
- rotkehlchen/chain/ethereum/abi.py:71: error: unused "type: ignore" comment
+ rotkehlchen/chain/ethereum/abi.py:71: error: Unused "type: ignore" comment
- rotkehlchen/chain/ethereum/abi.py:83: error: unused "type: ignore" comment
+ rotkehlchen/chain/ethereum/abi.py:83: error: Unused "type: ignore" comment
- rotkehlchen/chain/ethereum/contracts.py:104: error: unused "type: ignore" comment
+ rotkehlchen/chain/ethereum/contracts.py:104: error: Unused "type: ignore" comment
- rotkehlchen/chain/ethereum/decoding/decoder.py:115: error: Module has no attribute "__path__"
- rotkehlchen/serialization/serialize.py:210: error: unused "type: ignore" comment
+ rotkehlchen/serialization/serialize.py:210: error: Unused "type: ignore" comment
- rotkehlchen/chain/ethereum/manager.py:109: error: unused "type: ignore" comment
+ rotkehlchen/chain/ethereum/manager.py:109: error: Unused "type: ignore" comment
- rotkehlchen/chain/ethereum/manager.py:579: error: unused "type: ignore" comment
+ rotkehlchen/chain/ethereum/manager.py:579: error: Unused "type: ignore" comment
- rotkehlchen/chain/ethereum/manager.py:809: error: unused "type: ignore" comment
+ rotkehlchen/chain/ethereum/manager.py:809: error: Unused "type: ignore" comment
- rotkehlchen/chain/ethereum/manager.py:831: error: unused "type: ignore" comment
+ rotkehlchen/chain/ethereum/manager.py:831: error: Unused "type: ignore" comment
- rotkehlchen/chain/ethereum/manager.py:980: error: unused "type: ignore" comment
+ rotkehlchen/chain/ethereum/manager.py:980: error: Unused "type: ignore" comment
- rotkehlchen/chain/avalanche/manager.py:94: error: unused "type: ignore" comment
+ rotkehlchen/chain/avalanche/manager.py:94: error: Unused "type: ignore" comment
- rotkehlchen/chain/avalanche/manager.py:113: error: unused "type: ignore" comment
+ rotkehlchen/chain/avalanche/manager.py:113: error: Unused "type: ignore" comment
- rotkehlchen/api/v1/fields.py:67: error: unused "type: ignore" comment
+ rotkehlchen/api/v1/fields.py:67: error: Unused "type: ignore" comment
- rotkehlchen/api/v1/schemas.py:1561: error: unused "type: ignore" comment
+ rotkehlchen/api/v1/schemas.py:1561: error: Unused "type: ignore" comment
- rotkehlchen/api/v1/schemas.py:1572: error: unused "type: ignore" comment
+ rotkehlchen/api/v1/schemas.py:1572: error: Unused "type: ignore" comment
- rotkehlchen/api/v1/schemas.py:1681: error: unused "type: ignore" comment
+ rotkehlchen/api/v1/schemas.py:1681: error: Unused "type: ignore" comment
- rotkehlchen/api/v1/resources.py:171: error: unused "type: ignore" comment
+ rotkehlchen/api/v1/resources.py:171: error: Unused "type: ignore" comment
- rotkehlchen/api/v1/resources.py:186: error: unused "type: ignore" comment
+ rotkehlchen/api/v1/resources.py:186: error: Unused "type: ignore" comment
- rotkehlchen/api/v1/resources.py:192: error: unused "type: ignore" comment
+ rotkehlchen/api/v1/resources.py:192: error: Unused "type: ignore" comment
- rotkehlchen/api/v1/resources.py:196: error: unused "type: ignore" comment
+ rotkehlchen/api/v1/resources.py:196: error: Unused "type: ignore" comment
- rotkehlchen/api/v1/resources.py:208: error: unused "type: ignore" comment
+ rotkehlchen/api/v1/resources.py:208: error: Unused "type: ignore" comment
- rotkehlchen/api/v1/resources.py:209: error: unused "type: ignore" comment
+ rotkehlchen/api/v1/resources.py:209: error: Unused "type: ignore" comment
- rotkehlchen/api/v1/resources.py:217: error: unused "type: ignore" comment
+ rotkehlchen/api/v1/resources.py:217: error: Unused "type: ignore" comment
- rotkehlchen/api/v1/resources.py:218: error: unused "type: ignore" comment
+ rotkehlchen/api/v1/resources.py:218: error: Unused "type: ignore" comment
+ rotkehlchen/api/v1/resources.py:1957: error: Untyped decorator makes function "delete" untyped
- rotkehlchen/api/v1/resources.py:1957: note: (Skipping most remaining errors due to unresolved imports or missing stubs; fix these first)
+ rotkehlchen/api/v1/resources.py:1981: note: (Skipping most remaining errors due to unresolved imports or missing stubs; fix these first)
arviz (https://github.com/arviz-devs/arviz)
+ arviz/data/io_pymc3_3x.py:47: error: Unused "type: ignore" comment
+ arviz/data/io_pymc3_3x.py:48: error: Unused "type: ignore" comment
- doc/sphinxext/gallery_generator.py:375: error: Call to untyped function "rc_context" in typed context
- doc/sphinxext/gallery_generator.py:378: error: Function is missing a return type annotation
- doc/sphinxext/gallery_generator.py:391: note: (Skipping most remaining errors due to unresolved imports or missing stubs; fix these first)
+ doc/sphinxext/gallery_generator.py:375: note: (Skipping most remaining errors due to unresolved imports or missing stubs; fix these first)
pydantic (https://github.com/samuelcolvin/pydantic)
- pydantic/typing.py:190: error: "classmethod" expects no type arguments, but 1 given [type-arg]
- pydantic/validators.py:503: error: unused "type: ignore" comment
- pydantic/networks.py:268: error: unused "type: ignore" comment
+ pydantic/networks.py:268: error: Unused "type: ignore" comment
+ pydantic/networks.py:268: note: Error code "misc" not covered by "type: ignore" comment
- pydantic/networks.py:313: error: unused "type: ignore" comment
+ pydantic/networks.py:313: error: Unused "type: ignore" comment
+ pydantic/networks.py:313: note: Error code "misc" not covered by "type: ignore" comment
- pydantic/networks.py:314: error: unused "type: ignore" comment
+ pydantic/networks.py:314: error: Unused "type: ignore" comment
+ pydantic/networks.py:314: note: Error code "misc" not covered by "type: ignore" comment
- pydantic/mypy.py:60: error: unused "type: ignore" comment
+ pydantic/mypy.py:60: error: Unused "type: ignore" comment
- pydantic/mypy.py:363: error: unused "type: ignore" comment
+ pydantic/mypy.py:363: error: Unused "type: ignore" comment
- pydantic/mypy.py:739: error: unused "type: ignore" comment
+ pydantic/mypy.py:739: error: Unused "type: ignore" comment
- pydantic/_hypothesis_plugin.py:67: error: unused "type: ignore" comment
+ pydantic/_hypothesis_plugin.py:67: error: Unused "type: ignore" comment
- pydantic/_hypothesis_plugin.py:71: error: unused "type: ignore" comment
+ pydantic/_hypothesis_plugin.py:71: error: Unused "type: ignore" comment
- pydantic/_hypothesis_plugin.py:79: error: unused "type: ignore" comment
+ pydantic/_hypothesis_plugin.py:79: error: Unused "type: ignore" comment
- pydantic/_hypothesis_plugin.py:138: error: unused "type: ignore" comment
+ pydantic/_hypothesis_plugin.py:138: error: Unused "type: ignore" comment
- pydantic/_hypothesis_plugin.py:152: error: unused "type: ignore" comment
+ pydantic/_hypothesis_plugin.py:152: error: Unused "type: ignore" comment
- pydantic/_hypothesis_plugin.py:155: error: unused "type: ignore" comment
+ pydantic/_hypothesis_plugin.py:155: error: Unused "type: ignore" comment
- pydantic/_hypothesis_plugin.py:159: error: unused "type: ignore" comment
+ pydantic/_hypothesis_plugin.py:159: error: Unused "type: ignore" comment
- pydantic/_hypothesis_plugin.py:174: error: unused "type: ignore" comment
+ pydantic/_hypothesis_plugin.py:174: error: Unused "type: ignore" comment
- pydantic/_hypothesis_plugin.py:196: error: unused "type: ignore" comment
+ pydantic/_hypothesis_plugin.py:196: error: Unused "type: ignore" comment
- pydantic/_hypothesis_plugin.py:203: error: unused "type: ignore" comment
+ pydantic/_hypothesis_plugin.py:203: error: Unused "type: ignore" comment
- pydantic/_hypothesis_plugin.py:223: error: unused "type: ignore" comment
+ pydantic/_hypothesis_plugin.py:223: error: Unused "type: ignore" comment
rich (https://github.com/willmcgugan/rich)
- usage: mypy [-h] [-v] [-V] [more options; see below]
- [-m MODULE] [-p PACKAGE] [-c PROGRAM_TEXT] [files ...]
- mypy: error: Invalid error code(s): ignore-without-code
+ rich/style.py:726: error: Statement is unreachable [unreachable]
+ rich/_win32_console.py:15: error: Statement is unreachable [unreachable]
+ rich/_windows.py:25: error: Statement is unreachable [unreachable]
+ rich/_windows.py:41: error: Statement is unreachable [unreachable]
+ rich/live.py:172: error: Subclass of "TextIO" and "FileProxy" cannot exist: would have incompatible method signatures [misc]
+ rich/live.py:175: error: Subclass of "TextIO" and "FileProxy" cannot exist: would have incompatible method signatures [misc]
mypy (https://github.com/python/mypy)
- mypy/fscache.py:147: error: No overload variant of "list" matches argument type "stat_result" [call-overload]
- mypy/fscache.py:147: note: Possible overload variants:
- mypy/fscache.py:147: note: def [_T] __init__(self) -> List[_T]
- mypy/fscache.py:147: note: def [_T] __init__(self, iterable: Iterable[_T]) -> List[_T]
- mypy/fscache.py:152: error: Argument 1 to "stat_result" has incompatible type "List[float]"; expected "Tuple[int, ...]" [arg-type]
- mypy/stubtest.py:227: error: Module has no attribute "__all__" [attr-defined]
+ /tmp/mypy_primer/projects/mypy/mypy/types.py:272: 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: 0.942
+ Traceback (most recent call last):
+ File "", line 8, in <module>
+ sys.exit(console_entry())
+ File "/__main__.py", line 12, in console_entry
+ main(None, sys.stdout, sys.stderr)
+ File "/main.py", line 96, in main
+ res, messages, blockers = run_build(sources, options, fscache, t0, stdout, stderr)
+ File "/main.py", line 173, in run_build
+ res = build.build(sources, options, None, flush_errors, fscache, stdout, stderr)
+ File "/build.py", line 180, in build
+ result = _build(
+ File "/build.py", line 256, in _build
+ graph = dispatch(sources, manager, stdout)
+ File "/build.py", line 2727, in dispatch
+ process_graph(graph, manager)
+ File "/build.py", line 3075, in process_graph
+ process_stale_scc(graph, scc, manager)
+ File "/build.py", line 3173, in process_stale_scc
+ graph[id].type_check_first_pass()
+ File "/build.py", line 2186, in type_check_first_pass
+ self.type_checker().check_first_pass()
+ File "/checker.py", line 318, in check_first_pass
+ self.accept(d)
+ File "/checker.py", line 424, in accept
+ stmt.accept(self)
+ File "/nodes.py", line 1022, in accept
+ return visitor.visit_class_def(self)
+ File "/checker.py", line 1798, in visit_class_def
+ self.accept(defn.defs)
+ File "/checker.py", line 424, in accept
+ stmt.accept(self)
+ File "/nodes.py", line 1091, in accept
+ return visitor.visit_block(self)
+ File "/checker.py", line 2156, in visit_block
+ self.accept(s)
+ File "/checker.py", line 424, in accept
+ stmt.accept(self)
+ File "/nodes.py", line 741, in accept
+ return visitor.visit_func_def(self)
+ File "/checker.py", line 775, in visit_func_def
+ self._visit_func_def(defn)
+ File "/checker.py", line 779, in _visit_func_def
+ self.check_func_item(defn, name=defn.name)
+ File "/checker.py", line 841, in check_func_item
+ self.check_func_def(defn, typ, name)
+ File "/checker.py", line 1026, in check_func_def
+ self.accept(item.body)
+ File "/checker.py", line 424, in accept
+ stmt.accept(self)
+ File "/nodes.py", line 1091, in accept
+ return visitor.visit_block(self)
+ File "/checker.py", line 2156, in visit_block
+ self.accept(s)
+ File "/checker.py", line 424, in accept
+ stmt.accept(self)
+ File "/nodes.py", line 1315, in accept
+ return visitor.visit_if_stmt(self)
+ File "/checker.py", line 3546, in visit_if_stmt
+ self.accept(b)
+ File "/checker.py", line 424, in accept
+ stmt.accept(self)
+ File "/nodes.py", line 1091, in accept
+ return visitor.visit_block(self)
+ File "/checker.py", line 2156, in visit_block
+ self.accept(s)
+ File "/checker.py", line 424, in accept
+ stmt.accept(self)
+ File "/nodes.py", line 1263, in accept
+ return visitor.visit_assert_stmt(self)
+ File "/checker.py", line 3588, in visit_assert_stmt
+ self.expr_checker.accept(s.expr)
+ File "/checkexpr.py", line 3978, in accept
+ typ = node.accept(self)
+ File "/nodes.py", line 1752, in accept
+ return visitor.visit_call_expr(self)
+ File "/checkexpr.py", line 288, in visit_call_expr
+ return self.visit_call_expr_inner(e, allow_none_return=allow_none_return)
+ File "/checkexpr.py", line 371, in visit_call_expr_inner
+ ret_type = self.check_call_expr_with_callee_type(callee_type, e, fullname,
+ File "/checkexpr.py", line 880, in check_call_expr_with_callee_type
+ return self.check_call(callee_type, e.args, e.arg_kinds, e,
+ File "/checkexpr.py", line 940, in check_call
+ return self.check_callable_call(callee, args, arg_kinds, context, arg_names,
+ File "/checkexpr.py", line 1070, in check_callable_call
+ new_ret_type = self.apply_function_plugin(
+ File "/checkexpr.py", line 751, in apply_function_plugin
+ return callback(
+ File "/misc/proper_plugin.py", line 46, in isinstance_proper_hook
+ ctx.api.fail('Never apply isinstance() to unexpanded types;'
+ File "/checker.py", line 5501, in fail
+ self.msg.fail(msg, context)
+ File "/messages.py", line 201, in fail
+ self.report(msg.value, context, 'error', code=msg.code, file=file,
+ AttributeError: 'str' object has no attribute 'value'
starlette (https://github.com/encode/starlette)
- starlette/concurrency.py:36: error: Name "P.args" is not defined [name-defined]
- starlette/concurrency.py:36: error: Name "P.kwargs" is not defined [name-defined]
- starlette/background.py:17: error: Name "P.args" is not defined [name-defined]
- starlette/background.py:17: error: Name "P.kwargs" is not defined [name-defined]
- starlette/background.py:36: error: Name "P.args" is not defined [name-defined]
- starlette/background.py:36: error: Name "P.kwargs" is not defined [name-defined]
rclip (https://github.com/yurijmikhalevich/rclip)
- rclip/db.py:70: error: Argument 1 to "update" of "dict" has incompatible type "NewImage"; expected "Mapping[Any, None]"
+ rclip/db.py:70: error: Argument 1 to "update" of "MutableMapping" has incompatible type "NewImage"; expected "SupportsKeysAndGetItem[Any, None]"
+ rclip/db.py:70: note: Following member(s) of "NewImage" have conflicts:
+ rclip/db.py:70: note: Expected:
+ rclip/db.py:70: note: def __getitem__(self, Any) -> None
+ rclip/db.py:70: note: Got:
+ rclip/db.py:70: note: def __getitem__(self, str) -> object
aiortc (https://github.com/aiortc/aiortc)
- src/aiortc/rtcdtlstransport.py:186: error: unused "type: ignore" comment
+ src/aiortc/rtcdtlstransport.py:186: error: Unused "type: ignore" comment
- src/aiortc/rtcdtlstransport.py:211: error: unused "type: ignore" comment
+ src/aiortc/rtcdtlstransport.py:211: error: Unused "type: ignore" comment
- src/aiortc/rtcdtlstransport.py:212: error: unused "type: ignore" comment
+ src/aiortc/rtcdtlstransport.py:212: error: Unused "type: ignore" comment
aioredis (https://github.com/aio-libs/aioredis)
+ aioredis/client.py:94: error: Unused "type: ignore" comment
- aioredis/client.py:4158: error: Argument 1 to "update" of "dict" has incompatible type "Dict[Union[bytes, str], Optional[Any]]"; expected "Mapping[Union[bytes, str, memoryview], Callable[[Dict[str, str]], Awaitable[None]]]" [arg-type]
+ aioredis/client.py:4158: error: Argument 1 to "update" of "MutableMapping" has incompatible type "Dict[Union[bytes, str], Optional[Any]]"; expected "SupportsKeysAndGetItem[Union[bytes, str, memoryview], Callable[[Dict[str, str]], Awaitable[None]]]" [arg-type]
pip (https://github.com/pypa/pip)
- src/pip/_internal/network/auth.py:31: error: unused "type: ignore" comment
+ src/pip/_internal/network/auth.py:31: error: Unused "type: ignore" comment
- src/pip/_internal/network/auth.py:37: error: unused "type: ignore" comment
+ src/pip/_internal/network/auth.py:37: error: Unused "type: ignore" comment
- src/pip/_internal/network/auth.py:69: error: unused "type: ignore" comment
+ src/pip/_internal/network/auth.py:69: error: Unused "type: ignore" comment
vision (https://github.com/pytorch/vision)
- torchvision/prototype/features/_feature.py:23: error: unused "type: ignore" comment
+ torchvision/prototype/features/_feature.py:23: error: Unused "type: ignore" comment
- torchvision/prototype/transforms/functional/_type_conversion.py:26: error: unused "type: ignore" comment
+ torchvision/prototype/transforms/functional/_type_conversion.py:26: error: Unused "type: ignore" comment
- torchvision/prototype/features/_image.py:49: error: unused "type: ignore" comment
+ torchvision/prototype/features/_image.py:49: error: Unused "type: ignore" comment
- torchvision/prototype/transforms/_geometry.py:151: error: unused "type: ignore" comment
+ torchvision/prototype/transforms/_geometry.py:151: error: Unused "type: ignore" comment
- torchvision/prototype/transforms/_geometry.py:152: error: unused "type: ignore" comment
+ torchvision/prototype/transforms/_geometry.py:152: error: Unused "type: ignore" comment
- torchvision/prototype/transforms/_color.py:69: error: unused "type: ignore" comment
+ torchvision/prototype/transforms/_color.py:69: error: Unused "type: ignore" comment
- torchvision/prototype/transforms/_augment.py:64: error: unused "type: ignore" comment
+ torchvision/prototype/transforms/_augment.py:64: error: Unused "type: ignore" comment
- torchvision/prototype/transforms/_augment.py:65: error: unused "type: ignore" comment
+ torchvision/prototype/transforms/_augment.py:65: error: Unused "type: ignore" comment
anyio (https://github.com/agronholm/anyio)
- src/anyio/_core/_eventloop.py:56: error: Module has no attribute "run" [attr-defined]
- src/anyio/_backends/_trio.py:38: error: unused "type: ignore" comment
+ src/anyio/_backends/_trio.py:38: error: Unused "type: ignore" comment
- src/anyio/_backends/_trio.py:44: error: unused "type: ignore" comment
+ src/anyio/_backends/_trio.py:44: error: Unused "type: ignore" comment
- src/anyio/_backends/_trio.py:376: error: unused "type: ignore" comment
+ src/anyio/_backends/_trio.py:376: error: Unused "type: ignore" comment
- src/anyio/_backends/_trio.py:478: error: unused "type: ignore" comment
+ src/anyio/_backends/_trio.py:478: error: Unused "type: ignore" comment
- src/anyio/to_process.py:203: error: "_LoaderProtocol" has no attribute "exec_module" [attr-defined]
+ src/anyio/_backends/_asyncio.py:188: error: Argument 1 to "getcoroutinestate" has incompatible type "Union[Generator[Optional[Future[object]], None, Any], Awaitable[Any]]"; expected "Coroutine[Any, Any, Any]" [arg-type]
urllib3 (https://github.com/urllib3/urllib3)
- src/urllib3/connection.py:235: error: Too few arguments [call-arg]
- src/urllib3/response.py:773: error: "Callable[[IOBase], bool]" has no attribute "__get__" [attr-defined]
- src/urllib3/response.py:908: error: "HTTPResponse" has no attribute "fp" [attr-defined]
- src/urllib3/connectionpool.py:479: error: "HTTPResponse" has no attribute "length" [attr-defined]
- test/tz_stub.py:10: error: unused "type: ignore" comment
+ test/tz_stub.py:10: error: Unused "type: ignore" comment
- test/test_response.py:323: error: Incompatible types in a``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Wraps everything up.
This goes after checkstrformat, messages and plugins. The final commit removes all fronge uses of strings, and will be useful later.