GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — Improved `Literal?` types by randolf-scholz · Pull Request #20444 · python/mypy Conversation
|
|
Repro of the from typing import Literal, reveal_type class Port: protocol: Literal["tcp", "udp", "icmp"] port: int | None def show(*ports: int | Port) -> None: # master: set[tuple[L['tcp', 'udp', 'icmp'], int | None]] # PR: set[tuple[L['tcp']?, int] | tuple[L['tcp', 'udp', 'icmp'], int | None]] reveal_type( { ( "tcp", port ) if isinstance(port, int) else ( port.protocol, port.port ) for port in ports } ) On master the set comprehension combines both branches into
RFC: would this be considered a regression, or is the behavior proposed by the PR OK? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| # Step 5: Combine Literals and Instances with LKVs, e.g. Literal[1]?, Literal[1] -> Literal[1]? | ||
| proper_items: list[ProperType] = [get_proper_type(t) for t in simplified_set] | ||
| last_known_values: list[LiteralType | None] = [ | ||
| p_t.last_known_value if isinstance(p_t, Instance) else None for p_t in proper_items | ||
| ] | ||
| simplified_set = [ | ||
| item for item, p_t in zip(simplified_set, proper_items) if p_t not in last_known_values | ||
| ] | ||
|
|
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Maybe it's possible to do something smarter here, so that e.g. list[Literal["x"]] and list[Literal["x"]?] would be combined as well
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Just in case you're interested, I have implicit literals implemented as well in Zuban. However it works in a different way, I store the implicit information on the literal. This makes it a bit easier to deal with literals in my opinion. I understand that that might cause a lot of changes in Mypy and it also might cause other issues, but I feel like it's a bit better to store it that way, because it essentially is a literal.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Update: The operator issue could be patched by a logical change in typeshed: python/typeshed#15160 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Converting to draft since recent changes give "Non-overlapping equality check" errors. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Diff from mypy_primer, showing the effect of this PR on open source code: spark (https://github.com/apache/spark) + python/pyspark/pandas/utils.py:757: error: Unused "type: ignore" comment [unused-ignore] - python/pyspark/pandas/groupby.py:3530: error: Argument 2 to "zip" has incompatible type "list[Hashable | Any] | Hashable | list[Any | tuple[Any, ...]]"; expected "Iterable[Hashable | Any]" [arg-type] + python/pyspark/pandas/groupby.py:3530: error: Argument 2 to "zip" has incompatible type "list[Any | tuple[Any, ...]] | Hashable"; expected "Iterable[Any | tuple[Any, ...]]" [arg-type] steam.py (https://github.com/Gobot1234/steam.py) - steam/ext/csgo/state.py:180: error: Argument "slot" to "Sticker" has incompatible type "int | None"; expected "Literal[0, 1, 2, 3, 4, 5] | None" [arg-type] prefect (https://github.com/PrefectHQ/prefect) - src/prefect/concurrency/_asyncio.py:171: error: R? has no attribute "json" [attr-defined] + src/prefect/task_worker.py:387: error: Argument 1 to "submit" of "Executor" has incompatible type "Callable[[Callable[_P, _T], **_P], _T]"; expected "Callable[[Callable[[Task[P, R], UUID | None, TaskRun | None, dict[str, Any] | None, PrefectFuture[Any] | Any | Iterable[PrefectFuture[Any] | Any] | None, Literal['state', 'result'], dict[str, set[RunInput]] | None, dict[str, Any] | None], R | State[Any] | None], Task[[VarArg(Any), KwArg(Any)], Any], UUID, TaskRun, dict[Any, Any], list[Any], str, Any | None], Any | State[Any] | None]" [arg-type] operator (https://github.com/canonical/operator) - ops/pebble.py:1208: error: TypedDict key must be a string literal; expected one of ("command", "service-context", "environment", "user-id", "user", ...) [literal-required] - ops/pebble.py:1226: error: TypedDict key must be a string literal; expected one of ("url", "headers") [literal-required] + ops/model.py:820: error: Incompatible types in assignment (expression has type "str", variable has type "Literal['tcp', 'udp', 'icmp']") [assignment] pyinstrument (https://github.com/joerick/pyinstrument) - pyinstrument/context_manager.py:40: error: Argument 1 to "Profiler" has incompatible type "**dict[str, Literal['enabled', 'disabled', 'strict'] | float | bool | None]"; expected "float" [arg-type] + pyinstrument/context_manager.py:40: error: Argument 1 to "Profiler" has incompatible type "**dict[str, Literal['enabled', 'strict'] | float | str | bool | None]"; expected "float" [arg-type] - pyinstrument/context_manager.py:40: error: Argument 1 to "Profiler" has incompatible type "**dict[str, Literal['enabled', 'disabled', 'strict'] | float | bool | None]"; expected "Literal['enabled', 'disabled', 'strict']" [arg-type] + pyinstrument/context_manager.py:40: error: Argument 1 to "Profiler" has incompatible type "**dict[str, Literal['enabled', 'strict'] | float | str | bool | None]"; expected "Literal['enabled', 'disabled', 'strict']" [arg-type] - pyinstrument/context_manager.py:40: error: Argument 1 to "Profiler" has incompatible type "**dict[str, Literal['enabled', 'disabled', 'strict'] | float | bool | None]"; expected "bool | None" [arg-type] + pyinstrument/context_manager.py:40: error: Argument 1 to "Profiler" has incompatible type "**dict[str, Literal['enabled', 'strict'] | float | str | bool | None]"; expected "bool | None" [arg-type] scrapy (https://github.com/scrapy/scrapy) - tests/test_pipeline_files.py:1058: error: Unused "type: ignore" comment [unused-ignore] discord.py (https://github.com/Rapptz/discord.py) - discord/app_commands/transformers.py:141: error: Incompatible types in assignment (expression has type "list[dict[str, Any]]", target has type "str | int") [assignment] + discord/app_commands/transformers.py:141: error: Incompatible types in assignment (expression has type "list[dict[str, Any]]", target has type "bool | str | int") [assignment] - discord/app_commands/transformers.py:143: error: Incompatible types in assignment (expression has type "list[int]", target has type "str | int") [assignment] + discord/app_commands/transformers.py:143: error: Incompatible types in assignment (expression has type "list[int]", target has type "bool | str | int") [assignment] - discord/app_commands/transformers.py:151: error: Incompatible types in assignment (expression has type "int | float", target has type "str | int") [assignment] + discord/app_commands/transformers.py:151: error: Incompatible types in assignment (expression has type "int | float", target has type "bool | str | int") [assignment] - discord/app_commands/transformers.py:153: error: Incompatible types in assignment (expression has type "int | float", target has type "str | int") [assignment] + discord/app_commands/transformers.py:153: error: Incompatible types in assignment (expression has type "int | float", target has type "bool | str | int") [assignment] pandera (https://github.com/pandera-dev/pandera) + pandera/backends/ibis/container.py:58: error: Incompatible types in assignment (expression has type "list[tuple[Never, tuple[Any, ...]]]", variable has type "list[tuple[Callable[..., Any], tuple[Any, ...]]]") [assignment] + pandera/backends/ibis/container.py:58: note: "list" is invariant -- see https://mypy.readthedocs.io/en/stable/common_issues.html#variance + pandera/backends/ibis/container.py:58: note: Consider using "Sequence" instead, which is covariant + pandera/backends/ibis/container.py:59: error: List item 0 has incompatible type "tuple[Callable[[Any, DataFrameSchema, ColumnInfo], Any], tuple[DataFrameSchema, ColumnInfo]]"; expected "tuple[Never, tuple[Any, ...]]" [list-item] rotki (https://github.com/rotki/rotki) + rotkehlchen/chain/evm/decoding/balancer/v1/decoder.py:279: error: Dict entry 0 has incompatible type "Literal['balancer-v1', 'balancer-v2', 'balancer-v3', 'beets-v2', 'beets-v3']": "list[tuple[int, Never]]"; expected "str": "list[tuple[int, Callable[..., Any]]]" [dict-item] + rotkehlchen/chain/evm/decoding/balancer/v1/decoder.py:280: error: List item 0 has incompatible type "tuple[int, Callable[[EvmTransaction, list[EvmEvent], list[EvmTxReceiptLog]], list[EvmEvent]]]"; expected "tuple[int, Never]" [list-item] + rotkehlchen/chain/evm/decoding/balancer/v1/decoder.py:281: error: List item 1 has incompatible type "tuple[int, Callable[[EvmTransaction, list[EvmEvent], list[EvmTxReceiptLog]], list[EvmEvent]]]"; expected "tuple[int, Never]" [list-item] + rotkehlchen/chain/evm/decoding/balancer/v2/decoder.py:217: error: Dict entry 0 has incompatible type "Literal['balancer-v1', 'balancer-v2', 'balancer-v3', 'beets-v2', 'beets-v3']": "list[tuple[int, Never]]"; expected "str": "list[tuple[int, Callable[..., Any]]]" [dict-item] + rotkehlchen/chain/evm/decoding/balancer/v2/decoder.py:217: error: List item 0 has incompatible type "tuple[int, Callable[[EvmTransaction, list[EvmEvent], list[EvmTxReceiptLog]], list[EvmEvent]]]"; expected "tuple[int, Never]" [list-item] + rotkehlchen/chain/evm/decoding/quickswap/v3/decoder.py:138: error: Dict entry 0 has incompatible type "Literal['quickswap-v3', 'quickswap-v4']": "list[tuple[int, Never]]"; expected "str": "list[tuple[int, Callable[..., Any]]]" [dict-item] + rotkehlchen/chain/evm/decoding/quickswap/v3/decoder.py:138: error: List item 0 has incompatible type "tuple[int, Callable[[EvmTransaction, list[EvmEvent], list[EvmTxReceiptLog]], list[EvmEvent]]]"; expected "tuple[int, Never]" [list-item] + rotkehlchen/accounting/history_base_entries.py:291: error: Incompatible types in assignment (expression has type "list[tuple[Never, dict[str, Any]]]", variable has type "list[tuple[Callable[..., Any], dict[str, Any]]]") [assignment] + rotkehlchen/accounting/history_base_entries.py:291: note: "list" is invariant -- see https://mypy.readthedocs.io/en/stable/common_issues.html#variance + rotkehlchen/accounting/history_base_entries.py:291: note: Consider using "Sequence" instead, which is covariant + rotkehlchen/accounting/history_base_entries.py:292: error: List item 0 has incompatible type "tuple[def add_in_event(self, event_type: AccountingEventType, notes: str, location: LocationIdentifier, timestamp: Timestamp, asset: Asset, amount: FVal, taxable: bool, given_price: Price | None = ..., extra_data: dict[Any, Any] | None = ..., **kwargs: Any) -> None, dict[str, object]]"; expected "tuple[Never, dict[str, Any]]" [list-item] + rotkehlchen/api/services/assets.py:1090: error: List comprehension has incompatible type List[tuple[str, CacheType, Callable[[EvmNodeInquirer, Literal[CacheType.CURVE_LP_TOKENS], MessagesAggregator, bool], list[CurvePoolData] | None], ChainID, EthereumInquirer | OptimismInquirer | ArbitrumOneInquirer | BaseInquirer | GnosisInquirer | PolygonPOSInquirer]]; expected List[tuple[str, CacheType, Never, ChainID, EthereumInquirer | OptimismInquirer | ArbitrumOneInquirer | BaseInquirer | GnosisInquirer | PolygonPOSInquirer]] [misc] + rotkehlchen/api/services/assets.py:1189: error: List comprehension has incompatible type List[tuple[str, CacheType, Callable[[Literal[1, 2, 3], EvmNodeInquirer, MessagesAggregator, str, Literal[CacheType.BALANCER_V1_POOLS, CacheType.BALANCER_V2_POOLS, CacheType.BALANCER_V3_POOLS], bool], tuple[set[ChecksumAddress], set[ChecksumAddress]]], ChainID, GnosisInquirer | EthereumInquirer | ArbitrumOneInquirer]]; expected List[tuple[str, CacheType, Never, ChainID, GnosisInquirer | EthereumInquirer | ArbitrumOneInquirer]] [misc] + rotkehlchen/api/services/assets.py:1204: error: List comprehension has incompatible type List[tuple[str, CacheType, Callable[[Literal[1, 2, 3], EvmNodeInquirer, MessagesAggregator, str, Literal[CacheType.BALANCER_V1_POOLS, CacheType.BALANCER_V2_POOLS, CacheType.BALANCER_V3_POOLS], bool], tuple[set[ChecksumAddress], set[ChecksumAddress]]], ChainID, BaseInquirer | GnosisInquirer | EthereumInquirer | OptimismInquirer | PolygonPOSInquirer | ArbitrumOneInquirer | SonicInquirer]]; expected List[tuple[str, CacheType, Never, ChainID, BaseInquirer | GnosisInquirer | EthereumInquirer | OptimismInquirer | PolygonPOSInquirer | ArbitrumOneInquirer | SonicInquirer]] [misc] + rotkehlchen/api/services/assets.py:1223: error: List comprehension has incompatible type List[tuple[str, CacheType, Callable[[Literal[1, 2, 3], EvmNodeInquirer, MessagesAggregator, str, Literal[CacheType.BALANCER_V1_POOLS, CacheType.BALANCER_V2_POOLS, CacheType.BALANCER_V3_POOLS], bool], tuple[set[ChecksumAddress], set[ChecksumAddress]]], ChainID, BaseInquirer | GnosisInquirer | EthereumInquirer | OptimismInquirer | ArbitrumOneInquirer | SonicInquirer]]; expected List[tuple[str, CacheType, Never, ChainID, BaseInquirer | GnosisInquirer | EthereumInquirer | OptimismInquirer | ArbitrumOneInquirer | SonicInquirer]] [misc] + rotkehlchen/chain/evm/decoding/velodrome/decoder.py:797: error: Dict entry 0 has incompatible type "Literal['velodrome', 'aerodrome']": "list[tuple[int, Never]]"; expected "str": "list[tuple[int, Callable[..., Any]]]" [dict-item] + rotkehlchen/chain/evm/decoding/velodrome/decoder.py:797: error: List item 0 has incompatible type "tuple[int, Callable[[EvmTransaction, list[EvmEvent], list[EvmTxReceiptLog]], list[EvmEvent]]]"; expected "tuple[int, Never]" [list-item] + rotkehlchen/globaldb/asset_updates/parsers.py:112: error: Incompatible types in assignment (expression has type "list[tuple[VersionRange, Never]]", variable has type "list[tuple[VersionRange, Callable[..., Any]]]") [assignment] + rotkehlchen/globaldb/asset_updates/parsers.py:112: note: "list" is invariant -- see https://mypy.readthedocs.io/en/stable/common_issues.html#variance + rotkehlchen/globaldb/asset_updates/parsers.py:112: note: Consider using "Sequence" instead, which is covariant + rotkehlchen/globaldb/asset_updates/parsers.py:113: error: List item 0 has incompatible type "tuple[VersionRange, Callable[[DBConnection, str], AssetData]]"; expected "tuple[VersionRange, Never]" [list-item] + rotkehlchen/globaldb/asset_updates/parsers.py:114: error: List item 1 has incompatible type "tuple[VersionRange, Callable[[DBConnection, str], AssetData]]"; expected "tuple[VersionRange, Never]" [list-item] + rotkehlchen/globaldb/asset_updates/parsers.py:115: error: List item 2 has incompatible type "tuple[VersionRange, Callable[[DBConnection, str], AssetData]]"; expected "tuple[VersionRange, Never]" [list-item] + rotkehlchen/globaldb/asset_updates/parsers.py:344: error: Incompatible types in assignment (expression has type "list[tuple[VersionRange, Never]]", variable has type "list[tuple[VersionRange, Callable[..., Any]]]") [assignment] + rotkehlchen/globaldb/asset_updates/parsers.py:344: note: "list" is invariant -- see https://mypy.readthedocs.io/en/stable/common_issues.html#variance + rotkehlchen/globaldb/asset_updates/parsers.py:344: note: Consider using "Sequence" instead, which is covariant + rotkehlchen/globaldb/asset_updates/parsers.py:345: error: List item 0 has incompatible type "tuple[VersionRange, Callable[[DBConnection, str], tuple[int, str, str]]]"; expected "tuple[VersionRange, Never]" [list-item] + rotkehlchen/globaldb/asset_updates/parsers.py:346: error: List item 1 has incompatible type "tuple[VersionRange, Callable[[DBConnection, str], tuple[int, str, str, str]]]"; expected "tuple[VersionRange, Never]" [list-item] + rotkehlchen/globaldb/asset_updates/parsers.py:407: error: Incompatible types in assignment (expression has type "list[tuple[VersionRange, Never]]", variable has type "list[tuple[VersionRange, Callable[..., Any]]]") [assignment] + rotkehlchen/globaldb/asset_updates/parsers.py:407: note: "list" is invariant -- see https://mypy.readthedocs.io/en/stable/common_issues.html#variance + rotkehlchen/globaldb/asset_updates/parsers.py:407: note: Consider using "Sequence" instead, which is covariant + rotkehlchen/globaldb/asset_updates/parsers.py:408: error: List item 0 has incompatible type "tuple[VersionRange, Callable[[DBConnection, str], tuple[int, str]]]"; expected "tuple[VersionRange, Never]" [list-item] dedupe (https://github.com/dedupeio/dedupe) - dedupe/api.py:1547: error: Redundant cast to "Literal['match', 'distinct']" [redundant-cast] pytest (https://github.com/pytest-dev/pytest) + testing/test_assertrewrite.py:963: error: Unused "type: ignore" comment [unused-ignore] pandas (https://github.com/pandas-dev/pandas) + pandas/core/groupby/groupby.py:1607: error: Unused "type: ignore" comment [unused-ignore] materialize (https://github.com/MaterializeInc/materialize) - misc/python/materialize/cli/scratch/__main__.py:95: error: Argument 1 to "join" of "str" has incompatible type "list[str | Callable[[Any], Any] | Callable[[], None] | Callable[[ArgumentParser], None] | Callable[[Namespace], None] | list[str]]"; expected "Iterable[str]" [arg-type] + misc/python/materialize/cli/scratch/__main__.py:95: error: Argument 1 to "join" of "str" has incompatible type "list[Callable[[Any], Any] | Callable[[], None] | str | Callable[[ArgumentParser], None] | Callable[[Namespace], None] | list[str]]"; expected "Iterable[str]" [arg-type] - misc/python/materialize/cli/scratch/__main__.py:101: error: Argument 1 to "add_parser" of "_SubParsersAction" has incompatible type "str | Callable[[Any], Any] | Callable[[], None] | Callable[[ArgumentParser], None] | Callable[[Namespace], None] | list[str]"; expected "str" [arg-type] + misc/python/materialize/cli/scratch/__main__.py:101: error: Argument 1 to "add_parser" of "_SubParsersAction" has incompatible type "Callable[[Any], Any] | Callable[[], None] | str | Callable[[ArgumentParser], None] | Callable[[Namespace], None] | list[str]"; expected "str" [arg-type] - misc/python/materialize/cli/scratch/__main__.py:101: error: Argument "aliases" to "add_parser" of "_SubParsersAction" has incompatible type "str | Callable[[Any], Any] | Callable[[], None] | Callable[[ArgumentParser], None] | Callable[[Namespace], None] | list[str]"; expected "Iterable[str]" [arg-type] + misc/python/materialize/cli/scratch/__main__.py:101: error: Argument "aliases" to "add_parser" of "_SubParsersAction" has incompatible type "Callable[[Any], Any] | Callable[[], None] | str | Callable[[ArgumentParser], None] | Callable[[Namespace], None] | list[str]"; expected "Iterable[str]" [arg-type] - misc/python/materialize/cli/scratch/__main__.py:101: error: Argument "description" to "add_parser" of "_SubParsersAction" has incompatible type "str | Callable[[Any], Any] | Callable[[], None] | Callable[[ArgumentParser], None] | Callable[[Namespace], None] | list[str]"; expected "str | None" [arg-type] + misc/python/materialize/cli/scratch/__main__.py:101: error: Argument "description" to "add_parser" of "_SubParsersAction" has incompatible type "Callable[[Any], Any] | Callable[[], None] | str | Callable[[ArgumentParser], None] | Callable[[Namespace], None] | list[str]"; expected "str | None" [arg-type] - misc/python/materialize/cli/scratch/__main__.py:101: error: Argument "help" to "add_parser" of "_SubParsersAction" has incompatible type "str | Callable[[Any], Any] | Callable[[], None] | Callable[[ArgumentParser], None] | Callable[[Namespace], None] | list[str]"; expected "str | None" [arg-type] + misc/python/materialize/cli/scratch/__main__.py:101: error: Argument "help" to "add_parser" of "_SubParsersAction" has incompatible type "Callable[[Any], Any] | Callable[[], None] | str | Callable[[ArgumentParser], None] | Callable[[Namespace], None] | list[str]"; expected "str | None" [arg-type] - misc/python/materialize/cli/scratch/__main__.py:103: error: Argument 1 to "run" has incompatible type "ArgumentParser"; expected "Namespace" [arg-type] + misc/python/materialize/cli/scratch/__main__.py:103: error: Argument 1 has incompatible type "ArgumentParser"; expected "Namespace" [arg-type] mitmproxy (https://github.com/mitmproxy/mitmproxy) + mitmproxy/net/server_spec.py:85: error: Unused "type: ignore" comment [unused-ignore] - mitmproxy/flowfilter.py:58: error: Redundant cast to "RegexFlag" [redundant-cast] jax (https://github.com/google/jax) - jax/_src/pallas/mosaic/lowering.py:737: error: Redundant cast to "Literal['parallel', 'core_parallel', 'subcore_parallel', 'arbitrary']" [redundant-cast] - jax/_src/pallas/mosaic/lowering.py:914: error: Argument 1 to "_get_dimension_semantics" has incompatible type "tuple[Literal['parallel', 'core_parallel', 'subcore_parallel', 'arbitrary'] | GridDimensionSemantics, ...]"; expected "Sequence[str]" [arg-type] + jax/_src/pallas/mosaic/lowering.py:914: error: Argument 1 to "_get_dimension_semantics" has incompatible type "tuple[Literal['core_parallel', 'subcore_parallel', 'arbitrary'] | GridDimensionSemantics | str, ...]"; expected "Sequence[str]" [arg-type] - jax/_src/internal_test_util/test_harnesses.py:2236: error: Incompatible types in assignment (expression has type "tuple[ndarray[tuple[Any, ...], dtype[unsignedinteger[_8Bit]]] | ndarray[tuple[Any, ...], dtype[unsignedinteger[_32Bit]]] | int, ...]", variable has type "list[list[int]]") [assignment] - jax/_src/internal_test_util/test_harnesses.py:2236: error: Incompatible types in assignment (expression has type "tuple[ndarray[tuple[Any, ...], dtype[unsignedinteger[_8Bit]]] | ndarray[tuple[Any, ...], dtype[unsignedinteger[_32Bit]]] | int, ...]", variable has type "tuple[int, ...]") [assignment] + jax/_src/internal_test_util/test_harnesses.py:2236: error: Incompatible types in assignment (expression has type "tuple[object, ...]", variable has type "list[list[int]]") [assignment] + jax/_src/internal_test_util/test_harnesses.py:2236: error: Incompatible types in assignment (expression has type "tuple[object, ...]", variable has type "tuple[int, ...]") [assignment] - jax/_src/internal_test_util/test_harnesses.py:2295: error: Incompatible types in assignment (expression has type "tuple[ndarray[tuple[Any, ...], dtype[unsignedinteger[_8Bit]]] | ndarray[tuple[Any, ...], dtype[unsignedinteger[_32Bit]]] | int, ...]", variable has type "list[list[int]]") [assignment] + jax/_src/internal_test_util/test_harnesses.py:2295: error: Incompatible types in assignment (expression has type "tuple[int | ndarray[tuple[Any, ...], dtype[unsignedinteger[_8Bit]]] | ndarray[tuple[Any, ...], dtype[unsignedinteger[_32Bit]]], ...]", variable has type "list[list[int]]") [assignment] packaging (https://github.com/pypa/packaging) + src/packaging/version.py:293: error: Unused "type: ignore" comment [unused-ignore] git-revise (https://github.com/mystor/git-revise) - gitrevise/odb.py:413: error: Redundant cast to "bytes" [redundant-cast] meson (https://github.com/mesonbuild/meson) + mesonbuild/interpreter/interpreter.py:421:13: error: Dict entry 0 has incompatible type "type[list[Any]]": "type[ArrayHolder]"; expected "type[HoldableObject] | type[int] | type[str] | type[list[Any]] | type[dict[Any, Any]]": "None" [dict-item] + mesonbuild/interpreter/interpreter.py:422:13: error: Dict entry 1 has incompatible type "type[dict[Any, Any]]": "type[DictHolder]"; expected "type[HoldableObject] | type[int] | type[str] | type[list[Any]] | type[dict[Any, Any]]": "None" [dict-item] + mesonbuild/interpreter/interpreter.py:423:13: error: Dict entry 2 has incompatible type "type[int]": "type[IntegerHolder]"; expected "type[HoldableObject] | type[int] | type[str] | type[list[Any]] | type[dict[Any, Any]]": "None" [dict-item] + mesonbuild/interpreter/interpreter.py:424:13: error: Dict entry 3 has incompatible type "type[bool]": "type[BooleanHolder]"; expected "type[HoldableObject] | type[int] | type[str] | type[list[Any]] | type[dict[Any, Any]]": "None" [dict-item] + mesonbuild/interpreter/interpreter.py:425:13: error: Dict entry 4 has incompatible type "type[str]": "type[StringHolder]"; expected "type[HoldableObject] | type[int] | type[str] | type[list[Any]] | type[dict[Any, Any]]": "None" [dict-item] + mesonbuild/interpreter/interpreter.py:426:13: error: Dict entry 5 has incompatible type "type[MesonVersionString]": "type[MesonVersionStringHolder]"; expected "type[HoldableObject] | type[int] | type[str] | type[list[Any]] | type[dict[Any, Any]]": "None" [dict-item] + mesonbuild/interpreter/interpreter.py:427:13: error: Dict entry 6 has incompatible type "type[DependencyVariableString]": "type[DependencyVariableStringHolder]"; expected "type[HoldableObject] | type[int] | type[str] | type[list[Any]] | type[dict[Any, Any]]": "None" [dict-item] + mesonbuild/interpreter/interpreter.py:428:13: error: Dict entry 7 has incompatible type "type[OptionString]": "type[OptionStringHolder]"; expected "type[HoldableObject] | type[int] | type[str] | type[list[Any]] | type[dict[Any, Any]]": "None" [dict-item] + mesonbuild/interpreter/interpreter.py:431:13: error: Dict entry 8 has incompatible type "type[File]": "type[FileHolder]"; expected "type[HoldableObject] | type[int] | type[str] | type[list[Any]] | type[dict[Any, Any]]": "None" [dict-item] + mesonbuild/interpreter/interpreter.py:432:13: error: Dict entry 9 has incompatible type "type[SharedLibrary]": "type[SharedLibraryHolder]"; expected "type[HoldableObject] | type[int] | type[str] | type[list[Any]] | type[dict[Any, Any]]": "None" [dict-item] + mesonbuild/interpreter/interpreter.py:433:13: error: Dict entry 10 has incompatible type "type[StaticLibrary]": "type[StaticLibraryHolder]"; expected "type[HoldableObject] | type[int] | type[str] | type[list[Any]] | type[dict[Any, Any]]": "None" [dict-item] + mesonbuild/interpreter/interpreter.py:434:13: error: Dict entry 11 has incompatible type "type[BothLibraries]": "type[BothLibrariesHolder]"; expected "type[HoldableObject] | type[int] | type[str] | type[list[Any]] | type[dict[Any, Any]]": "None" [dict-item] + mesonbuild/interpreter/interpreter.py:435:13: error: Dict entry 12 has incompatible type "type[SharedModule]": "type[SharedModuleHolder]"; expected "type[HoldableObject] | type[int] | type[str] | type[list[Any]] | type[dict[Any, Any]]": "None" [dict-item] + mesonbuild/interpreter/interpreter.py:436:13: error: Dict entry 13 has incompatible type "type[Executable]": "type[ExecutableHolder]"; expected "type[HoldableObject] | type[int] | type[str] | type[list[Any]] | type[dict[Any, Any]]": "None" [dict-item] + mesonbuild/interpreter/interpreter.py:437:13: error: Dict entry 14 has incompatible type "type[Jar]": "type[JarHolder]"; expected "type[HoldableObject] | type[int] | type[str] | type[list[Any]] | type[dict[Any, Any]]": "None" [dict-item] + mesonbuild/interpreter/interpreter.py:438:13: error: Dict entry 15 has incompatible type "type[CustomTarget]": "type[CustomTargetHolder]"; expected "type[HoldableObject] | type[int] | type[str] | type[list[Any]] | type[dict[Any, Any]]": "None" [dict-item] + mesonbuild/interpreter/interpreter.py:439:13: error: Dict entry 16 has incompatible type "type[CustomTargetIndex]": "type[CustomTargetIndexHolder]"; expected "type[HoldableObject] | type[int] | type[str] | type[list[Any]] | type[dict[Any, Any]]": "None" [dict-item] + mesonbuild/interpreter/interpreter.py:440:13: error: Dict entry 17 has incompatible type "type[Generator]": "type[GeneratorHolder]"; expected "type[HoldableObject] | type[int] | type[str] | type[list[Any]] | type[dict[Any, Any]]": "None" [dict-item] + mesonbuild/interpreter/interpreter.py:441:13: error: Dict entry 18 has incompatible type "type[GeneratedList]": "type[GeneratedListHolder]"; expected "type[HoldableObject] | type[int] | type[str] | type[list[Any]] | type[dict[Any, Any]]": "None" [dict-item] + mesonbuild/interpreter/interpreter.py:442:13: error: Dict entry 19 has incompatible type "type[ExtractedObjects]": "type[GeneratedObjectsHolder]"; expected "type[HoldableObject] | type[int] | type[str] | type[list[Any]] | type[dict[Any, Any]]": "None" [dict-item] + mesonbuild/interpreter/interpreter.py:443:13: error: Dict entry 20 has incompatible type "type[RunTarget]": "type[RunTargetHolder]"; expected "type[HoldableObject] | type[int] | type[str] | type[list[Any]] | type[dict[Any, Any]]": "None" [dict-item] + mesonbuild/interpreter/interpreter.py:444:13: error: Dict entry 21 has incompatible type "type[AliasTarget]": "type[AliasTargetHolder]"; expected "type[HoldableObject] | type[int] | type[str] | type[list[Any]] | type[dict[Any, Any]]": "None" [dict-item] + mesonbuild/interpreter/interpreter.py:445:13: error: Dict entry 22 has incompatible type "type[Headers]": "type[HeadersHolder]"; expected "type[HoldableObject] | type[int] | type[str] | type[list[Any]] | type[dict[Any, Any]]": "None" [dict-item] + mesonbuild/interpreter/interpreter.py:446:13: error: Dict entry 23 has incompatible type "type[Man]": "type[ManHolder]"; expected "type[HoldableObject] | type[int] | type[str] | type[list[Any]] | type[dict[Any, Any]]": "None" [dict-item] + mesonbuild/interpreter/interpreter.py:447:13: error: Dict entry 24 has incompatible type "type[EmptyDir]": "type[EmptyDirHolder]"; expected "type[HoldableObject] | type[int] | type[str] | type[list[Any]] | type[dict[Any, Any]]": "None" [dict-item] + mesonbuild/interpreter/interpreter.py:448:13: error: Dict entry 25 has incompatible type "type[Data]": "type[DataHolder]"; expected "type[HoldableObject] | type[int] | type[str] | type[list[Any]] | type[dict[Any, Any]]": "None" [dict-item] + mesonbuild/interpreter/interpreter.py:449:13: error: Dict entry 26 has incompatible type "type[SymlinkData]": "type[SymlinkDataHolder]"; expected "type[HoldableObject] | type[int] | type[str] | type[list[Any]] | type[dict[Any, Any]]": "None" [dict-item] + mesonbuild/interpreter/interpreter.py:450:13: error: Dict entry 27 has incompatible type "type[InstallDir]": "type[InstallDirHolder]"; expected "type[HoldableObject] | type[int] | type[str] | type[list[Any]] | type[dict[Any, Any]]": "None" [dict-item] + mesonbuild/interpreter/interpreter.py:451:13: error: Dict entry 28 has incompatible type "type[IncludeDirs]": "type[IncludeDirsHolder]"; expected "type[HoldableObject] | type[int] | type[str] | type[list[Any]] | type[dict[Any, Any]]": "None" [dict-item] + mesonbuild/interpreter/interpreter.py:452:13: error: Dict entry 29 has incompatible type "type[EnvironmentVariables]": "type[EnvironmentVariablesHolder]"; expected "type[HoldableObject] | type[int] | type[str] | type[list[Any]] | type[dict[Any, Any]]": "None" [dict-item] + mesonbuild/interpreter/interpreter.py:453:13: error: Dict entry 30 has incompatible type "type[StructuredSources]": "type[StructuredSourcesHolder]"; expected "type[HoldableObject] | type[int] | type[str] | type[list[Any]] | type[dict[Any, Any]]": "None" [dict-item] + mesonbuild/interpreter/interpreter.py:454:13: error: Dict entry 31 has incompatible type "type[RunResult]": "type[TryRunResultHolder]"; expected "type[HoldableObject] | type[int] | type[str] | type[list[Any]] | type[dict[Any, Any]]": "None" [dict-item] + mesonbuild/interpreter/interpreter.py:455:13: error: Dict entry 32 has incompatible type "type[ExternalLibrary]": "type[ExternalLibraryHolder]"; expected "type[HoldableObject] | type[int] | type[str] | type[list[Any]] | type[dict[Any, Any]]": "None" [dict-item] + mesonbuild/interpreter/interpreter.py:456:13: error: Dict entry 33 has incompatible type "type[Feature]": "type[FeatureOptionHolder]"; expected "type[HoldableObject] | type[int] | type[str] | type[list[Any]] | type[dict[Any, Any]]": "None" [dict-item] + mesonbuild/interpreter/interpreter.py:457:13: error: Dict entry 34 has incompatible type "type[MachineInfo]": "type[MachineHolder]"; expected "type[HoldableObject] | type[int] | type[str] | type[list[Any]] | type[dict[Any, Any]]": "None" [dict-item] + mesonbuild/interpreter/interpreter.py:458:13: error: Dict entry 35 has incompatible type "type[ConfigurationData]": "type[ConfigurationDataHolder]"; expected "type[HoldableObject] | type[int] | type[str] | type[list[Any]] | type[dict[Any, Any]]": "None" [dict-item] + mesonbuild/interpreter/interpreter.py:471:13: error: Dict entry 0 has incompatible type "type[Dependency]": "type[DependencyHolder]"; expected "type[HoldableObject] | type[int] | type[str] | type[list[Any]] | type[dict[Any, Any]]": "None" [dict-item] + mesonbuild/interpreter/interpreter.py:472:13: error: Dict entry 1 has incompatible type "type[Program]": "type[ProgramHolder[_PROG]]"; expected "type[HoldableObject] | type[int] | type[str] | type[list[Any]] | type[dict[Any, Any]]": "None" [dict-item] + mesonbuild/interpreter/interpreter.py:473:13: error: Dict entry 2 has incompatible type "type[Compiler]": "type[CompilerHolder]"; expected "type[HoldableObject] | type[int] | type[str] | type[list[Any]] | type[dict[Any, Any]]": "None" [dict-item] + mesonbuild/interpreter/interpreter.py:474:13: error: Dict entry 3 has incompatible type "type[ModuleObject]": "type[ModuleObjectHolder]"; expected "type[HoldableObject] | type[int] | type[str] | type[list[Any]] | type[dict[Any, Any]]": "None" [dict-item] + mesonbuild/interpreter/interpreter.py:475:13: error: Dict entry 4 has incompatible type "type[MutableModuleObject]": "type[MutableModuleObjectHolder]"; expected "type[HoldableObject] | type[int] | type[str] | type[list[Any]] | type[dict[Any, Any]]": "None" [dict-item] + mesonbuild/interpreter/interpreter.py:486:13: error: Dict entry 0 has incompatible type "type[HoldableObject]": "type[ObjectHolder[Any]]"; expected "type[HoldableObject] | type[int] | type[str] | type[list[Any]] | type[dict[Any, Any]]": "None" [dict-item] - mesonbuild/modules/rust.py:928:60: error: Redundant cast to "Literal['c', 'cpp', 'cuda', 'fortran', 'd', 'objc', 'objcpp', 'rust', 'vala', 'cs', 'swift', 'java', 'cython', 'nasm', 'masm', 'linearasm']" [redundant-cast] sphinx (https://github.com/sphinx-doc/sphinx) + sphinx/ext/autodoc/_directive_options.py:225: error: Unused "type: ignore" comment [unused-ignore] + sphinx/ext/autodoc/_directive_options.py:232: error: Unused "type: ignore" comment [unused-ignore] mongo-python-driver (https://github.com/mongodb/mongo-python-driver) + bson/__init__.py:1363: error: Cannot infer value of type parameter "_DocumentType" of "_bson_to_dict" [misc] paasta (https://github.com/yelp/paasta) + paasta_tools/metrics/metastatus_lib.py:956: error: List item 0 has incompatible type "Callable[[KubeClient, str], HealthCheckResult]"; expected "None" [list-item] + paasta_tools/metrics/metastatus_lib.py:956: error: List item 1 has incompatible type "Callable[[KubeClient, str], HealthCheckResult]"; expected "None" [list-item] |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
Regression: false positive avoid redundant cast with literal union Type Narrowing:if val == Literal should always narrow to Literal
Narrowing types to Literal using in syntax
Literal typeguard
TypedDict item insertion support
There was an error while loading. Please reload this page.