Skip to content

[ty] Improve diagnostics for unsupported comparison operations#21737

Merged
AlexWaygood merged 3 commits intomainfrom
alex/operator-disambiguate
Dec 2, 2025
Merged

[ty] Improve diagnostics for unsupported comparison operations#21737
AlexWaygood merged 3 commits intomainfrom
alex/operator-disambiguate

Conversation

@AlexWaygood
Copy link
Member

Summary

On main:

image

Concise diagnostics on main:

foo.py:1:1: error[unsupported-operator] Operator `<` is not supported for types `str` and `int`, in comparing `tuple[Literal[1], Literal["foo"]]` with `tuple[Literal[1], Literal[2]]`
foo.py:2:1: error[unsupported-operator] Operator `<` is not supported for types `object` and `object`, in comparing `tuple[object]` with `tuple[object]`

With PR:

image

Concise diagnostics with PR:

foo.py:1:1: error[unsupported-operator] Operator `<` is not supported between objects of type `tuple[Literal[1], Literal["foo"]]` and `tuple[Literal[1], Literal[2]]`
foo.py:2:1: error[unsupported-operator] Operator `<` is not supported between two objects of type `tuple[object]`

Test Plan

Mdtests and snapshots

@AlexWaygood AlexWaygood added ty Multi-file analysis & type inference diagnostics Related to reporting of diagnostics. labels Dec 1, 2025
@AlexWaygood AlexWaygood force-pushed the alex/operator-disambiguate branch from 9f27eae to 577f7b9 Compare December 1, 2025 18:37
@astral-sh-bot
Copy link

astral-sh-bot bot commented Dec 1, 2025

Diagnostic diff on typing conformance tests

Changes were detected when running ty on typing conformance tests
--- old-output.txt	2025-12-02 19:54:53.533433718 +0000
+++ new-output.txt	2025-12-02 19:54:57.115460740 +0000
@@ -293,7 +293,7 @@
 dataclasses_kwonly.py:61:14: error[parameter-already-assigned] Multiple values provided for parameter `b`
 dataclasses_match_args.py:42:1: error[unresolved-attribute] Class `DC4` has no attribute `__match_args__`
 dataclasses_match_args.py:49:1: error[type-assertion-failure] Type `tuple[()]` does not match asserted type `Unknown | tuple[()]`
-dataclasses_order.py:50:4: error[unsupported-operator] Operator `<` is not supported for types `DC1` and `DC2`
+dataclasses_order.py:50:4: error[unsupported-operator] Operator `<` is not supported between objects of type `DC1` and `DC2`
 dataclasses_postinit.py:28:7: error[unresolved-attribute] Object of type `DC1` has no attribute `x`
 dataclasses_postinit.py:29:7: error[unresolved-attribute] Object of type `DC1` has no attribute `y`
 dataclasses_slots.py:66:1: error[unresolved-attribute] Class `DC6` has no attribute `__slots__`
@@ -301,7 +301,7 @@
 dataclasses_transform_class.py:63:1: error[invalid-assignment] Property `id` defined in `Customer1` is read-only
 dataclasses_transform_class.py:66:8: error[missing-argument] No arguments provided for required parameters `id`, `name`
 dataclasses_transform_class.py:66:18: error[too-many-positional-arguments] Too many positional arguments: expected 0, got 2
-dataclasses_transform_class.py:72:6: error[unsupported-operator] Operator `<` is not supported for types `Customer1` and `Customer1`
+dataclasses_transform_class.py:72:6: error[unsupported-operator] Operator `<` is not supported between two objects of type `Customer1`
 dataclasses_transform_class.py:82:8: error[missing-argument] No argument provided for required parameter `id`
 dataclasses_transform_class.py:82:18: error[too-many-positional-arguments] Too many positional arguments: expected 0, got 2
 dataclasses_transform_class.py:122:1: error[invalid-assignment] Property `id` defined in `Customer3` is read-only
@@ -343,7 +343,7 @@
 dataclasses_transform_field.py:75:1: error[missing-argument] No argument provided for required parameter `name`
 dataclasses_transform_field.py:75:16: error[too-many-positional-arguments] Too many positional arguments: expected 0, got 1
 dataclasses_transform_func.py:56:1: error[invalid-assignment] Object of type `Literal[3]` is not assignable to attribute `name` of type `str`
-dataclasses_transform_func.py:60:6: error[unsupported-operator] Operator `<` is not supported for types `Customer1` and `Customer1`
+dataclasses_transform_func.py:60:6: error[unsupported-operator] Operator `<` is not supported between two objects of type `Customer1`
 dataclasses_transform_func.py:64:36: error[unknown-argument] Argument `salary` does not match any known parameter
 dataclasses_transform_func.py:70:8: error[missing-argument] No arguments provided for required parameters `id`, `name`
 dataclasses_transform_func.py:70:18: error[too-many-positional-arguments] Too many positional arguments: expected 0, got 2
@@ -352,7 +352,7 @@
 dataclasses_transform_meta.py:63:1: error[invalid-assignment] Property `id` defined in `Customer1` is read-only
 dataclasses_transform_meta.py:66:8: error[missing-argument] No arguments provided for required parameters `id`, `name`
 dataclasses_transform_meta.py:66:18: error[too-many-positional-arguments] Too many positional arguments: expected 0, got 2
-dataclasses_transform_meta.py:73:6: error[unsupported-operator] Operator `<` is not supported for types `Customer1` and `Customer1`
+dataclasses_transform_meta.py:73:6: error[unsupported-operator] Operator `<` is not supported between two objects of type `Customer1`
 dataclasses_transform_meta.py:83:8: error[missing-argument] No argument provided for required parameter `id`
 dataclasses_transform_meta.py:83:18: error[too-many-positional-arguments] Too many positional arguments: expected 0, got 2
 dataclasses_transform_meta.py:103:1: error[invalid-assignment] Property `id` defined in `Customer3` is read-only

@astral-sh-bot
Copy link

astral-sh-bot bot commented Dec 1, 2025

mypy_primer results

Changes were detected when running on open source projects
attrs (https://github.com/python-attrs/attrs)
- tests/test_functional.py:632:13: error[unsupported-operator] Operator `<` is not supported for types `C` and `C`
+ tests/test_functional.py:632:13: error[unsupported-operator] Operator `<` is not supported between two objects of type `C`
- tests/test_next_gen.py:79:13: error[unsupported-operator] Operator `<` is not supported for types `C` and `C`
+ tests/test_next_gen.py:79:13: error[unsupported-operator] Operator `<` is not supported between two objects of type `C`

more-itertools (https://github.com/more-itertools/more-itertools)
- more_itertools/more.py:3466:31: error[unsupported-operator] Operator `<=` is not supported for types `None` and `int`, in comparing `Unknown | None | Literal[0]` with `int`
+ more_itertools/more.py:3466:31: error[unsupported-operator] Operator `<=` is not supported between objects of type `Unknown | None | Literal[0]` and `int`
- more_itertools/more.py:3466:43: error[unsupported-operator] Operator `<=` is not supported for types `int` and `None`, in comparing `int` with `Unknown | None | int`
+ more_itertools/more.py:3466:43: error[unsupported-operator] Operator `<=` is not supported between objects of type `int` and `Unknown | None | int`
- more_itertools/more.py:3471:27: error[unsupported-operator] Operator `<=` is not supported for types `None` and `int`, in comparing `Unknown | None | Literal[0]` with `int`
+ more_itertools/more.py:3471:27: error[unsupported-operator] Operator `<=` is not supported between objects of type `Unknown | None | Literal[0]` and `int`
- more_itertools/more.py:3471:39: error[unsupported-operator] Operator `<=` is not supported for types `int` and `None`, in comparing `int` with `Unknown | None | int`
+ more_itertools/more.py:3471:39: error[unsupported-operator] Operator `<=` is not supported between objects of type `int` and `Unknown | None | int`

aioredis (https://github.com/aio-libs/aioredis)
- aioredis/connection.py:933:14: error[unsupported-operator] Operator `in` is not supported for types `bytes` and `int`, in comparing `Literal[b" "]` with `bytes | memoryview[int] | int`
+ aioredis/connection.py:933:14: error[unsupported-operator] Operator `in` is not supported between objects of type `Literal[b" "]` and `bytes | memoryview[int] | int`

python-chess (https://github.com/niklasf/python-chess)
- chess/engine.py:506:20: error[unsupported-operator] Operator `<` is not supported for types `int` and `None`, in comparing `tuple[bool, bool, bool, int, int | None]` with `tuple[bool, bool, bool, int, int | None]`
- chess/engine.py:512:20: error[unsupported-operator] Operator `<=` is not supported for types `int` and `None`, in comparing `tuple[bool, bool, bool, int, int | None]` with `tuple[bool, bool, bool, int, int | None]`
- chess/engine.py:518:20: error[unsupported-operator] Operator `>` is not supported for types `int` and `None`, in comparing `tuple[bool, bool, bool, int, int | None]` with `tuple[bool, bool, bool, int, int | None]`
- chess/engine.py:524:20: error[unsupported-operator] Operator `>=` is not supported for types `int` and `None`, in comparing `tuple[bool, bool, bool, int, int | None]` with `tuple[bool, bool, bool, int, int | None]`
+ chess/engine.py:506:20: error[unsupported-operator] Operator `<` is not supported between two objects of type `tuple[bool, bool, bool, int, int | None]`
+ chess/engine.py:512:20: error[unsupported-operator] Operator `<=` is not supported between two objects of type `tuple[bool, bool, bool, int, int | None]`
+ chess/engine.py:518:20: error[unsupported-operator] Operator `>` is not supported between two objects of type `tuple[bool, bool, bool, int, int | None]`
+ chess/engine.py:524:20: error[unsupported-operator] Operator `>=` is not supported between two objects of type `tuple[bool, bool, bool, int, int | None]`

pip (https://github.com/pypa/pip)
- src/pip/_internal/network/auth.py:557:22: error[unsupported-operator] Operator `<` is not supported for types `None` and `int`, in comparing `Unknown | None` with `Literal[400]`
+ src/pip/_internal/network/auth.py:557:22: error[unsupported-operator] Operator `<` is not supported between objects of type `Unknown | None` and `Literal[400]`
- src/pip/_internal/network/utils.py:45:8: error[unsupported-operator] Operator `<=` is not supported for types `int` and `None`, in comparing `Literal[400]` with `Unknown | None`
+ src/pip/_internal/network/utils.py:45:8: error[unsupported-operator] Operator `<=` is not supported between objects of type `Literal[400]` and `Unknown | None`
- src/pip/_internal/network/utils.py:45:15: error[unsupported-operator] Operator `<` is not supported for types `None` and `int`, in comparing `Unknown | None` with `Literal[500]`
+ src/pip/_internal/network/utils.py:45:15: error[unsupported-operator] Operator `<` is not supported between objects of type `Unknown | None` and `Literal[500]`
- src/pip/_internal/network/utils.py:50:10: error[unsupported-operator] Operator `<=` is not supported for types `int` and `None`, in comparing `Literal[500]` with `Unknown | None`
+ src/pip/_internal/network/utils.py:50:10: error[unsupported-operator] Operator `<=` is not supported between objects of type `Literal[500]` and `Unknown | None`
- src/pip/_internal/network/utils.py:50:17: error[unsupported-operator] Operator `<` is not supported for types `None` and `int`, in comparing `Unknown | None` with `Literal[600]`
+ src/pip/_internal/network/utils.py:50:17: error[unsupported-operator] Operator `<` is not supported between objects of type `Unknown | None` and `Literal[600]`
- src/pip/_vendor/cachecontrol/controller.py:149:12: error[unsupported-operator] Operator `in` is not supported for types `str` and `None`, in comparing `Literal["Range"]` with `Unknown | None | CaseInsensitiveDict`
+ src/pip/_vendor/cachecontrol/controller.py:149:12: error[unsupported-operator] Operator `in` is not supported between objects of type `Literal["Range"]` and `Unknown | None | CaseInsensitiveDict`
- src/pip/_vendor/requests/models.py:567:34: error[unsupported-operator] Operator `not in` is not supported for types `str` and `None`, in comparing `Literal["content-type"]` with `Unknown | None | CaseInsensitiveDict`
+ src/pip/_vendor/requests/models.py:567:34: error[unsupported-operator] Operator `not in` is not supported between objects of type `Literal["content-type"]` and `Unknown | None | CaseInsensitiveDict`
- src/pip/_vendor/requests/models.py:1015:12: error[unsupported-operator] Operator `<=` is not supported for types `int` and `None`, in comparing `Literal[400]` with `Unknown | None`
+ src/pip/_vendor/requests/models.py:1015:12: error[unsupported-operator] Operator `<=` is not supported between objects of type `Literal[400]` and `Unknown | None`
- src/pip/_vendor/requests/models.py:1015:19: error[unsupported-operator] Operator `<` is not supported for types `None` and `int`, in comparing `Unknown | None` with `Literal[500]`
+ src/pip/_vendor/requests/models.py:1015:19: error[unsupported-operator] Operator `<` is not supported between objects of type `Unknown | None` and `Literal[500]`
- src/pip/_vendor/requests/models.py:1020:14: error[unsupported-operator] Operator `<=` is not supported for types `int` and `None`, in comparing `Literal[500]` with `Unknown | None`
+ src/pip/_vendor/requests/models.py:1020:14: error[unsupported-operator] Operator `<=` is not supported between objects of type `Literal[500]` and `Unknown | None`
- src/pip/_vendor/requests/models.py:1020:21: error[unsupported-operator] Operator `<` is not supported for types `None` and `int`, in comparing `Unknown | None` with `Literal[600]`
+ src/pip/_vendor/requests/models.py:1020:21: error[unsupported-operator] Operator `<` is not supported between objects of type `Unknown | None` and `Literal[600]`
- src/pip/_vendor/rich/prompt.py:361:12: error[unsupported-operator] Operator `not in` is not supported for types `str` and `None`, in comparing `str` with `list[str] | None`
+ src/pip/_vendor/rich/prompt.py:361:12: error[unsupported-operator] Operator `not in` is not supported between objects of type `str` and `list[str] | None`
- src/pip/_vendor/urllib3/util/retry.py:466:32: error[unsupported-operator] Operator `not in` is not supported for types `Unknown` and `object`, in comparing `Unknown` with `~AlwaysFalsy`
+ src/pip/_vendor/urllib3/util/retry.py:466:32: error[unsupported-operator] Operator `not in` is not supported between objects of type `Unknown` and `~AlwaysFalsy`

spack (https://github.com/spack/spack)
- lib/spack/spack/ci/__init__.py:959:8: error[unsupported-operator] Operator `in` is not supported for types `Any` and `None`, in comparing `Any` with `None | Unknown`
+ lib/spack/spack/ci/__init__.py:959:8: error[unsupported-operator] Operator `in` is not supported between objects of type `Any` and `None | Unknown`
- lib/spack/spack/ci/__init__.py:968:8: error[unsupported-operator] Operator `in` is not supported for types `str` and `None`, in comparing `Literal["image"]` with `None | Unknown`
+ lib/spack/spack/ci/__init__.py:968:8: error[unsupported-operator] Operator `in` is not supported between objects of type `Literal["image"]` and `None | Unknown`
- lib/spack/spack/ci/__init__.py:1050:8: error[unsupported-operator] Operator `in` is not supported for types `str` and `None`, in comparing `Literal["tags"]` with `None | Unknown`
+ lib/spack/spack/ci/__init__.py:1050:8: error[unsupported-operator] Operator `in` is not supported between objects of type `Literal["tags"]` and `None | Unknown`
- lib/spack/spack/graph.py:131:31: error[unsupported-operator] Operator `in` is not supported for types `Unknown` and `None`, in comparing `Unknown` with `Unknown | None | list[Unknown | list[Unknown]]`
+ lib/spack/spack/graph.py:131:31: error[unsupported-operator] Operator `in` is not supported between objects of type `Unknown` and `Unknown | None | list[Unknown | list[Unknown]]`
- lib/spack/spack/test/llnl/util/lang.py:208:12: error[unsupported-operator] Operator `<` is not supported for types `KeyComparable` and `KeyComparable`
+ lib/spack/spack/test/llnl/util/lang.py:208:12: error[unsupported-operator] Operator `<` is not supported between two objects of type `KeyComparable`
- lib/spack/spack/test/llnl/util/lang.py:209:12: error[unsupported-operator] Operator `>` is not supported for types `KeyComparable` and `KeyComparable`
+ lib/spack/spack/test/llnl/util/lang.py:209:12: error[unsupported-operator] Operator `>` is not supported between two objects of type `KeyComparable`
- lib/spack/spack/test/llnl/util/lang.py:211:12: error[unsupported-operator] Operator `<=` is not supported for types `KeyComparable` and `KeyComparable`
+ lib/spack/spack/test/llnl/util/lang.py:211:12: error[unsupported-operator] Operator `<=` is not supported between two objects of type `KeyComparable`
- lib/spack/spack/test/llnl/util/lang.py:212:12: error[unsupported-operator] Operator `>=` is not supported for types `KeyComparable` and `KeyComparable`
+ lib/spack/spack/test/llnl/util/lang.py:212:12: error[unsupported-operator] Operator `>=` is not supported between two objects of type `KeyComparable`
- lib/spack/spack/test/llnl/util/lang.py:214:12: error[unsupported-operator] Operator `<=` is not supported for types `KeyComparable` and `KeyComparable`
+ lib/spack/spack/test/llnl/util/lang.py:214:12: error[unsupported-operator] Operator `<=` is not supported between two objects of type `KeyComparable`
- lib/spack/spack/test/llnl/util/lang.py:215:12: error[unsupported-operator] Operator `<=` is not supported for types `KeyComparable` and `KeyComparable`
+ lib/spack/spack/test/llnl/util/lang.py:215:12: error[unsupported-operator] Operator `<=` is not supported between two objects of type `KeyComparable`
- lib/spack/spack/test/llnl/util/lang.py:216:12: error[unsupported-operator] Operator `>=` is not supported for types `KeyComparable` and `KeyComparable`
+ lib/spack/spack/test/llnl/util/lang.py:216:12: error[unsupported-operator] Operator `>=` is not supported between two objects of type `KeyComparable`
- lib/spack/spack/test/llnl/util/lang.py:217:12: error[unsupported-operator] Operator `>=` is not supported for types `KeyComparable` and `KeyComparable`
+ lib/spack/spack/test/llnl/util/lang.py:217:12: error[unsupported-operator] Operator `>=` is not supported between two objects of type `KeyComparable`
- lib/spack/spack/vendor/typing_extensions.py:113:42: error[unsupported-operator] Operator `>` is not supported for types `int` and `object`, in comparing `int` with `~AlwaysFalsy | int`
+ lib/spack/spack/vendor/typing_extensions.py:113:42: error[unsupported-operator] Operator `>` is not supported between objects of type `int` and `~AlwaysFalsy | int`

beartype (https://github.com/beartype/beartype)
- beartype/claw/_package/clawpkgtrie.py:66:29: warning[unsupported-base] Unsupported class base with type `<class 'dict[str, PackagesTrieBlacklist]'> | <class 'dict[str, Divergent]'>`
- beartype/claw/_package/clawpkgtrie.py:247:29: warning[unsupported-base] Unsupported class base with type `<class 'dict[str, PackagesTrieWhitelist]'> | <class 'dict[str, Divergent]'>`
- Found 498 diagnostics
+ Found 496 diagnostics

stone (https://github.com/dropbox/stone)
- stone/frontend/lexer.py:69:34: error[unsupported-operator] Operator `>` is not supported for types `None` and `int`, in comparing `Unknown | None | Literal[0]` with `Literal[0]`
+ stone/frontend/lexer.py:69:34: error[unsupported-operator] Operator `>` is not supported between objects of type `Unknown | None | Literal[0]` and `Literal[0]`
- stone/ir/data_types.py:1095:16: error[unsupported-operator] Operator `in` is not supported for types `Unknown` and `None`, in comparing `Unknown` with `Unknown | None | dict[Unknown, Unknown]`
+ stone/ir/data_types.py:1095:16: error[unsupported-operator] Operator `in` is not supported between objects of type `Unknown` and `Unknown | None | dict[Unknown, Unknown]`
- stone/ir/data_types.py:1263:16: error[unsupported-operator] Operator `in` is not supported for types `Unknown` and `None`, in comparing `Unknown` with `Unknown | None | OrderedDict[Unknown, Unknown]`
+ stone/ir/data_types.py:1263:16: error[unsupported-operator] Operator `in` is not supported between objects of type `Unknown` and `Unknown | None | OrderedDict[Unknown, Unknown]`
- stone/ir/data_types.py:1291:16: error[unsupported-operator] Operator `in` is not supported for types `Unknown` and `None`, in comparing `Unknown` with `Unknown | None | OrderedDict[Unknown, Unknown]`
+ stone/ir/data_types.py:1291:16: error[unsupported-operator] Operator `in` is not supported between objects of type `Unknown` and `Unknown | None | OrderedDict[Unknown, Unknown]`
- stone/ir/data_types.py:1344:16: error[unsupported-operator] Operator `in` is not supported for types `Unknown` and `None`, in comparing `Unknown` with `Unknown | None | OrderedDict[Unknown, Unknown]`
+ stone/ir/data_types.py:1344:16: error[unsupported-operator] Operator `in` is not supported between objects of type `Unknown` and `Unknown | None | OrderedDict[Unknown, Unknown]`
- stone/ir/data_types.py:1487:12: error[unsupported-operator] Operator `in` is not supported for types `Unknown` and `None`, in comparing `Unknown` with `Unknown | None | OrderedDict[Unknown, Unknown]`
+ stone/ir/data_types.py:1487:12: error[unsupported-operator] Operator `in` is not supported between objects of type `Unknown` and `Unknown | None | OrderedDict[Unknown, Unknown]`
- stone/ir/data_types.py:1527:12: error[unsupported-operator] Operator `in` is not supported for types `Unknown` and `None`, in comparing `Unknown` with `Unknown | None | OrderedDict[Unknown, Unknown]`
+ stone/ir/data_types.py:1527:12: error[unsupported-operator] Operator `in` is not supported between objects of type `Unknown` and `Unknown | None | OrderedDict[Unknown, Unknown]`

werkzeug (https://github.com/pallets/werkzeug)
- src/werkzeug/utils.py:501:12: error[unsupported-operator] Operator `>` is not supported for types `(str | None, /) -> int | None` and `Literal[0]`, in comparing `(int & ~(() -> object)) | (((str | None, /) -> int | None) & ~(() -> object)) | (@Todo & ~None)` with `Literal[0]`
+ src/werkzeug/utils.py:501:12: error[unsupported-operator] Operator `>` is not supported between objects of type `(int & ~(() -> object)) | (((str | None, /) -> int | None) & ~(() -> object)) | (@Todo & ~None)` and `Literal[0]`
- tests/middleware/test_http_proxy.py:45:12: error[unsupported-operator] Operator `not in` is not supported for types `str` and `None`, in comparing `Literal["HTTP_X_SPECIAL"]` with `Any | None`
+ tests/middleware/test_http_proxy.py:45:12: error[unsupported-operator] Operator `not in` is not supported between objects of type `Literal["HTTP_X_SPECIAL"]` and `Any | None`
- tests/test_datastructures.py:863:16: error[unsupported-operator] Operator `not in` is not supported for types `int` and `EnvironHeaders`, in comparing `Literal[42]` with `(Unknown & ~AlwaysFalsy) | (EnvironHeaders & ~AlwaysFalsy)`
+ tests/test_datastructures.py:863:16: error[unsupported-operator] Operator `not in` is not supported between objects of type `Literal[42]` and `(Unknown & ~AlwaysFalsy) | (EnvironHeaders & ~AlwaysFalsy)`

jinja (https://github.com/pallets/jinja)
- tests/test_loader.py:94:16: error[unsupported-operator] Operator `in` is not supported for types `tuple[ReferenceType[DictLoader], Literal["one"]]` and `None`, in comparing `tuple[ReferenceType[DictLoader], Literal["one"]]` with `Unknown | MutableMapping[tuple[ReferenceType[BaseLoader], str], Template] | None`
- tests/test_loader.py:95:16: error[unsupported-operator] Operator `not in` is not supported for types `tuple[ReferenceType[DictLoader], Literal["two"]]` and `None`, in comparing `tuple[ReferenceType[DictLoader], Literal["two"]]` with `Unknown | MutableMapping[tuple[ReferenceType[BaseLoader], str], Template] | None`
- tests/test_loader.py:96:16: error[unsupported-operator] Operator `in` is not supported for types `tuple[ReferenceType[DictLoader], Literal["three"]]` and `None`, in comparing `tuple[ReferenceType[DictLoader], Literal["three"]]` with `Unknown | MutableMapping[tuple[ReferenceType[BaseLoader], str], Template] | None`
+ tests/test_loader.py:94:16: error[unsupported-operator] Operator `in` is not supported between objects of type `tuple[ReferenceType[DictLoader], Literal["one"]]` and `Unknown | MutableMapping[tuple[ReferenceType[BaseLoader], str], Template] | None`
+ tests/test_loader.py:95:16: error[unsupported-operator] Operator `not in` is not supported between objects of type `tuple[ReferenceType[DictLoader], Literal["two"]]` and `Unknown | MutableMapping[tuple[ReferenceType[BaseLoader], str], Template] | None`
+ tests/test_loader.py:96:16: error[unsupported-operator] Operator `in` is not supported between objects of type `tuple[ReferenceType[DictLoader], Literal["three"]]` and `Unknown | MutableMapping[tuple[ReferenceType[BaseLoader], str], Template] | None`

aiortc (https://github.com/aiortc/aiortc)
- src/aiortc/rate.py:498:15: error[unsupported-operator] Operator `<` is not supported for types `None` and `int`, in comparing `int | None` with `Unknown | int`
+ src/aiortc/rate.py:498:15: error[unsupported-operator] Operator `<` is not supported between objects of type `int | None` and `Unknown | int`
- src/aiortc/rtcrtpreceiver.py:222:14: error[unsupported-operator] Operator `<` is not supported for types `int` and `None`, in comparing `int` with `int | None`
+ src/aiortc/rtcrtpreceiver.py:222:14: error[unsupported-operator] Operator `<` is not supported between objects of type `int` and `int | None`

scrapy (https://github.com/scrapy/scrapy)
- tests/test_loader.py:64:8: error[unsupported-operator] Operator `in` is not supported for types `str` and `None`, in comparing `Literal["key"]` with `Unknown | None`
+ tests/test_loader.py:64:8: error[unsupported-operator] Operator `in` is not supported between objects of type `Literal["key"]` and `Unknown | None`

paasta (https://github.com/yelp/paasta)
- paasta_tools/cli/cmds/autoscale.py:245:12: error[unsupported-operator] Operator `<=` is not supported for types `int` and `None`, in comparing `Literal[200]` with `Unknown | None`
+ paasta_tools/cli/cmds/autoscale.py:245:12: error[unsupported-operator] Operator `<=` is not supported between objects of type `Literal[200]` and `Unknown | None`
- paasta_tools/cli/cmds/autoscale.py:245:19: error[unsupported-operator] Operator `<=` is not supported for types `None` and `int`, in comparing `Unknown | None` with `Literal[299]`
+ paasta_tools/cli/cmds/autoscale.py:245:19: error[unsupported-operator] Operator `<=` is not supported between objects of type `Unknown | None` and `Literal[299]`
- paasta_tools/paastaapi/model_utils.py:275:29: error[unsupported-operator] Operator `in` is not supported for types `Unknown` and `None`, in comparing `Unknown & ~None` with `None | Unknown`
+ paasta_tools/paastaapi/model_utils.py:275:29: error[unsupported-operator] Operator `in` is not supported between objects of type `Unknown & ~None` and `None | Unknown`
- paasta_tools/setup_prometheus_adapter_config.py:816:8: error[unsupported-operator] Operator `in` is not supported for types `str` and `None`, in comparing `Literal["seriesQuery"]` with `dict[Unknown, Unknown] | None`
+ paasta_tools/setup_prometheus_adapter_config.py:816:8: error[unsupported-operator] Operator `in` is not supported between objects of type `Literal["seriesQuery"]` and `dict[Unknown, Unknown] | None`

pytest (https://github.com/pytest-dev/pytest)
- testing/test_assertrewrite.py:140:28: error[unsupported-operator] Operator `<=` is not supported for types `int` and `None`, in comparing `tuple[Literal[3], Literal[0]]` with `Unknown | tuple[int | None, int | None]`
- testing/test_assertrewrite.py:140:38: error[unsupported-operator] Operator `<=` is not supported for types `None` and `int`, in comparing `Unknown | tuple[int | None, int | None]` with `tuple[Literal[6], Literal[3]]`
+ testing/test_assertrewrite.py:140:28: error[unsupported-operator] Operator `<=` is not supported between objects of type `tuple[Literal[3], Literal[0]]` and `Unknown | tuple[int | None, int | None]`
+ testing/test_assertrewrite.py:140:38: error[unsupported-operator] Operator `<=` is not supported between objects of type `Unknown | tuple[int | None, int | None]` and `tuple[Literal[6], Literal[3]]`

kopf (https://github.com/nolar/kopf)
- kopf/_cogs/structs/credentials.py:161:16: error[unsupported-operator] Operator `not in` is not supported for types `str` and `None`, in comparing `str` with `dict[str, object] | None`
+ kopf/_cogs/structs/credentials.py:161:16: error[unsupported-operator] Operator `not in` is not supported between objects of type `str` and `dict[str, object] | None`
- kopf/_cogs/structs/credentials.py:163:24: error[unsupported-operator] Operator `not in` is not supported for types `str` and `None`, in comparing `str` with `dict[str, object] | None`
+ kopf/_cogs/structs/credentials.py:163:24: error[unsupported-operator] Operator `not in` is not supported between objects of type `str` and `dict[str, object] | None`
- kopf/_cogs/structs/references.py:304:45: error[unsupported-operator] Operator `in` is not supported for types `str` and `Marker`, in comparing `Literal["."]` with `str | Marker | None`
+ kopf/_cogs/structs/references.py:304:45: error[unsupported-operator] Operator `in` is not supported between objects of type `Literal["."]` and `str | Marker | None`
- kopf/_cogs/structs/references.py:309:42: error[unsupported-operator] Operator `in` is not supported for types `str` and `Marker`, in comparing `Literal["/"]` with `str | Marker | None`
+ kopf/_cogs/structs/references.py:309:42: error[unsupported-operator] Operator `in` is not supported between objects of type `Literal["/"]` and `str | Marker | None`

rich (https://github.com/Textualize/rich)
- rich/prompt.py:361:12: error[unsupported-operator] Operator `not in` is not supported for types `str` and `None`, in comparing `str` with `list[str] | None`
+ rich/prompt.py:361:12: error[unsupported-operator] Operator `not in` is not supported between objects of type `str` and `list[str] | None`

pylint (https://github.com/pycqa/pylint)
- pylint/checkers/unicode.py:171:12: error[unsupported-operator] Operator `not in` is not supported for types `_StrLike@_map_positions_to_result` and `_StrLike@_map_positions_to_result`
+ pylint/checkers/unicode.py:171:12: error[unsupported-operator] Operator `not in` is not supported between two objects of type `_StrLike@_map_positions_to_result`

dulwich (https://github.com/dulwich/dulwich)
- dulwich/object_store.py:2813:12: error[unsupported-operator] Operator `in` is not supported for types `ObjectID` and `() -> dict[ObjectID, ObjectID]`, in comparing `ObjectID` with `Unknown | ((() -> dict[ObjectID, ObjectID]) & ~AlwaysTruthy & ~AlwaysFalsy) | dict[Unknown, Unknown]`
+ dulwich/object_store.py:2813:12: error[unsupported-operator] Operator `in` is not supported between objects of type `ObjectID` and `Unknown | ((() -> dict[ObjectID, ObjectID]) & ~AlwaysTruthy & ~AlwaysFalsy) | dict[Unknown, Unknown]`
- dulwich/objectspec.py:330:12: error[unsupported-operator] Operator `in` is not supported for types `bytes` and `RefsContainer`, in comparing `Unknown | bytes` with `Repo | RefsContainer`
+ dulwich/objectspec.py:330:12: error[unsupported-operator] Operator `in` is not supported between objects of type `Unknown | bytes` and `Repo | RefsContainer`

ignite (https://github.com/pytorch/ignite)
- ignite/engine/events.py:94:57: error[unsupported-operator] Operator `>` is not supported for types `list[Unknown]` and `int`, in comparing `(int & Integral) | (list[Unknown] & Integral)` with `Literal[0]`
+ ignite/engine/events.py:94:57: error[unsupported-operator] Operator `>` is not supported between objects of type `(int & Integral) | (list[Unknown] & Integral)` and `Literal[0]`
- ignite/handlers/lr_finder.py:186:16: error[unsupported-operator] Operator `<` is not supported for types `int` and `None`, in comparing `Unknown | int | float` with `Unknown | None | int | float`
+ ignite/handlers/lr_finder.py:186:16: error[unsupported-operator] Operator `<` is not supported between objects of type `Unknown | int | float` and `Unknown | None | int | float`
- tests/ignite/distributed/test_launcher.py:281:16: error[unsupported-operator] Operator `in` is not supported for types `str` and `None`, in comparing `Literal["nproc_per_node"]` with `Unknown | None | dict[Unknown, Unknown]`
+ tests/ignite/distributed/test_launcher.py:281:16: error[unsupported-operator] Operator `in` is not supported between objects of type `Literal["nproc_per_node"]` and `Unknown | None | dict[Unknown, Unknown]`
- tests/ignite/distributed/test_launcher.py:282:16: error[unsupported-operator] Operator `in` is not supported for types `str` and `None`, in comparing `Literal["start_method"]` with `Unknown | None | dict[Unknown, Unknown]`
+ tests/ignite/distributed/test_launcher.py:282:16: error[unsupported-operator] Operator `in` is not supported between objects of type `Literal["start_method"]` and `Unknown | None | dict[Unknown, Unknown]`
- tests/ignite/distributed/utils/__init__.py:131:8: error[unsupported-operator] Operator `in` is not supported for types `None` and `str`, in comparing `str | None` with `Literal["horovod"]`
+ tests/ignite/distributed/utils/__init__.py:131:8: error[unsupported-operator] Operator `in` is not supported between objects of type `str | None` and `Literal["horovod"]`
- tests/ignite/distributed/utils/__init__.py:143:8: error[unsupported-operator] Operator `in` is not supported for types `None` and `str`, in comparing `str | None` with `Literal["horovod"]`
+ tests/ignite/distributed/utils/__init__.py:143:8: error[unsupported-operator] Operator `in` is not supported between objects of type `str | None` and `Literal["horovod"]`
- tests/ignite/distributed/utils/__init__.py:154:10: error[unsupported-operator] Operator `in` is not supported for types `None` and `str`, in comparing `None | str` with `Literal["xla-tpu"]`
+ tests/ignite/distributed/utils/__init__.py:154:10: error[unsupported-operator] Operator `in` is not supported between objects of type `None | str` and `Literal["xla-tpu"]`
- tests/ignite/distributed/utils/__init__.py:157:10: error[unsupported-operator] Operator `in` is not supported for types `None` and `str`, in comparing `None | str` with `Literal["horovod"]`
+ tests/ignite/distributed/utils/__init__.py:157:10: error[unsupported-operator] Operator `in` is not supported between objects of type `None | str` and `Literal["horovod"]`
- tests/ignite/distributed/utils/__init__.py:255:8: error[unsupported-operator] Operator `in` is not supported for types `None` and `str`, in comparing `str | None` with `Literal["xla-tpu"]`
+ tests/ignite/distributed/utils/__init__.py:255:8: error[unsupported-operator] Operator `in` is not supported between objects of type `str | None` and `Literal["xla-tpu"]`
- tests/ignite/distributed/utils/__init__.py:258:10: error[unsupported-operator] Operator `in` is not supported for types `None` and `str`, in comparing `None | str` with `Literal["horovod"]`
+ tests/ignite/distributed/utils/__init__.py:258:10: error[unsupported-operator] Operator `in` is not supported between objects of type `None | str` and `Literal["horovod"]`
- tests/ignite/distributed/utils/__init__.py:286:10: error[unsupported-operator] Operator `in` is not supported for types `None` and `str`, in comparing `None | str` with `Literal["xla-tpu"]`
+ tests/ignite/distributed/utils/__init__.py:286:10: error[unsupported-operator] Operator `in` is not supported between objects of type `None | str` and `Literal["xla-tpu"]`
- tests/ignite/distributed/utils/__init__.py:417:40: error[unsupported-operator] Operator `in` is not supported for types `None` and `str`, in comparing `str | None` with `Literal["xla-tpu"]`
+ tests/ignite/distributed/utils/__init__.py:417:40: error[unsupported-operator] Operator `in` is not supported between objects of type `str | None` and `Literal["xla-tpu"]`
- tests/ignite/distributed/utils/__init__.py:419:40: error[unsupported-operator] Operator `in` is not supported for types `None` and `str`, in comparing `str | None` with `Literal["horovod"]`
+ tests/ignite/distributed/utils/__init__.py:419:40: error[unsupported-operator] Operator `in` is not supported between objects of type `str | None` and `Literal["horovod"]`
- tests/ignite/handlers/test_time_profilers.py:289:12: error[unsupported-operator] Operator `in` is not supported for types `str` and `int`, in comparing `Literal["delay_start"]` with `str | int | float | tuple[str | int | float, str | int | float]`
+ tests/ignite/handlers/test_time_profilers.py:289:12: error[unsupported-operator] Operator `in` is not supported between objects of type `Literal["delay_start"]` and `str | int | float | tuple[str | int | float, str | int | float]`
- tests/ignite/handlers/test_time_profilers.py:331:12: error[unsupported-operator] Operator `in` is not supported for types `str` and `int`, in comparing `Literal["delay_complete"]` with `str | int | float | tuple[str | int | float, str | int | float]`
+ tests/ignite/handlers/test_time_profilers.py:331:12: error[unsupported-operator] Operator `in` is not supported between objects of type `Literal["delay_complete"]` and `str | int | float | tuple[str | int | float, str | int | float]`
- tests/ignite/handlers/test_time_profilers.py:377:12: error[unsupported-operator] Operator `in` is not supported for types `str` and `int`, in comparing `Literal["delay_epoch_start"]` with `str | int | float | tuple[str | int | float, str | int | float]`
+ tests/ignite/handlers/test_time_profilers.py:377:12: error[unsupported-operator] Operator `in` is not supported between objects of type `Literal["delay_epoch_start"]` and `str | int | float | tuple[str | int | float, str | int | float]`
- tests/ignite/handlers/test_time_profilers.py:427:12: error[unsupported-operator] Operator `in` is not supported for types `str` and `int`, in comparing `Literal["delay_epoch_complete"]` with `str | int | float | tuple[str | int | float, str | int | float]`
+ tests/ignite/handlers/test_time_profilers.py:427:12: error[unsupported-operator] Operator `in` is not supported between objects of type `Literal["delay_epoch_complete"]` and `str | int | float | tuple[str | int | float, str | int | float]`
- tests/ignite/handlers/test_time_profilers.py:477:12: error[unsupported-operator] Operator `in` is not supported for types `str` and `int`, in comparing `Literal["delay_iter_start"]` with `str | int | float | tuple[str | int | float, str | int | float]`
+ tests/ignite/handlers/test_time_profilers.py:477:12: error[unsupported-operator] Operator `in` is not supported between objects of type `Literal["delay_iter_start"]` and `str | int | float | tuple[str | int | float, str | int | float]`
- tests/ignite/handlers/test_time_profilers.py:527:12: error[unsupported-operator] Operator `in` is not supported for types `str` and `int`, in comparing `Literal["delay_iter_complete"]` with `str | int | float | tuple[str | int | float, str | int | float]`
+ tests/ignite/handlers/test_time_profilers.py:527:12: error[unsupported-operator] Operator `in` is not supported between objects of type `Literal["delay_iter_complete"]` and `str | int | float | tuple[str | int | float, str | int | float]`
- tests/ignite/handlers/test_time_profilers.py:577:12: error[unsupported-operator] Operator `in` is not supported for types `str` and `int`, in comparing `Literal["delay_get_batch_started"]` with `str | int | float | tuple[str | int | float, str | int | float]`
+ tests/ignite/handlers/test_time_profilers.py:577:12: error[unsupported-operator] Operator `in` is not supported between objects of type `Literal["delay_get_batch_started"]` and `str | int | float | tuple[str | int | float, str | int | float]`
- tests/ignite/handlers/test_time_profilers.py:627:12: error[unsupported-operator] Operator `in` is not supported for types `str` and `int`, in comparing `Literal["delay_get_batch_completed"]` with `str | int | float | tuple[str | int | float, str | int | float]`
+ tests/ignite/handlers/test_time_profilers.py:627:12: error[unsupported-operator] Operator `in` is not supported between objects of type `Literal["delay_get_batch_completed"]` and `str | int | float | tuple[str | int | float, str | int | float]`
- tests/ignite/handlers/test_time_profilers.py:653:12: error[unsupported-operator] Operator `in` is not supported for types `str` and `int`, in comparing `Literal["do_something_once_on_2_epoch"]` with `str | int | float | tuple[str | int | float, str | int | float]`
+ tests/ignite/handlers/test_time_profilers.py:653:12: error[unsupported-operator] Operator `in` is not supported between objects of type `Literal["do_something_once_on_2_epoch"]` and `str | int | float | tuple[str | int | float, str | int | float]`
- tests/ignite/handlers/test_time_profilers.py:674:12: error[unsupported-operator] Operator `in` is not supported for types `str` and `int`, in comparing `Literal["do_something_once_on_2_epoch"]` with `str | int | float | tuple[str | int | float, str | int | float]`
+ tests/ignite/handlers/test_time_profilers.py:674:12: error[unsupported-operator] Operator `in` is not supported between objects of type `Literal["do_something_once_on_2_epoch"]` and `str | int | float | tuple[str | int | float, str | int | float]`
- tests/ignite/handlers/test_time_profilers.py:709:12: error[unsupported-operator] Operator `in` is not supported for types `str` and `int`, in comparing `Literal["on_custom_event"]` with `str | int | float | tuple[str | int | float, str | int | float]`
+ tests/ignite/handlers/test_time_profilers.py:709:12: error[unsupported-operator] Operator `in` is not supported between objects of type `Literal["on_custom_event"]` and `str | int | float | tuple[str | int | float, str | int | float]`

mkosi (https://github.com/systemd/mkosi)
- mkosi/__init__.py:1740:13: error[unsupported-operator] Operator `>=` is not supported for types `GenericVersion` and `str`, in comparing `GenericVersion` with `Literal["258"]`
+ mkosi/__init__.py:1740:13: error[unsupported-operator] Operator `>=` is not supported between objects of type `GenericVersion` and `Literal["258"]`
- mkosi/__init__.py:1800:13: error[unsupported-operator] Operator `>=` is not supported for types `GenericVersion` and `str`, in comparing `GenericVersion` with `Literal["256"]`
+ mkosi/__init__.py:1800:13: error[unsupported-operator] Operator `>=` is not supported between objects of type `GenericVersion` and `Literal["256"]`
- mkosi/__init__.py:1807:17: error[unsupported-operator] Operator `>=` is not supported for types `GenericVersion` and `str`, in comparing `GenericVersion & ~AlwaysFalsy` with `Literal["256"]`
+ mkosi/__init__.py:1807:17: error[unsupported-operator] Operator `>=` is not supported between objects of type `GenericVersion & ~AlwaysFalsy` and `Literal["256"]`
- mkosi/__init__.py:3386:17: error[unsupported-operator] Operator `>=` is not supported for types `GenericVersion` and `int`, in comparing `GenericVersion` with `Literal[256]`
+ mkosi/__init__.py:3386:17: error[unsupported-operator] Operator `>=` is not supported between objects of type `GenericVersion` and `Literal[256]`
- mkosi/__init__.py:3391:17: error[unsupported-operator] Operator `>=` is not supported for types `GenericVersion` and `int`, in comparing `GenericVersion` with `Literal[258]`
+ mkosi/__init__.py:3391:17: error[unsupported-operator] Operator `>=` is not supported between objects of type `GenericVersion` and `Literal[258]`
- mkosi/bootloader.py:739:83: error[unsupported-operator] Operator `>=` is not supported for types `GenericVersion` and `str`, in comparing `GenericVersion` with `Literal["257"]`
+ mkosi/bootloader.py:739:83: error[unsupported-operator] Operator `>=` is not supported between objects of type `GenericVersion` and `Literal["257"]`
- mkosi/config.py:1559:8: error[unsupported-operator] Operator `>` is not supported for types `GenericVersion` and `str`, in comparing `GenericVersion` with `Literal["26~devel"]`
+ mkosi/config.py:1559:8: error[unsupported-operator] Operator `>` is not supported between objects of type `GenericVersion` and `Literal["26~devel"]`
- mkosi/config.py:1565:21: error[unsupported-operator] Operator `>` is not supported for types `GenericVersion` and `str`, in comparing `GenericVersion` with `str & ~AlwaysFalsy`
+ mkosi/config.py:1565:21: error[unsupported-operator] Operator `>` is not supported between objects of type `GenericVersion` and `str & ~AlwaysFalsy`
- mkosi/distribution/centos.py:61:13: error[unsupported-operator] Operator `>` is not supported for types `GenericVersion` and `int`, in comparing `GenericVersion` with `Literal[9]`
+ mkosi/distribution/centos.py:61:13: error[unsupported-operator] Operator `>` is not supported between objects of type `GenericVersion` and `Literal[9]`
- mkosi/distribution/centos.py:70:12: error[unsupported-operator] Operator `<=` is not supported for types `GenericVersion` and `int`, in comparing `GenericVersion` with `Literal[8]`
+ mkosi/distribution/centos.py:70:12: error[unsupported-operator] Operator `<=` is not supported between objects of type `GenericVersion` and `Literal[8]`
- mkosi/distribution/centos.py:255:12: error[unsupported-operator] Operator `>=` is not supported for types `GenericVersion` and `int`, in comparing `GenericVersion` with `Literal[10]`
+ mkosi/distribution/centos.py:255:12: error[unsupported-operator] Operator `>=` is not supported between objects of type `GenericVersion` and `Literal[10]`
- mkosi/distribution/opensuse.py:60:60: error[unsupported-operator] Operator `>=` is not supported for types `GenericVersion` and `int`, in comparing `GenericVersion` with `Literal[16]`
+ mkosi/distribution/opensuse.py:60:60: error[unsupported-operator] Operator `>=` is not supported between objects of type `GenericVersion` and `Literal[16]`
- mkosi/distribution/opensuse.py:224:20: error[unsupported-operator] Operator `>=` is not supported for types `GenericVersion` and `int`, in comparing `GenericVersion` with `Literal[16]`
+ mkosi/distribution/opensuse.py:224:20: error[unsupported-operator] Operator `>=` is not supported between objects of type `GenericVersion` and `Literal[16]`
- mkosi/qemu.py:277:24: error[unsupported-operator] Operator `>=` is not supported for types `GenericVersion` and `str`, in comparing `GenericVersion` with `Literal["0.10.0"]`
+ mkosi/qemu.py:277:24: error[unsupported-operator] Operator `>=` is not supported between objects of type `GenericVersion` and `Literal["0.10.0"]`
- mkosi/qemu.py:962:42: error[unsupported-operator] Operator `>=` is not supported for types `GenericVersion` and `int`, in comparing `GenericVersion` with `Literal[254]`
+ mkosi/qemu.py:962:42: error[unsupported-operator] Operator `>=` is not supported between objects of type `GenericVersion` and `Literal[254]`
- mkosi/qemu.py:1122:9: error[unsupported-operator] Operator `>=` is not supported for types `GenericVersion` and `GenericVersion`
+ mkosi/qemu.py:1122:9: error[unsupported-operator] Operator `>=` is not supported between two objects of type `GenericVersion`
- mkosi/qemu.py:1231:12: error[unsupported-operator] Operator `>=` is not supported for types `GenericVersion` and `GenericVersion`
+ mkosi/qemu.py:1231:12: error[unsupported-operator] Operator `>=` is not supported between two objects of type `GenericVersion`
- mkosi/tree.py:144:69: error[unsupported-operator] Operator `>=` is not supported for types `GenericVersion` and `str`, in comparing `GenericVersion` with `Literal["9.5"]`
+ mkosi/tree.py:144:69: error[unsupported-operator] Operator `>=` is not supported between objects of type `GenericVersion` and `Literal["9.5"]`

PyGithub (https://github.com/PyGithub/PyGithub)
- tests/GithubRetry.py:102:53: error[unsupported-operator] Operator `>` is not supported for types `None` and `int`, in comparing `Unknown | None` with `Literal[0]`
+ tests/GithubRetry.py:102:53: error[unsupported-operator] Operator `>` is not supported between objects of type `Unknown | None` and `Literal[0]`

urllib3 (https://github.com/urllib3/urllib3)
- test/test_exceptions.py:58:20: error[unsupported-operator] Operator `in` is not supported for types `object` and `str`
+ test/test_exceptions.py:58:20: error[unsupported-operator] Operator `in` is not supported between objects of type `object` and `str`

mitmproxy (https://github.com/mitmproxy/mitmproxy)
- test/mitmproxy/addons/test_clientplayback.py:175:12: error[unsupported-operator] Operator `in` is not supported for types `str` and `None`, in comparing `Literal["live flow"]` with `str | None`
+ test/mitmproxy/addons/test_clientplayback.py:175:12: error[unsupported-operator] Operator `in` is not supported between objects of type `Literal["live flow"]` and `str | None`
- test/mitmproxy/addons/test_clientplayback.py:179:12: error[unsupported-operator] Operator `in` is not supported for types `str` and `None`, in comparing `Literal["intercepted flow"]` with `str | None`
+ test/mitmproxy/addons/test_clientplayback.py:179:12: error[unsupported-operator] Operator `in` is not supported between objects of type `Literal["intercepted flow"]` and `str | None`
- test/mitmproxy/addons/test_clientplayback.py:183:12: error[unsupported-operator] Operator `in` is not supported for types `str` and `None`, in comparing `Literal["missing request"]` with `str | None`
+ test/mitmproxy/addons/test_clientplayback.py:183:12: error[unsupported-operator] Operator `in` is not supported between objects of type `Literal["missing request"]` and `str | None`
- test/mitmproxy/addons/test_clientplayback.py:187:12: error[unsupported-operator] Operator `in` is not supported for types `str` and `None`, in comparing `Literal["missing content"]` with `str | None`
+ test/mitmproxy/addons/test_clientplayback.py:187:12: error[unsupported-operator] Operator `in` is not supported between objects of type `Literal["missing content"]` and `str | None`
- test/mitmproxy/addons/test_clientplayback.py:191:16: error[unsupported-operator] Operator `in` is not supported for types `str` and `None`, in comparing `Literal["Can only replay HTTP"]` with `str | None`
+ test/mitmproxy/addons/test_clientplayback.py:191:16: error[unsupported-operator] Operator `in` is not supported between objects of type `Literal["Can only replay HTTP"]` and `str | None`
- test/mitmproxy/addons/test_cut.py:58:12: error[unsupported-operator] Operator `in` is not supported for types `str` and `bytes`, in comparing `Literal["CERTIFICATE"]` with `str | bytes`
+ test/mitmproxy/addons/test_cut.py:58:12: error[unsupported-operator] Operator `in` is not supported between objects of type `Literal["CERTIFICATE"]` and `str | bytes`
- test/mitmproxy/addons/test_cut.py:65:12: error[unsupported-operator] Operator `in` is not supported for types `bytes` and `str`, in comparing `Literal[b"hello binary"]` with `str | bytes`
+ test/mitmproxy/addons/test_cut.py:65:12: error[unsupported-operator] Operator `in` is not supported between objects of type `Literal[b"hello binary"]` and `str | bytes`
- test/mitmproxy/addons/test_cut.py:66:12: error[unsupported-operator] Operator `in` is not supported for types `bytes` and `str`, in comparing `Literal[b"hello text"]` with `str | bytes`
+ test/mitmproxy/addons/test_cut.py:66:12: error[unsupported-operator] Operator `in` is not supported between objects of type `Literal[b"hello text"]` and `str | bytes`
- test/mitmproxy/addons/test_cut.py:67:12: error[unsupported-operator] Operator `in` is not supported for types `bytes` and `str`, in comparing `Literal[b"it's me"]` with `str | bytes`
+ test/mitmproxy/addons/test_cut.py:67:12: error[unsupported-operator] Operator `in` is not supported between objects of type `Literal[b"it's me"]` and `str | bytes`
- test/mitmproxy/addons/test_cut.py:68:12: error[unsupported-operator] Operator `in` is not supported for types `bytes` and `str`, in comparing `Literal[b"hello binary"]` with `str | bytes`
+ test/mitmproxy/addons/test_cut.py:68:12: error[unsupported-operator] Operator `in` is not supported between objects of type `Literal[b"hello binary"]` and `str | bytes`
- test/mitmproxy/addons/test_cut.py:69:12: error[unsupported-operator] Operator `in` is not supported for types `bytes` and `str`, in comparing `Literal[b"hello text"]` with `str | bytes`
+ test/mitmproxy/addons/test_cut.py:69:12: error[unsupported-operator] Operator `in` is not supported between objects of type `Literal[b"hello text"]` and `str | bytes`
- test/mitmproxy/addons/test_cut.py:70:12: error[unsupported-operator] Operator `in` is not supported for types `bytes` and `str`, in comparing `Literal[b"it's me"]` with `str | bytes`
+ test/mitmproxy/addons/test_cut.py:70:12: error[unsupported-operator] Operator `in` is not supported between objects of type `Literal[b"it's me"]` and `str | bytes`
- test/mitmproxy/addons/test_proxyserver.py:209:16: error[unsupported-operator] Operator `in` is not supported for types `str` and `None`, in comparing `Literal["Request destination unknown"]` with `str | None`
+ test/mitmproxy/addons/test_proxyserver.py:209:16: error[unsupported-operator] Operator `in` is not supported between objects of type `Literal["Request destination unknown"]` and `str | None`
- test/mitmproxy/test_http.py:1119:16: error[unsupported-operator] Operator `in` is not supported for types `str` and `None`, in comparing `Literal["鏄庝集"]` with `str | None`
+ test/mitmproxy/test_http.py:1119:16: error[unsupported-operator] Operator `in` is not supported between objects of type `Literal["鏄庝集"]` and `str | None`
- test/mitmproxy/test_http.py:1128:16: error[unsupported-operator] Operator `not in` is not supported for types `str` and `None`, in comparing `Literal["鏄庝集"]` with `str | None`
+ test/mitmproxy/test_http.py:1128:16: error[unsupported-operator] Operator `not in` is not supported between objects of type `Literal["鏄庝集"]` and `str | None`
- test/mitmproxy/test_http.py:1137:16: error[unsupported-operator] Operator `not in` is not supported for types `str` and `None`, in comparing `Literal["鏄庝集"]` with `str | None`
+ test/mitmproxy/test_http.py:1137:16: error[unsupported-operator] Operator `not in` is not supported between objects of type `Literal["鏄庝集"]` and `str | None`
- test/mitmproxy/test_http.py:1146:16: error[unsupported-operator] Operator `in` is not supported for types `str` and `None`, in comparing `Literal["鏄庝集"]` with `str | None`
+ test/mitmproxy/test_http.py:1146:16: error[unsupported-operator] Operator `in` is not supported between objects of type `Literal["鏄庝集"]` and `str | None`

vision (https://github.com/pytorch/vision)
- test/datasets_utils.py:370:12: error[unsupported-operator] Operator `in` is not supported for types `str` and `None`, in comparing `Literal["download"]` with `Unknown | None`
+ test/datasets_utils.py:370:12: error[unsupported-operator] Operator `in` is not supported between objects of type `Literal["download"]` and `Unknown | None`
- test/datasets_utils.py:564:16: error[unsupported-operator] Operator `not in` is not supported for types `Unknown` and `None`, in comparing `Unknown | str` with `Unknown | None`
+ test/datasets_utils.py:564:16: error[unsupported-operator] Operator `not in` is not supported between objects of type `Unknown | str` and `Unknown | None`
- test/test_image.py:221:8: error[unsupported-operator] Operator `>=` is not supported for types `str` and `tuple[Literal[8], Literal[3]]`, in comparing `Literal["12.0.0"]` with `tuple[Literal[8], Literal[3]]`
+ test/test_image.py:221:8: error[unsupported-operator] Operator `>=` is not supported between objects of type `Literal["12.0.0"]` and `tuple[Literal[8], Literal[3]]`
- test/test_utils.py:127:8: error[unsupported-operator] Operator `>=` is not supported for types `str` and `tuple[Literal[10], Literal[1]]`, in comparing `Literal["12.0.0"]` with 

... (truncated 1443 lines) ...

No memory usage changes detected ✅

@astral-sh-bot
Copy link

astral-sh-bot bot commented Dec 1, 2025

ecosystem-analyzer results

Lint rule Added Removed Changed
unsupported-operator 0 0 814
unsupported-base 0 1 0
Total 0 1 814

Full report with detailed diff (timing results)

Copy link
Member

@MichaReiser MichaReiser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, I mainly reviewed the diagnostics and I think we should make them more concise

@AlexWaygood AlexWaygood force-pushed the alex/operator-disambiguate branch from 577f7b9 to 32f053c Compare December 2, 2025 15:09
@codspeed-hq
Copy link

codspeed-hq bot commented Dec 2, 2025

CodSpeed Performance Report

Merging #21737 will not alter performance

Comparing alex/operator-disambiguate (a68fafc) with main (515de2d)

Summary

✅ 22 untouched
⏩ 30 skipped1

Footnotes

  1. 30 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@AlexWaygood AlexWaygood force-pushed the alex/operator-disambiguate branch 2 times, most recently from 460168e to bcf5c78 Compare December 2, 2025 19:45
@AlexWaygood
Copy link
Member Author

Some final screenshots now that I've addressed review comments. Much more concise than the initial version in this PR:

image

and the concise diagnostics for the same errors:

foo.py:1:1: error[unsupported-operator] Operator `<` is not supported between objects of type `Literal[1]` and `Literal["foo"]`
foo.py:2:1: error[unsupported-operator] Operator `<` is not supported between two objects of type `tuple[Literal[1], Literal[2], Literal[3], Literal[4], object]`
foo.py:3:1: error[unsupported-operator] Operator `<` is not supported between objects of type `tuple[Literal[1], Literal[2], Literal[3], Literal[4], Literal["foo"]]` and `tuple[Literal[1], Literal[2], Literal[3], Literal[4], Literal[5]]`
foo.py:7:5: error[unsupported-operator] Operator `<` is not supported between objects of type `int | str` and `int | list[str]`

@AlexWaygood AlexWaygood enabled auto-merge (squash) December 2, 2025 19:48
@AlexWaygood AlexWaygood force-pushed the alex/operator-disambiguate branch from bcf5c78 to a68fafc Compare December 2, 2025 19:53
@AlexWaygood AlexWaygood merged commit 392a8e4 into main Dec 2, 2025
40 checks passed
@AlexWaygood AlexWaygood deleted the alex/operator-disambiguate branch December 2, 2025 19:58
dcreager added a commit that referenced this pull request Dec 3, 2025
* origin/main:
  new module for parsing ranged suppressions (#21441)
  [ty] `type[T]` is assignable to an inferable typevar (#21766)
  Fix syntax error false positives for `await` outside functions (#21763)
  [ty] Improve diagnostics for unsupported comparison operations (#21737)
dcreager added a commit that referenced this pull request Dec 3, 2025
* origin/main:
  [ty] Improve `@override`, `@final` and Liskov checks in cases where there are multiple reachable definitions (#21767)
  [ty] Extend `invalid-explicit-override` to also cover properties decorated with `@override` that do not override anything (#21756)
  [ty] Enable LRU collection for parsed module (#21749)
  [ty] Support typevar-specialized dynamic types in generic type aliases (#21730)
  Add token based `parenthesized_ranges` implementation (#21738)
  [ty] Default-specialization of generic type aliases (#21765)
  [ty] Suppress false positives when `dataclasses.dataclass(...)(cls)` is called imperatively (#21729)
  [syntax-error] Default type parameter followed by non-default type parameter (#21657)
  new module for parsing ranged suppressions (#21441)
  [ty] `type[T]` is assignable to an inferable typevar (#21766)
  Fix syntax error false positives for `await` outside functions (#21763)
  [ty] Improve diagnostics for unsupported comparison operations (#21737)
  Move `Token`, `TokenKind` and `Tokens` to `ruff-python-ast` (#21760)
  [ty] Don't confuse multiple occurrences of `typing.Self` when binding bound methods (#21754)
  Use our org-wide Renovate preset (#21759)
  Delete `my-script.py` (#21751)
  [ty] Move `all_members`, and related types/routines, out of `ide_support.rs` (#21695)
AlexWaygood added a commit that referenced this pull request Dec 12, 2025
…orted augmented assignments (#21947)

## Summary

This PR takes the improvements we made to unsupported-comparison
diagnostics in #21737, and extends
them to other `unsupported-operator` diagnostics.

## Test Plan

Mdtests and snapshots
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

diagnostics Related to reporting of diagnostics. ecosystem-analyzer ty Multi-file analysis & type inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants