[ty] stop unioning Unknown into types of un-annotated attributes#24531
[ty] stop unioning Unknown into types of un-annotated attributes#24531
Conversation
Typing conformance resultsThe percentage of diagnostics emitted that were expected errors increased from 87.72% to 87.79%. The percentage of expected errors that received a diagnostic decreased from 82.85% to 82.81%. The number of fully passing files improved from 74/132 to 75/132. SummaryHow are test cases classified?Each test case represents one expected error annotation or a group of annotations sharing a tag. Counts are per test case, not per diagnostic — multiple diagnostics on the same line count as one. Required annotations (
Test file breakdown2 files altered
False positives removed (1)1 diagnostic
True positives changed (1)1 diagnostic
Optional Diagnostics Removed (2)2 diagnostics
|
Memory usage reportSummary
Significant changesClick to expand detailed breakdownflake8
trio
sphinx
prefect
|
|
| Lint rule | Added | Removed | Changed |
|---|---|---|---|
unresolved-attribute |
211 | 3 | 3,364 |
invalid-argument-type |
225 | 57 | 1,227 |
unsupported-operator |
21 | 7 | 904 |
invalid-assignment |
277 | 87 | 340 |
invalid-return-type |
8 | 6 | 143 |
type-assertion-failure |
0 | 90 | 0 |
not-iterable |
1 | 0 | 78 |
invalid-context-manager |
0 | 0 | 58 |
invalid-await |
0 | 40 | 13 |
no-matching-overload |
16 | 12 | 1 |
not-subscriptable |
20 | 8 | 1 |
invalid-method-override |
17 | 0 | 4 |
division-by-zero |
0 | 10 | 0 |
call-non-callable |
3 | 0 | 6 |
possibly-unresolved-reference |
0 | 9 | 0 |
unused-ignore-comment |
8 | 0 | 0 |
unused-type-ignore-comment |
0 | 8 | 0 |
possibly-missing-attribute |
0 | 0 | 7 |
invalid-key |
6 | 0 | 0 |
call-top-callable |
5 | 0 | 0 |
invalid-yield |
0 | 0 | 5 |
index-out-of-bounds |
0 | 4 | 0 |
invalid-type-form |
4 | 0 | 0 |
missing-typed-dict-key |
0 | 3 | 0 |
invalid-declaration |
0 | 0 | 2 |
missing-argument |
1 | 1 | 0 |
redundant-cast |
2 | 0 | 0 |
too-many-positional-arguments |
0 | 0 | 2 |
unsupported-base |
0 | 1 | 1 |
deprecated |
1 | 0 | 0 |
| Total | 826 | 346 | 6,156 |
Changes in flaky projects detected. Raw diff output excludes flaky projects; see the HTML report for details.
Showing a random sample of 187 of 7225 changes. See the HTML report for the full diff.
Raw diff sample (187 of 7225 changes)
aiortc (https://github.com/aiortc/aiortc)
- src/aiortc/rate.py:225:25 error[invalid-argument-type] Argument to function `uint32_add` is incorrect: Expected `int`, found `Unknown | int | None`
+ src/aiortc/rate.py:225:25 error[invalid-argument-type] Argument to function `uint32_add` is incorrect: Expected `int`, found `int | None`
alerta (https://github.com/alerta/alerta)
- tests/test_scopes.py:83:71 error[invalid-argument-type] Argument to bound method `is_in_scope` is incorrect: Expected `list[Scope]`, found `list[str | Unknown]`
+ tests/test_scopes.py:83:71 error[invalid-argument-type] Argument to bound method `is_in_scope` is incorrect: Expected `list[Scope]`, found `list[str]`
apprise (https://github.com/caronc/apprise)
+ apprise/plugins/email/base.py:761:24 error[invalid-argument-type] Method `__getitem__` of type `bound method dict[str, dict[str, int]].__getitem__(key: str, /) -> dict[str, int]` cannot be called with key of type `int` on object of type `dict[str, dict[str, int]]`
+ apprise/plugins/gotify.py:298:17 error[invalid-argument-type] Method `__getitem__` of type `bound method dict[int, str].__getitem__(key: int, /) -> str` cannot be called with key of type `float` on object of type `dict[int, str]`
+ tests/test_plugin_irc.py:514:5 error[invalid-assignment] Object of type `_DummyTransport` is not assignable to attribute `transport` of type `SocketTransport`
+ tests/test_plugin_irc.py:531:5 error[invalid-assignment] Object of type `_DummyTransport` is not assignable to attribute `transport` of type `SocketTransport`
+ tests/test_utils_socket.py:489:5 error[invalid-assignment] Object of type `_DummyFile` is not assignable to attribute `_wfile` of type `None | SocketIO`
bokeh (https://github.com/bokeh/bokeh)
- src/bokeh/models/plots.py:281:9 error[invalid-assignment] Object of type `list[Tool]` is not assignable to attribute `tools` on type `Unknown | Instance[S@Instance]`
- src/bokeh/models/plots.py:501:57 error[not-iterable] Object of type `Unknown | List[Any]` may not be iterable
+ src/bokeh/models/plots.py:501:57 error[not-iterable] Object of type `List[Any]` is not iterable
- src/bokeh/models/widgets/sliders.py:254:16 error[invalid-return-type] Return type does not match returned value: expected `date | None`, found `(Unknown & ~None & ~Number) | (Required[Unknown] & ~Number)`
+ src/bokeh/models/widgets/sliders.py:254:16 error[invalid-return-type] Return type does not match returned value: expected `date | None`, found `Required[Unknown] & ~Number`
- src/bokeh/plotting/_figure.py:214:55 error[invalid-argument-type] Argument to function `process_axis_and_grid` is incorrect: Expected `Literal["above", "below", "left", "right"] | None`, found `Unknown | Nullable[Any | str]`
+ src/bokeh/plotting/_figure.py:214:55 error[invalid-argument-type] Argument to function `process_axis_and_grid` is incorrect: Expected `Literal["above", "below", "left", "right"] | None`, found `Nullable[Any | str]`
cki-lib (https://gitlab.com/cki-project/cki-lib)
- tests/test_cronjob.py:80:9 error[invalid-assignment] Object of type `Mock` is not assignable to attribute `run` on type `Unknown | CronJob`
+ tests/test_cronjob.py:80:9 error[invalid-assignment] Object of type `Mock` is not assignable to attribute `run` of type `def run(self, *, last_run_datetime=None) -> Unknown`
cloud-init (https://github.com/canonical/cloud-init)
- cloudinit/sources/DataSourceAzure.py:1110:57 error[invalid-argument-type] Argument to function `byte_swap_system_uuid` is incorrect: Expected `str`, found `Unknown | None | str`
+ cloudinit/sources/DataSourceAzure.py:1110:57 error[invalid-argument-type] Argument to function `byte_swap_system_uuid` is incorrect: Expected `str`, found `None | str`
- tests/unittests/distros/test_opensuse.py:287:16 error[unresolved-attribute] Attribute `read_only_root` is not defined on `Distro` in union `Unknown | Distro`
+ tests/unittests/distros/test_opensuse.py:287:16 error[unresolved-attribute] Object of type `Distro` has no attribute `read_only_root`
- tests/unittests/sources/test_azure_helper.py:630:33 error[invalid-argument-type] Argument to function `escape` is incorrect: Expected `str`, found `Unknown | int | str`
+ tests/unittests/sources/test_azure_helper.py:630:33 error[invalid-argument-type] Argument to function `escape` is incorrect: Expected `str`, found `int | str`
- tests/unittests/sources/test_azure_helper.py:691:13 error[invalid-argument-type] Argument to bound method `build_report` is incorrect: Expected `str`, found `Unknown | int | str`
+ tests/unittests/sources/test_azure_helper.py:691:13 error[invalid-argument-type] Argument to bound method `build_report` is incorrect: Expected `str`, found `int | str`
- tests/unittests/sources/test_scaleway.py:569:30 error[invalid-argument-type] Argument to function `_fix_mocking_url` is incorrect: Expected `str`, found `Unknown | None | str`
+ tests/unittests/sources/test_scaleway.py:569:30 error[invalid-argument-type] Argument to function `_fix_mocking_url` is incorrect: Expected `str`, found `None | str`
comtypes (https://github.com/enthought/comtypes)
- comtypes/test/test_server_automation.py:109:13 error[unresolved-attribute] Attribute `Clone` is not defined on `IEnumVARIANT` in union `Unknown | IEnumVARIANT`
+ comtypes/test/test_server_automation.py:109:13 error[unresolved-attribute] Object of type `IEnumVARIANT` has no attribute `Clone`
core (https://github.com/home-assistant/core)
- homeassistant/components/digital_ocean/binary_sensor.py:92:30 error[unresolved-attribute] Attribute `created_at` is not defined on `None` in union `Unknown | None`
+ homeassistant/components/digital_ocean/binary_sensor.py:92:30 error[unresolved-attribute] Attribute `created_at` is not defined on `None` in union `None | Unknown`
- homeassistant/components/google_assistant/helpers.py:585:18 error[unresolved-attribute] Attribute `domain` is not defined on `None` in union `Unknown | State | None`
+ homeassistant/components/google_assistant/helpers.py:585:18 error[unresolved-attribute] Attribute `domain` is not defined on `None` in union `State | None`
- homeassistant/components/keyboard_remote/__init__.py:204:32 error[not-iterable] Object of type `Unknown | None` may not be async-iterable
+ homeassistant/components/keyboard_remote/__init__.py:204:32 error[not-iterable] Object of type `None | Unknown` may not be async-iterable
- homeassistant/components/lg_soundbar/media_player.py:281:13 error[unresolved-attribute] Attribute `send_packet` is not defined on `None` in union `Unknown | None`
+ homeassistant/components/lg_soundbar/media_player.py:281:13 error[unresolved-attribute] Attribute `send_packet` is not defined on `None` in union `None | Unknown`
- homeassistant/components/linux_battery/sensor.py:121:29 error[unresolved-attribute] Attribute `power_now` is not defined on `None` in union `Unknown | None`
+ homeassistant/components/linux_battery/sensor.py:121:29 error[unresolved-attribute] Attribute `power_now` is not defined on `None` in union `None | Unknown`
- homeassistant/components/songpal/media_player.py:248:57 error[unresolved-attribute] Attribute `macAddr` is not defined on `None` in union `Unknown | None`
+ homeassistant/components/songpal/media_player.py:248:57 error[unresolved-attribute] Attribute `macAddr` is not defined on `None` in union `None | Unknown`
- homeassistant/components/tasmota/light.py:219:40 error[unsupported-operator] Operator `in` is not supported between objects of type `Literal[ColorMode.HS]` and `set[ColorMode] | None | Unknown | set[Unknown]`
+ homeassistant/components/tasmota/light.py:219:40 error[unsupported-operator] Operator `in` is not supported between objects of type `Literal[ColorMode.HS]` and `set[ColorMode] | None | set[Unknown]`
- homeassistant/components/websocket_api/http.py:362:13 error[unresolved-attribute] Attribute `debug` is not defined on `None` in union `Unknown | WebSocketAdapter | None`
+ homeassistant/components/websocket_api/http.py:362:13 error[unresolved-attribute] Attribute `debug` is not defined on `None` in union `WebSocketAdapter | None`
- homeassistant/components/wemo/__init__.py:152:9 error[invalid-assignment] Object of type `None` is not assignable to attribute `config_entry_data` on type `Unknown | WemoData`
+ homeassistant/components/wemo/__init__.py:152:9 error[invalid-assignment] Object of type `None` is not assignable to attribute `config_entry_data` of type `WemoConfigEntryData`
- homeassistant/components/xiaomi_miio/gateway.py:64:13 error[unresolved-attribute] Attribute `model` is not defined on `None` in union `Unknown | None`
+ homeassistant/components/xiaomi_miio/gateway.py:64:13 error[unresolved-attribute] Attribute `model` is not defined on `None` in union `None | Unknown`
dd-trace-py (https://github.com/DataDog/dd-trace-py)
+ ddtrace/_trace/tracer.py:317:13 error[invalid-assignment] Object of type `bool` is not assignable to attribute `_apm_tracing_enabled` of type `EnvVariable[bool]`
- ddtrace/appsec/_iast/_patch_modules.py:99:58 error[invalid-argument-type] Argument to function `force_wrapper` is incorrect: Expected `(...) -> Unknown`, found `Unknown | Literal[""]`
+ ddtrace/appsec/_iast/_patch_modules.py:99:58 error[invalid-argument-type] Argument to function `force_wrapper` is incorrect: Expected `(...) -> Unknown`, found `str | Unknown`
- ddtrace/debugging/_probe/status.py:34:35 error[invalid-argument-type] Argument to function `connector` is incorrect: Expected `str`, found `Unknown | DerivedVariable[str | Unknown | DerivedVariable[str]]`
+ ddtrace/debugging/_probe/status.py:34:35 error[invalid-argument-type] Argument to function `connector` is incorrect: Expected `str`, found `DerivedVariable[str | DerivedVariable[str]]`
- ddtrace/debugging/_redaction.py:16:5 error[unsupported-operator] Operator `|` is not supported between objects of type `frozenset[str]` and `Unknown | EnvVariable[set[Unknown]]`
+ ddtrace/debugging/_redaction.py:16:5 error[unsupported-operator] Operator `|` is not supported between objects of type `frozenset[str]` and `EnvVariable[set[Unknown]]`
- ddtrace/debugging/_redaction.py:115:51 error[unsupported-operator] Operator `not in` is not supported between objects of type `Unknown` and `Unknown | EnvVariable[set[Unknown]]`
+ ddtrace/debugging/_redaction.py:115:51 error[unsupported-operator] Operator `not in` is not supported between objects of type `Unknown` and `EnvVariable[set[Unknown]]`
- ddtrace/internal/core/crashtracking.py:65:17 error[unresolved-attribute] Attribute `items` is not defined on `EnvVariable[dict[str, str] | dict[Unknown, Unknown]]` in union `Unknown | EnvVariable[dict[str, str] | dict[Unknown, Unknown]]`
+ ddtrace/internal/core/crashtracking.py:65:17 error[unresolved-attribute] Object of type `EnvVariable[dict[str, str] | dict[Unknown, Unknown]]` has no attribute `items`
- ddtrace/internal/symbol_db/symbols.py:604:36 error[unresolved-attribute] Attribute `match` is not defined on `DerivedVariable[Pattern[Unknown] | Pattern[str]]` in union `Unknown | DerivedVariable[Pattern[Unknown] | Pattern[str]]`
+ ddtrace/internal/symbol_db/symbols.py:604:36 error[unresolved-attribute] Object of type `DerivedVariable[Pattern[Unknown] | Pattern[str]]` has no attribute `match`
- ddtrace/llmobs/_llmobs.py:1105:16 error[unresolved-attribute] Attribute `_dne_client` is not defined on `None` in union `Unknown | None`
+ ddtrace/llmobs/_llmobs.py:1105:16 error[unresolved-attribute] Attribute `_dne_client` is not defined on `None` in union `None | Unknown`
- ddtrace/vendor/dogstatsd/base.py:1220:13 error[unresolved-attribute] Attribute `task_done` is not defined on `None` in union `Unknown | None | Queue[Unknown]`
+ ddtrace/vendor/dogstatsd/base.py:1220:13 error[unresolved-attribute] Attribute `task_done` is not defined on `None` in union `None | Queue[Unknown] | Unknown`
- tests/ci_visibility/test_ci_visibility.py:828:20 error[unresolved-attribute] Attribute `intake_url` is not defined on `TraceWriter` in union `Unknown | TraceWriter`
+ tests/ci_visibility/test_ci_visibility.py:828:20 error[unresolved-attribute] Object of type `TraceWriter` has no attribute `intake_url`
- tests/contrib/pyodbc/test_pyodbc.py:143:13 error[invalid-assignment] Object of type `Literal[True]` is not assignable to attribute `enabled` on type `Unknown | None`
+ tests/contrib/pyodbc/test_pyodbc.py:143:13 error[invalid-assignment] Object of type `Literal[True]` is not assignable to attribute `enabled` on type `None | Unknown`
- tests/contrib/vllm/test_api_app.py:31:9 error[invalid-assignment] Object of type `Unknown` is not assignable to attribute `_llmobs_span_writer` on type `Unknown | None`
+ tests/contrib/vllm/test_api_app.py:31:9 error[invalid-assignment] Object of type `Unknown` is not assignable to attribute `_llmobs_span_writer` on type `None | Unknown`
- tests/integration/test_integration_civisibility.py:72:16 error[unresolved-attribute] Attribute `_endpoint` is not defined on `TraceWriter` in union `Unknown | TraceWriter`
+ tests/integration/test_integration_civisibility.py:72:16 error[unresolved-attribute] Object of type `TraceWriter` has no attribute `_endpoint`
- tests/integration/test_priority_sampling.py:87:16 error[unresolved-attribute] Attribute `traces` is not defined on `TraceWriter` in union `Unknown | TraceWriter`
+ tests/integration/test_priority_sampling.py:87:16 error[unresolved-attribute] Object of type `TraceWriter` has no attribute `traces`
+ tests/internal/crashtracker/test_crashtracker.py:59:9 error[invalid-assignment] Object of type `str` is not assignable to attribute `stderr_filename` of type `EnvVariable[None]`
- tests/llmobs/test_llmobs_service.py:1173:32 error[unresolved-attribute] Attribute `_llmobs_span_writer` is not defined on `None` in union `Unknown | None`
+ tests/llmobs/test_llmobs_service.py:1173:32 error[unresolved-attribute] Attribute `_llmobs_span_writer` is not defined on `None` in union `None | Unknown`
- tests/llmobs/test_llmobs_service.py:1239:20 error[unresolved-attribute] Attribute `_llmobs_eval_metric_writer` is not defined on `None` in union `Unknown | None`
+ tests/llmobs/test_llmobs_service.py:1239:20 error[unresolved-attribute] Attribute `_llmobs_eval_metric_writer` is not defined on `None` in union `None | Unknown`
- tests/tracer/test_sampler.py:205:12 error[unresolved-attribute] Attribute `pattern` is not defined on `None` in union `Unknown | GlobMatcher | None`
+ tests/tracer/test_sampler.py:205:12 error[unresolved-attribute] Attribute `pattern` is not defined on `None` in union `GlobMatcher | None`
- tests/tracer/test_single_span_sampling_rules.py:165:16 error[unresolved-attribute] Attribute `pattern` is not defined on `None` in union `Unknown | GlobMatcher | None`
+ tests/tracer/test_single_span_sampling_rules.py:165:16 error[unresolved-attribute] Attribute `pattern` is not defined on `None` in union `GlobMatcher | None`
+ tests/utils.py:294:13 error[invalid-assignment] Object of type `DummyWriter` is not assignable to attribute `writer` of type `TraceWriter`
dragonchain (https://github.com/dragonchain/dragonchain)
- dragonchain/job_processor/contract_job_utest.py:263:13 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `set_state` on type `Unknown | SmartContractModel`
+ dragonchain/job_processor/contract_job_utest.py:263:13 error[invalid-assignment] Object of type `MagicMock` is not assignable to attribute `set_state` of type `def set_state(self, state: str | ContractState, msg: str = "") -> None`
+ dragonchain/lib/dto/btc_utest.py:87:9 error[unresolved-attribute] Object of type `bound method BitcoinNetwork._call(method: str, *args: Any) -> Any` has no attribute `assert_called_once_with`
+ dragonchain/lib/dto/btc_utest.py:133:9 error[unresolved-attribute] Object of type `bound method BitcoinNetwork._call(method: str, *args: Any) -> Any` has no attribute `assert_has_calls`
+ dragonchain/lib/dto/eth_utest.py:60:9 error[unresolved-attribute] Object of type `bound method EthereumNetwork.sign_transaction(raw_transaction: dict[str, Any]) -> str` has no attribute `assert_called_once_with`
dulwich (https://github.com/dulwich/dulwich)
- dulwich/object_store.py:2997:31 error[invalid-argument-type] Argument to bound method `add_todo` is incorrect: Expected `Iterable[tuple[ObjectID, bytes | None, int | None, bool]]`, found `list[tuple[Unknown | bytes, None, Unknown | int, bool]]`
+ dulwich/object_store.py:2997:31 error[invalid-argument-type] Argument to bound method `add_todo` is incorrect: Expected `Iterable[tuple[ObjectID, bytes | None, int | None, bool]]`, found `list[tuple[bytes, None, int, bool]]`
+ dulwich/worktree.py:657:17 error[invalid-assignment] Invalid assignment to data descriptor attribute `parents` on type `Commit` with custom `__set__` method
freqtrade (https://github.com/freqtrade/freqtrade)
- freqtrade/freqai/freqai_interface.py:908:38 error[unresolved-attribute] Attribute `data` is not defined on `None` in union `Unknown | FreqaiDataKitchen | None`
+ freqtrade/freqai/freqai_interface.py:908:38 error[unresolved-attribute] Attribute `data` is not defined on `None` in union `FreqaiDataKitchen | None`
hydpy (https://github.com/hydpy-dev/hydpy)
- hydpy/core/testtools.py:2745:14 error[invalid-context-manager] Object of type `Unknown | OptionContextPeriod` cannot be used with `with` because it does not correctly implement `__exit__`
+ hydpy/core/testtools.py:2745:14 error[invalid-context-manager] Object of type `OptionContextPeriod` cannot be used with `with` because it does not correctly implement `__exit__`
- hydpy/models/sw1d_channel.py:1878:21 error[type-assertion-failure] Type `Unknown & ~None & ~RoutingModel_V1 & ~RoutingModel_V2 & ~RoutingModel_V3` is not equivalent to `Never`
ignite (https://github.com/pytorch/ignite)
- ignite/handlers/state_param_scheduler.py:74:13 error[unresolved-attribute] Attribute `param_history` is not defined on `State` in union `Unknown | State`
+ ignite/handlers/state_param_scheduler.py:74:13 error[unresolved-attribute] Object of type `State` has no attribute `param_history`
- tests/ignite/handlers/test_ema_handler.py:74:36 error[unresolved-attribute] Attribute `ema_momentum` is not defined on `State` in union `Unknown | State`
+ tests/ignite/handlers/test_ema_handler.py:74:36 error[unresolved-attribute] Object of type `State` has no attribute `ema_momentum`
- tests/ignite/handlers/test_fbresearch_logger.py:101:5 error[invalid-assignment] Object of type `float` is not assignable to attribute `alpha` on type `Unknown | State`
jax (https://github.com/google/jax)
- jax/_src/test_loader.py:153:9 error[invalid-assignment] Object of type `() -> Unknown | int | float` is not assignable to attribute `time_getter` on type `Unknown | TestResult`
+ jax/_src/test_loader.py:157:9 error[unresolved-attribute] Unresolved attribute `time_getter` on type `TestResult`
jinja (https://github.com/pallets/jinja)
- src/jinja2/ext.py:319:49 error[invalid-argument-type] Argument to bound method `update` is incorrect: Expected `<class 'range'> | <class 'dict'> | ((n: int = 5, html: bool = True, min: int = 20, max: int = 100) -> str) | ... omitted 3 union elements`, found `((str, str, /) -> str) | None | ((...) -> str)`
+ src/jinja2/ext.py:319:49 error[invalid-argument-type] Argument to bound method `update` is incorrect: Expected `<class 'range'> | <class 'dict'> | ((n: int = ..., html: bool = ..., min: int = ..., max: int = ...) -> str) | ... omitted 3 union elements`, found `((str, str, /) -> str) | None | ((...) -> str)`
- tests/test_imports.py:22:5 error[invalid-assignment] Invalid subscript assignment with key of type `Literal["bar"]` and value of type `Literal[23]` on object of type `dict[str, <class 'range'> | <class 'dict'> | ((n: int = 5, html: bool = True, min: int = 20, max: int = 100) -> str) | ... omitted 3 union elements]`
+ tests/test_imports.py:22:5 error[invalid-assignment] Invalid subscript assignment with key of type `Literal["bar"]` and value of type `Literal[23]` on object of type `dict[str, <class 'range'> | <class 'dict'> | ((n: int = ..., html: bool = ..., min: int = ..., max: int = ...) -> str) | ... omitted 3 union elements]`
koda-validate (https://github.com/keithasaurus/koda-validate)
- koda_validate/maybe.py:43:24 error[invalid-return-type] Return type does not match returned value: expected `tuple[Literal[True], Just[A@MaybeValidator] | Nothing] | tuple[Literal[False], Invalid]`, found `tuple[Literal[True], Just[Unknown | A@MaybeValidator | Invalid]]`
+ koda_validate/maybe.py:43:24 error[invalid-return-type] Return type does not match returned value: expected `tuple[Literal[True], Just[A@MaybeValidator] | Nothing] | tuple[Literal[False], Invalid]`, found `tuple[Literal[True], Just[A@MaybeValidator | Invalid]]`
- koda_validate/tuple.py:335:48 error[unresolved-attribute] Attribute `val` is not defined on `Nothing` in union `Unknown | Just[tuple[Any, ...]] | Nothing`
+ koda_validate/tuple.py:335:48 error[unresolved-attribute] Attribute `val` is not defined on `Nothing` in union `Just[tuple[Any, ...]] | Nothing`
manticore (https://github.com/trailofbits/manticore)
- tests/ethereum/test_general.py:2053:30 error[unresolved-attribute] Attribute `is_running` is not defined on `None` in union `Unknown | None`
+ tests/ethereum/test_general.py:2053:30 error[unresolved-attribute] Attribute `is_running` is not defined on `None` in union `None | Unknown`
- tests/native/test_x86_pcmpxstrx.py:10616:29 error[unsupported-operator] Operator `+` is not supported between objects of type `Unknown | int | Expression | None` and `int`
+ tests/native/test_x86_pcmpxstrx.py:10616:29 error[unsupported-operator] Operator `+` is not supported between objects of type `int | Expression | Unknown | None` and `int`
- tests/native/test_x86_pcmpxstrx.py:11656:34 error[unsupported-operator] Operator `+` is not supported between objects of type `Unknown | int | Expression | None` and `int`
+ tests/native/test_x86_pcmpxstrx.py:11656:34 error[unsupported-operator] Operator `+` is not supported between objects of type `int | Expression | Unknown | None` and `int`
- tests/native/test_x86_pcmpxstrx.py:13831:34 error[unsupported-operator] Operator `+` is not supported between objects of type `Unknown | int | Expression | None` and `int`
+ tests/native/test_x86_pcmpxstrx.py:13831:34 error[unsupported-operator] Operator `+` is not supported between objects of type `int | Expression | Unknown | None` and `int`
- tests/native/test_x86_pcmpxstrx.py:14946:29 error[unsupported-operator] Operator `+` is not supported between objects of type `Unknown | int | Expression | None` and `int`
+ tests/native/test_x86_pcmpxstrx.py:14946:29 error[unsupported-operator] Operator `+` is not supported between objects of type `int | Expression | Unknown | None` and `int`
- tests/native/test_x86_pcmpxstrx.py:18474:29 error[unsupported-operator] Operator `+` is not supported between objects of type `Unknown | int | Expression | None` and `int`
+ tests/native/test_x86_pcmpxstrx.py:18474:29 error[unsupported-operator] Operator `+` is not supported between objects of type `int | Expression | Unknown | None` and `int`
- tests/native/test_x86_pcmpxstrx.py:19482:29 error[unsupported-operator] Operator `+` is not supported between objects of type `Unknown | int | Expression | None` and `int`
+ tests/native/test_x86_pcmpxstrx.py:19482:29 error[unsupported-operator] Operator `+` is not supported between objects of type `int | Expression | Unknown | None` and `int`
- tests/native/test_x86_pcmpxstrx.py:20302:29 error[unsupported-operator] Operator `+` is not supported between objects of type `Unknown | int | Expression | None` and `int`
+ tests/native/test_x86_pcmpxstrx.py:20302:29 error[unsupported-operator] Operator `+` is not supported between objects of type `int | Expression | Unknown | None` and `int`
- tests/native/test_x86_pcmpxstrx.py:21757:34 error[unsupported-operator] Operator `+` is not supported between objects of type `Unknown | int | Expression | None` and `int`
+ tests/native/test_x86_pcmpxstrx.py:21757:34 error[unsupported-operator] Operator `+` is not supported between objects of type `int | Expression | Unknown | None` and `int`
- tests/native/test_x86_pcmpxstrx.py:24292:29 error[unsupported-operator] Operator `+` is not supported between objects of type `Unknown | int | Expression | None` and `int`
+ tests/native/test_x86_pcmpxstrx.py:24292:29 error[unsupported-operator] Operator `+` is not supported between objects of type `int | Expression | Unknown | None` and `int`
- tests/native/test_x86_pcmpxstrx.py:24454:29 error[unsupported-operator] Operator `+` is not supported between objects of type `Unknown | int | Expression | None` and `int`
+ tests/native/test_x86_pcmpxstrx.py:24454:29 error[unsupported-operator] Operator `+` is not supported between objects of type `int | Expression | Unknown | None` and `int`
- tests/native/test_x86_pcmpxstrx.py:26659:34 error[unsupported-operator] Operator `+` is not supported between objects of type `Unknown | int | Expression | None` and `int`
+ tests/native/test_x86_pcmpxstrx.py:26659:34 error[unsupported-operator] Operator `+` is not supported between objects of type `int | Expression | Unknown | None` and `int`
- tests/native/test_x86_pcmpxstrx.py:27751:34 error[unsupported-operator] Operator `+` is not supported between objects of type `Unknown | int | Expression | None` and `int`
+ tests/native/test_x86_pcmpxstrx.py:27751:34 error[unsupported-operator] Operator `+` is not supported between objects of type `int | Expression | Unknown | None` and `int`
- tests/native/test_x86_pcmpxstrx.py:28141:34 error[unsupported-operator] Operator `+` is not supported between objects of type `Unknown | int | Expression | None` and `int`
+ tests/native/test_x86_pcmpxstrx.py:28141:34 error[unsupported-operator] Operator `+` is not supported between objects of type `int | Expression | Unknown | None` and `int`
- tests/native/test_x86_pcmpxstrx.py:28301:29 error[unsupported-operator] Operator `+` is not supported between objects of type `Unknown | int | Expression | None` and `int`
+ tests/native/test_x86_pcmpxstrx.py:28301:29 error[unsupported-operator] Operator `+` is not supported between objects of type `int | Expression | Unknown | None` and `int`
meson (https://github.com/mesonbuild/meson)
- mesonbuild/backend/ninjabackend.py:2513:16 error[unresolved-attribute] Attribute `is_os2` is not defined on `None` in union `Unknown | MachineInfo | None`
+ mesonbuild/backend/ninjabackend.py:2513:16 error[unresolved-attribute] Attribute `is_os2` is not defined on `None` in union `MachineInfo | None`
- mesonbuild/backend/ninjabackend.py:3530:12 error[unresolved-attribute] Attribute `is_os2` is not defined on `None` in union `Unknown | MachineInfo | None`
+ mesonbuild/backend/ninjabackend.py:3530:12 error[unresolved-attribute] Attribute `is_os2` is not defined on `None` in union `MachineInfo | None`
+ mesonbuild/compilers/detect.py:1045:31 error[invalid-argument-type] Argument to bound method `add_lang_args` is incorrect: Expected `Literal["c", "cpp", "cuda", "fortran", "d", ... omitted 11 literals]`, found `str`
+ mesonbuild/compilers/detect.py:1419:27 error[invalid-argument-type] Argument to bound method `add_lang_args` is incorrect: Expected `Literal["c", "cpp", "cuda", "fortran", "d", ... omitted 11 literals]`, found `str`
- mesonbuild/compilers/detect.py:1404:10 error[unresolved-attribute] Attribute `cpu_family` is not defined on `None` in union `Unknown | MachineInfo | None`
+ mesonbuild/compilers/detect.py:1404:10 error[unresolved-attribute] Attribute `cpu_family` is not defined on `None` in union `MachineInfo | None`
- mesonbuild/dependencies/dev.py:44:10 error[unresolved-attribute] Attribute `is_darwin` is not defined on `None` in union `Unknown | MachineInfo | None`
+ mesonbuild/dependencies/dev.py:44:10 error[unresolved-attribute] Attribute `is_darwin` is not defined on `None` in union `MachineInfo | None`
- mesonbuild/dependencies/misc.py:424:9 error[invalid-assignment] Object of type `Unknown | list[str] | None` is not assignable to attribute `link_args` of type `list[str]`
+ mesonbuild/dependencies/misc.py:424:9 error[invalid-assignment] Object of type `list[str] | None` is not assignable to attribute `link_args` of type `list[str]`
- mesonbuild/interpreter/dependencyfallbacks.py:344:38 error[unresolved-attribute] Attribute `find_dep_provider` is not defined on `None` in union `Unknown | Resolver | None`
+ mesonbuild/interpreter/dependencyfallbacks.py:344:38 error[unresolved-attribute] Attribute `find_dep_provider` is not defined on `None` in union `Resolver | None`
- mesonbuild/linkers/linkers.py:709:30 error[unresolved-attribute] Attribute `is_cygwin` is not defined on `None` in union `Unknown | MachineInfo | None`
+ mesonbuild/linkers/linkers.py:709:30 error[unresolved-attribute] Attribute `is_cygwin` is not defined on `None` in union `MachineInfo | None`
- mesonbuild/tooldetect.py:130:20 error[invalid-return-type] Return type does not match returned value: expected `tuple[list[str], str] | None`, found `tuple[Unknown | list[Any] | list[Any | str] | list[str | None], str]`
+ mesonbuild/tooldetect.py:130:20 error[invalid-return-type] Return type does not match returned value: expected `tuple[list[str], str] | None`, found `tuple[list[Any] | Unknown | list[Any | str] | list[str | None], str]`
mitmproxy (https://github.com/mitmproxy/mitmproxy)
- mitmproxy/contrib/wbxml/ASWBXML.py:878:29 error[invalid-argument-type] Argument to bound method `appendChild` is incorrect: Argument type `Unknown | Text` does not satisfy upper bound `Comment | DocumentType | Element | ProcessingInstruction` of type variable `_DocumentChildrenVar`
+ mitmproxy/contrib/wbxml/ASWBXML.py:878:29 error[invalid-argument-type] Argument to bound method `appendChild` is incorrect: Argument type `Text` does not satisfy upper bound `Comment | DocumentType | Element | ProcessingInstruction` of type variable `_DocumentChildrenVar`
mkdocs (https://github.com/mkdocs/mkdocs)
- mkdocs/tests/config/config_options_tests.py:302:9 error[type-assertion-failure] Type `Unknown | int` does not match asserted type `int`
- mkdocs/tests/config/config_options_tests.py:461:9 error[type-assertion-failure] Type `Unknown | str | None` does not match asserted type `str | None`
- mkdocs/tests/config/config_options_tests.py:816:9 error[type-assertion-failure] Type `Unknown | dict[str, int | None]` does not match asserted type `dict[str, int | None]`
mongo-python-driver (https://github.com/mongodb/mongo-python-driver)
- pymongo/asynchronous/client_bulk.py:699:17 error[invalid-assignment] Invalid subscript assignment with key of type `Literal["comment"]` and value of type `(Unknown & ~AlwaysFalsy) | (str & ~AlwaysFalsy)` on object of type `dict[str, int]`
+ pymongo/asynchronous/client_bulk.py:699:17 error[invalid-assignment] Invalid subscript assignment with key of type `Literal["comment"]` and value of type `str & ~AlwaysFalsy` on object of type `dict[str, int]`
- pymongo/asynchronous/client_session.py:1078:36 error[unresolved-attribute] Attribute `transaction_id` is not defined on `None` in union `Unknown | None | _ServerSession`
+ pymongo/asynchronous/client_session.py:1078:36 error[unresolved-attribute] Attribute `transaction_id` is not defined on `None` in union `Any | None | _ServerSession`
- pymongo/asynchronous/server.py:226:65 error[invalid-argument-type] Argument to bound method `_process_response` is incorrect: Expected `AsyncClientSession | None`, found `Unknown | AsyncClientSession | ClientSession | None`
+ pymongo/asynchronous/server.py:226:65 error[invalid-argument-type] Argument to bound method `_process_response` is incorrect: Expected `AsyncClientSession | None`, found `AsyncClientSession | ClientSession | None`
- pymongo/synchronous/database.py:1019:35 error[invalid-assignment] Object of type `(ClientSession & ~AlwaysTruthy & ~AlwaysFalsy) | (_ServerMode & ~AlwaysFalsy) | Unknown | Primary` is not assignable to `_ServerMode | None`
+ pymongo/synchronous/database.py:1019:35 error[invalid-assignment] Object of type `(ClientSession & ~AlwaysTruthy & ~AlwaysFalsy) | (_ServerMode & ~AlwaysFalsy) | Primary` is not assignable to `_ServerMode | None`
mypy (https://github.com/python/mypy)
- mypy/modulefinder.py:489:68 error[invalid-argument-type] Argument to bound method `_find_module_non_stub_helper` is incorrect: Expected `str`, found `Unknown | PathLike[PathLike[Never] | str] | str`
+ mypy/modulefinder.py:489:68 error[invalid-argument-type] Argument to bound method `_find_module_non_stub_helper` is incorrect: Expected `str`, found `PathLike[PathLike[Never] | str] | str`
openlibrary (https://github.com/internetarchive/openlibrary)
+ openlibrary/plugins/openlibrary/lists.py:717:49 error[invalid-argument-type] Argument to function `dump` is incorrect: Expected `Literal["json", "yml"]`, found `str`
optuna (https://github.com/optuna/optuna)
+ optuna/_transform.py:164:55 error[invalid-argument-type] Argument to bound method `to_external_repr` is incorrect: Expected `int | float`, found `signedinteger[Unknown] | Unknown`
- optuna/samplers/nsgaii/_elite_population_selection_strategy.py:84:24 error[invalid-argument-type] Argument to function `len` is incorrect: Expected `Sized`, found `Unknown | list[int | float] | None`
+ optuna/samplers/nsgaii/_elite_population_selection_strategy.py:84:24 error[invalid-argument-type] Argument to function `len` is incorrect: Expected `Sized`, found `list[int | float] | None`
pandas (https://github.com/pandas-dev/pandas)
- pandas/tests/frame/methods/test_align.py:31:16 error[unresolved-attribute] Attribute `tz` is not defined on `Index` in union `Unknown | Index`
+ pandas/tests/frame/methods/test_align.py:31:16 error[unresolved-attribute] Object of type `Index` has no attribute `tz`
- pandas/tests/frame/test_query_eval.py:451:30 error[invalid-argument-type] Method `__getitem__` of type `bound method dict[str, Unknown | Index | Series].__getitem__(key: str, /) -> Unknown | Index | Series` cannot be called with key of type `Hashable` on object of type `dict[str, Unknown | Index | Series]`
+ pandas/tests/frame/test_query_eval.py:451:30 error[invalid-argument-type] Method `__getitem__` of type `bound method dict[str, Index | Series | Unknown].__getitem__(key: str, /) -> Index | Series | Unknown` cannot be called with key of type `Hashable` on object of type `dict[str, Index | Series | Unknown]`
- pandas/tests/indexes/datetimes/test_partial_slicing.py:170:23 error[unresolved-attribute] Attribute `year` is not defined on `Index` in union `Unknown | Index`
+ pandas/tests/indexes/datetimes/test_partial_slicing.py:170:23 error[unresolved-attribute] Object of type `Index` has no attribute `year`
- pandas/tests/indexes/multi/test_sorting.py:153:16 error[unresolved-attribute] Attribute `_is_lexsorted` is not defined on `Index` in union `Unknown | Index`
+ pandas/tests/indexes/multi/test_sorting.py:153:16 error[unresolved-attribute] Object of type `Index` has no attribute `_is_lexsorted`
- pandas/tests/resample/test_base.py:384:28 error[invalid-argument-type] Argument to function `_asfreq_compat` is incorrect: Argument type `Unknown | Index` does not satisfy constraints (`DatetimeIndex`, `PeriodIndex`, `TimedeltaIndex`) of type variable `FreqIndexT`
+ pandas/tests/resample/test_base.py:384:28 error[invalid-argument-type] Argument to function `_asfreq_compat` is incorrect: Argument type `Index` does not satisfy constraints (`DatetimeIndex`, `PeriodIndex`, `TimedeltaIndex`) of type variable `FreqIndexT`
- pandas/tests/resample/test_datetime_index.py:1775:16 error[unresolved-attribute] Attribute `as_unit` is not defined on `Index` in union `Unknown | Index`
+ pandas/tests/resample/test_datetime_index.py:1775:16 error[unresolved-attribute] Object of type `Index` has no attribute `as_unit`
- pandas/tests/reshape/concat/test_concat.py:201:13 error[unresolved-attribute] Attribute `levels` is not defined on `Index` in union `Unknown | Index`
+ pandas/tests/reshape/concat/test_concat.py:201:13 error[unresolved-attribute] Object of type `Index` has no attribute `levels`
- pandas/tests/reshape/concat/test_datetimes.py:144:31 error[unresolved-attribute] Attribute `freq` is not defined on `Index` in union `Unknown | Index`
+ pandas/tests/reshape/concat/test_datetimes.py:144:31 error[unresolved-attribute] Object of type `Index` has no attribute `freq`
- pandas/tests/reshape/test_pivot.py:1853:20 error[unresolved-attribute] Attribute `year` is not defined on `Index` in union `Unknown | Index`
+ pandas/tests/reshape/test_pivot.py:1853:20 error[unresolved-attribute] Object of type `Index` has no attribute `year`
parso (https://github.com/davidhalter/parso)
- parso/python/pep8.py:418:35 error[unresolved-attribute] Attribute `indentation` is not defined on `None` in union `Unknown | IndentationNode | None`
+ parso/python/pep8.py:418:35 error[unresolved-attribute] Attribute `indentation` is not defined on `None` in union `IndentationNode | Unknown | None`
- parso/python/pep8.py:433:41 error[unresolved-attribute] Attribute `parent` is not defined on `None` in union `Unknown | IndentationNode | None`
+ parso/python/pep8.py:433:41 error[unresolved-attribute] Attribute `parent` is not defined on `None` in union `IndentationNode | Unknown | None`
- parso/python/pep8.py:486:40 error[unresolved-attribute] Attribute `type` is not defined on `None` in union `Unknown | IndentationNode | None`
+ parso/python/pep8.py:486:40 error[unresolved-attribute] Attribute `type` is not defined on `None` in union `IndentationNode | Unknown | None`
pip (https://github.com/pypa/pip)
- src/pip/_internal/operations/prepare.py:351:12 error[unresolved-attribute] Attribute `is_vcs` is not defined on `None` in union `Unknown | Link | None`
+ src/pip/_internal/operations/prepare.py:351:12 error[unresolved-attribute] Attribute `is_vcs` is not defined on `None` in union `Link | None`
- src/pip/_internal/operations/prepare.py:415:13 error[unresolved-attribute] Attribute `filename` is not defined on `None` in union `Unknown | Link | None`
+ src/pip/_internal/operations/prepare.py:415:13 error[unresolved-attribute] Attribute `filename` is not defined on `None` in union `Link | None`
- src/pip/_vendor/cachecontrol/adapter.py:74:13 error[unresolved-attribute] Attribute `update` is not defined on `None` in union `Unknown | None | CaseInsensitiveDict`
+ src/pip/_vendor/cachecontrol/adapter.py:74:13 error[unresolved-attribute] Attribute `update` is not defined on `None` in union `None | CaseInsensitiveDict`
- src/pip/_vendor/urllib3/connectionpool.py:316:13 error[unresolved-attribute] Attribute `put` is not defined on `None` in union `Unknown | LifoQueue | None`
+ src/pip/_vendor/urllib3/connectionpool.py:316:13 error[unresolved-attribute] Attribute `put` is not defined on `None` in union `LifoQueue | None`
- src/pip/_vendor/urllib3/response.py:774:13 error[unresolved-attribute] Attribute `_safe_read` is not defined on `None` in union `Unknown | None`
+ src/pip/_vendor/urllib3/response.py:774:13 error[unresolved-attribute] Attribute `_safe_read` is not defined on `None` in union `None | (Unknown & <Protocol with members 'read'>)`
- src/pip/_vendor/urllib3/response.py:778:30 error[unresolved-attribute] Attribute `_safe_read` is not defined on `None` in union `Unknown | None`
+ src/pip/_vendor/urllib3/response.py:778:30 error[unresolved-attribute] Attribute `_safe_read` is not defined on `None` in union `None | (Unknown & <Protocol with members 'read'>)`
psycopg (https://github.com/psycopg/psycopg)
- tests/utils.py:114:47 error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `Iterable[Buffer]`, found `(Unknown & ~AlwaysFalsy) | (tuple[int, ...] & ~AlwaysFalsy)`
pwndbg (https://github.com/pwndbg/pwndbg)
- pwndbg/aglib/kernel/vmmap.py:444:32 error[unresolved-attribute] Attribute `ESPSTACK` is not defined on `None` in union `Unknown | ArchPagingInfo | None`
+ pwndbg/aglib/kernel/vmmap.py:444:32 error[unresolved-attribute] Attribute `ESPSTACK` is not defined on `None` in union `ArchPagingInfo | None`
pycryptodome (https://github.com/Legrandin/pycryptodome)
- lib/Crypto/Hash/CMAC.py:202:25 error[invalid-argument-type] Argument to function `strxor` is incorrect: Expected `bytes`, found `Unknown | None | bytes`
+ lib/Crypto/Hash/CMAC.py:202:25 error[invalid-argument-type] Argument to function `strxor` is incorrect: Expected `bytes`, found `None | bytes`
+ lib/Crypto/SelfTest/Protocol/test_KDF.py:422:9 error[invalid-assignment] Object of type `list[Unknown]` is not assignable to attribute `data` of type `tuple[tuple[str, str, int, int, int, str], tuple[str, str, int, int, int, str], tuple[str, str, int, int, int, str], tuple[str, str, int, int, int, str]]`
- lib/Crypto/SelfTest/PublicKey/test_ECC_NIST.py:343:18 error[unsupported-operator] Operator `*` is not supported between objects of type `IntegerBase` and `Unknown | EccPoint`
+ lib/Crypto/SelfTest/PublicKey/test_ECC_NIST.py:343:18 error[unsupported-operator] Operator `*` is not supported between objects of type `IntegerBase` and `EccPoint`
- lib/Crypto/SelfTest/Signature/test_dss.py:656:39 error[unresolved-attribute] Attribute `message` is not defined on `tuple[str, str, str, str, <module 'Crypto.Hash.SHA1'>, str]`, `tuple[str, str, str, str, <module 'Crypto.Hash.SHA224'>, str]`, `tuple[str, str, str, str, <module 'Crypto.Hash.SHA256'>, str]`, `tuple[str, str, str, str, <module 'Crypto.Hash.SHA384'>, str]`, `tuple[str, str, str, str, <module 'Crypto.Hash.SHA512'>, str]` in union `Unknown | tuple[str, str, str, str, <module 'Crypto.Hash.SHA1'>, str] | tuple[str, str, str, str, <module 'Crypto.Hash.SHA224'>, str] | ... omitted 3 union elements`
+ lib/Crypto/SelfTest/Signature/test_dss.py:656:39 error[unresolved-attribute] Attribute `message` is not defined on `tuple[str, str, str, str, <module 'Crypto.Hash.SHA1'>, str]`, `tuple[str, str, str, str, <module 'Crypto.Hash.SHA224'>, str]`, `tuple[str, str, str, str, <module 'Crypto.Hash.SHA256'>, str]`, `tuple[str, str, str, str, <module 'Crypto.Hash.SHA384'>, str]`, `tuple[str, str, str, str, <module 'Crypto.Hash.SHA512'>, str]` in union `tuple[str, str, str, str, <module 'Crypto.Hash.SHA1'>, str] | tuple[str, str, str, str, <module 'Crypto.Hash.SHA224'>, str] | tuple[str, str, str, str, <module 'Crypto.Hash.SHA256'>, str] | ... omitted 3 union elements`
pylox (https://github.com/sco1/pylox)
- pylox/interpreter.py:127:20 error[unresolved-attribute] Attribute `get_at` is not defined on `None` in union `Unknown | Environment | None`
+ pylox/interpreter.py:127:20 error[unresolved-attribute] Attribute `get_at` is not defined on `None` in union `Environment | None`
pytest (https://github.com/pytest-dev/pytest)
- src/_pytest/junitxml.py:372:23 error[invalid-assignment] Object of type `Unknown | (bound method LogXML.add_global_property(name: str, value: object) -> None)` is not assignable to `def record_func(name: str, value: object) -> None`
+ src/_pytest/junitxml.py:372:23 error[invalid-assignment] Object of type `bound method LogXML.add_global_property(name: str, value: object) -> None` is not assignable to `def record_func(name: str, value: object) -> None`
pywin32 (https://github.com/mhammond/pywin32)
- Pythonwin/pywin/Demos/openGLDemo.py:142:16 error[unresolved-attribute] Attribute `OnInitialUpdate` is not defined on `None` in union `Unknown | None`
+ Pythonwin/pywin/Demos/openGLDemo.py:142:16 error[unresolved-attribute] Attribute `OnInitialUpdate` is not defined on `None` in union `None | Unknown`
- Pythonwin/pywin/Demos/sliderdemo.py:66:9 error[unresolved-attribute] Attribute `OnCancel` is not defined on `None` in union `Unknown | None`
+ Pythonwin/pywin/Demos/sliderdemo.py:66:9 error[unresolved-attribute] Attribute `OnCancel` is not defined on `None` in union `None | Unknown`
- Pythonwin/pywin/framework/dlgappcore.py:66:9 error[unresolved-attribute] Attribute `InitDlgInstance` is not defined on `None` in union `Unknown | None`
+ Pythonwin/pywin/framework/dlgappcore.py:66:9 error[unresolved-attribute] Attribute `InitDlgInstance` is not defined on `None` in union `None | Unknown`
- adodbapi/adodbapi.py:917:29 error[unresolved-attribute] Attribute `Parameters` is not defined on `None` in union `Unknown | None | CDispatch`
+ adodbapi/adodbapi.py:917:29 error[unresolved-attribute] Attribute `Parameters` is not defined on `None` in union `None | CDispatch`
- com/win32comext/axscript/server/axsite.py:44:9 error[unresolved-attribute] Attribute `SetScriptState` is not defined on `None`, `PyIUnknown` in union `Unknown | None | PyIUnknown`
+ com/win32comext/axscript/server/axsite.py:44:9 error[unresolved-attribute] Attribute `SetScriptState` is not defined on `None`, `PyIUnknown` in union `None | Unknown | PyIUnknown`
- com/win32comext/shell/demos/explorer_browser.py:134:9 error[unresolved-attribute] Attribute `SetRect` is not defined on `PyIUnknown`, `None` in union `Unknown | PyIUnknown | None`
+ com/win32comext/shell/demos/explorer_browser.py:134:9 error[unresolved-attribute] Object of type `PyIUnknown | None` has no attribute `SetRect`
- win32/Lib/win32rcparser.py:389:19 error[unresolved-attribute] Attribute `startswith` is not defined on `None` in union `Unknown | str | None`
+ win32/Lib/win32rcparser.py:389:19 error[unresolved-attribute] Attribute `startswith` is not defined on `None` in union `str | None | Unknown`
rotki (https://github.com/rotki/rotki)
- rotkehlchen/api/services/history_events.py:148:56 error[invalid-argument-type] Argument to bound method `from_location` is incorrect: Expected `Literal[Location.ETHEREUM, Location.OPTIMISM, Location.POLYGON_POS, Location.ARBITRUM_ONE, Location.BASE, ... omitted 9 literals]`, found `Unknown | Location`
+ rotkehlchen/api/services/history_events.py:148:56 error[invalid-argument-type] Argument to bound method `from_location` is incorrect: Expected `Literal[Location.ETHEREUM, Location.OPTIMISM, Location.POLYGON_POS, Location.ARBITRUM_ONE, Location.BASE, ... omitted 9 literals]`, found `Location`
- rotkehlchen/api/services/transactions.py:132:9 error[unresolved-attribute] Attribute `transactions_decoder` is not defined on `ChainManagerWithTransactions[Unknown]` in union `Unknown | ChainManagerWithTransactions[Unknown]`
+ rotkehlchen/api/services/transactions.py:132:9 error[unresolved-attribute] Object of type `ChainManagerWithTransactions[Unknown]` has no attribute `transactions_decoder`
scikit-learn (https://github.com/scikit-learn/scikit-learn)
+ sklearn/inspection/tests/test_partial_dependence.py:739:63 error[not-subscriptable] Cannot subscript object of type `int` with no `__getitem__` method
+ sklearn/preprocessing/_polynomial.py:448:56 error[unsupported-operator] Operator `+` is not supported between objects of type `object` and `Literal[1]`
scipy (https://github.com/scipy/scipy)
+ subprojects/cobyqa/cobyqa/tests/test_main.py:189:9 error[invalid-assignment] Invalid subscript assignment with key of type `Literal["target"]` and value of type `float` on object of type `dict[str, bool]`
- scipy/integrate/_ode.py:1054:29 error[unsupported-operator] Operator `*` is not supported between objects of type `Literal[3]` and `Unknown | None | Literal[0]`
+ scipy/integrate/_ode.py:1054:29 error[unsupported-operator] Operator `*` is not supported between objects of type `Literal[3]` and `Unknown | None | int`
- scipy/optimize/_differentialevolution.py:1762:18 error[call-non-callable] Object of type `Literal["best1bin"]` is not callable
+ scipy/optimize/_differentialevolution.py:1762:18 error[call-non-callable] Object of type `str` is not callable
+ scipy/optimize/_shgo.py:1005:12 error[unsupported-operator] Operator `<=` is not supported between objects of type `int` and `None | Unknown`
- scipy/stats/_hypotests.py:1898:26 error[unresolved-attribute] Attribute `high` is not defined on `None` in union `Unknown | None | ConfidenceInterval`
+ scipy/stats/_hypotests.py:1898:26 error[unresolved-attribute] Attribute `high` is not defined on `None` in union `None | ConfidenceInterval`
+ scipy/stats/tests/test_distributions.py:6126:13 error[invalid-assignment] Object of type `str | int | float | ((r) -> Unknown)` is not assignable to attribute `cdf_default_method` of type `str`
scrapy (https://github.com/scrapy/scrapy)
- tests/test_downloadermiddleware_redirect.py:292:9 error[invalid-assignment] Object of type `list[int]` is not assignable to attribute `handle_httpstatus_list` on type `Unknown | Spider | None`
+ tests/test_downloadermiddleware_redirect.py:292:9 error[invalid-assignment] Object of type `list[int]` is not assignable to attribute `handle_httpstatus_list` on type `Spider | None`
- tests/test_pqueues.py:202:13 error[unresolved-attribute] Attribute `meta` is not defined on `None` in union `Unknown | Request | None`
+ tests/test_pqueues.py:202:13 error[unresolved-attribute] Attribute `meta` is not defined on `None` in union `Request | None`
- tests/test_spidermiddleware_httperror.py:24:13 error[unresolved-attribute] Attribute `url` is not defined on `None` in union `Unknown | MockServer | None`
+ tests/test_spidermiddleware_httperror.py:24:13 error[unresolved-attribute] Attribute `url` is not defined on `None` in union `MockServer | None`
setuptools (https://github.com/pypa/setuptools)
- setuptools/_distutils/command/build_clib.py:91:62 error[invalid-argument-type] Argument to function `new_compiler` is incorrect: Expected `bool`, found `Unknown | Literal[False] | None`
+ setuptools/_distutils/command/build_clib.py:91:62 error[invalid-argument-type] Argument to function `new_compiler` is incorrect: Expected `bool`, found `bool | None | Unknown`
- setuptools/_distutils/command/build_ext.py:586:36 error[unresolved-attribute] Attribute `detect_language` is not defined on `None` in union `Unknown | None | Compiler`
+ setuptools/_distutils/command/build_ext.py:586:36 error[unresolved-attribute] Attribute `detect_language` is not defined on `None` in union `None | Compiler`
- setuptools/_distutils/command/install.py:737:55 error[unsupported-operator] Operator `+` is not supported between objects of type `Unknown | None` and `Literal[".pth"]`
+ setuptools/_distutils/command/install.py:737:55 error[unsupported-operator] Operator `+` is not supported between objects of type `Any | None` and `Literal[".pth"]`
+ setuptools/_vendor/backports/tarfile/__init__.py:969:13 error[invalid-assignment] Object of type `object` is not assignable to attribute `gid` of type `int`
- setuptools/command/editable_wheel.py:372:28 error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `str | PathLike[str]`, found `Unknown | None | (str & ~AlwaysFalsy) | LiteralString`
+ setuptools/command/editable_wheel.py:372:28 error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `str | PathLike[str]`, found `None | str`
sockeye (https://github.com/awslabs/sockeye)
- sockeye/generate_decoder_states.py:209:13 error[invalid-argument-type] Argument is incorrect: Expected `int`, found `Unknown | None`
+ sockeye/generate_decoder_states.py:209:13 error[invalid-argument-type] Argument is incorrect: Expected `int`, found `None | Unknown`
- sockeye/training.py:505:21 error[invalid-assignment] Object of type `int | float` is not assignable to attribute `best_metric` on type `Unknown | None | TrainState`
+ sockeye/training.py:505:21 error[invalid-assignment] Object of type `int | float` is not assignable to attribute `best_metric` on type `None | TrainState`
spack (https://github.com/spack/spack)
+ lib/spack/spack/util/windows_registry.py:259:87 error[unresolved-attribute] Object of type `Self@_valid_reg_check` has no attribute `key`
+ lib/spack/spack/util/windows_registry.py:282:73 error[unresolved-attribute] Object of type `Self@get_subkey` has no attribute `key`
+ lib/spack/spack/util/windows_registry.py:301:73 error[unresolved-attribute] Object of type `Self@get_values` has no attribute `key`
- lib/spack/spack/fetch_strategy.py:1253:26 error[unresolved-attribute] Attribute `source_path` is not defined on `None` in union `Unknown | None`
+ lib/spack/spack/fetch_strategy.py:1253:26 error[unresolved-attribute] Attribute `source_path` is not defined on `None` in union `None | Unknown`
- lib/spack/spack/graph.py:299:39 error[invalid-argument-type] Argument to function `len` is incorrect: Expected `Sized`, found `Unknown | None | list[list[Unknown]]`
+ lib/spack/spack/graph.py:299:39 error[invalid-argument-type] Argument to function `len` is incorrect: Expected `Sized`, found `None | list[list[Unknown]]`
- lib/spack/spack/spec_parser.py:342:30 error[unresolved-attribute] Attribute `value` is not defined on `None`, `<class 'Token'>` in union `Unknown | None | Token | <class 'Token'>`
+ lib/spack/spack/spec_parser.py:342:30 error[unresolved-attribute] Attribute `value` is not defined on `None`, `<class 'Token'>` in union `None | Token | Unknown | <class 'Token'>`
- lib/spack/spack/test/database.py:606:12 error[unresolved-attribute] Attribute `spec` is not defined on `None` in union `Unknown | InstallRecord | None`
+ lib/spack/spack/test/database.py:606:12 error[unresolved-attribute] Attribute `spec` is not defined on `None` in union `InstallRecord | None`
- lib/spack/spack/vendor/ruamel/yaml/emitter.py:674:39 error[unresolved-attribute] Attribute `comment` is not defined on `None` in union `Unknown | None`
+ lib/spack/spack/vendor/ruamel/yaml/emitter.py:674:39 error[unresolved-attribute] Attribute `comment` is not defined on `None` in union `None | Unknown`
- lib/spack/spack/vendor/ruamel/yaml/emitter.py:854:56 error[unresolved-attribute] Attribute `implicit` is not defined on `None` in union `(Unknown & ~ScalarEvent) | None`
+ lib/spack/spack/vendor/ruamel/yaml/emitter.py:854:56 error[unresolved-attribute] Attribute `implicit` is not defined on `None` in union `None | (Unknown & ~ScalarEvent)`
- lib/spack/spack/vendor/ruamel/yaml/emitter.py:927:21 error[unresolved-attribute] Attribute `comment` is not defined on `None` in union `Unknown | None`
+ lib/spack/spack/vendor/ruamel/yaml/emitter.py:927:21 error[unresolved-attribute] Attribute `comment` is not defined on `None` in union `None | Unknown`
sphinx (https://github.com/sphinx-doc/sphinx)
- sphinx/domains/std/__init__.py:1325:24 error[unsupported-operator] Operator `+` is not supported between objects of type `Literal["std:"]` and `Unknown | str | None`
+ sphinx/domains/std/__init__.py:1325:24 error[unsupported-operator] Operator `+` is not supported between objects of type `Literal["std:"]` and `str | None`
- sphinx/ext/napoleon/docstring.py:905:26 error[unresolved-attribute] Attribute `napoleon_use_admonition_for_examples` is not defined on `Config` in union `Unknown | sphinx.config.Config | sphinx.ext.napoleon.Config`
+ sphinx/ext/napoleon/docstring.py:905:26 error[unresolved-attribute] Attribute `napoleon_use_admonition_for_examples` is not defined on `Config` in union `sphinx.config.Config | sphinx.ext.napoleon.Config`
stone (https://github.com/dropbox/stone)
- stone/backends/js_client.py:97:12 error[unresolved-attribute] Attribute `attribute_comment` is not defined on `None` in union `Unknown | None`
+ stone/backends/js_client.py:97:12 error[unresolved-attribute] Attribute `attribute_comment` is not defined on `None` in union `None | (Unknown & Namespace)`
- stone/backends/obj_c_client.py:271:62 error[unresolved-attribute] Attribute `auth_type` is not defined on `None` in union `Unknown | None`
+ stone/backends/obj_c_client.py:271:62 error[unresolved-attribute] Attribute `auth_type` is not defined on `None` in union `None | (Unknown & Namespace)`
- stone/frontend/lexer.py:74:25 error[unresolved-attribute] Attribute `append` is not defined on `None` in union `(Unknown & ~AlwaysTruthy) | None | (list[Unknown] & ~AlwaysTruthy)`
+ stone/frontend/lexer.py:74:25 error[unresolved-attribute] Attribute `append` is not defined on `None` in union `None | (list[Unknown] & ~AlwaysTruthy)`
- test/test_backend.py:228:25 error[unresolved-attribute] Attribute `verbose` is not defined on `None` in union `Unknown | None`
+ test/test_backend.py:228:25 error[unresolved-attribute] Attribute `verbose` is not defined on `None` in union `None | (Unknown & Namespace)`
sympy (https://github.com/sympy/sympy)
+ sympy/codegen/ast.py:1318:9 error[invalid-method-override] Invalid override of method `cast_nocheck`: Definition is incompatible with `FloatBaseType.cast_nocheck`
- sympy/core/tests/test_numbers.py:1925:50 error[unresolved-attribute] Attribute `_mpf_` is not defined on `mpf` in union `Unknown | mpf`
+ sympy/core/tests/test_numbers.py:1925:50 error[unresolved-attribute] Object of type `mpf` has no attribute `_mpf_`
- sympy/functions/elementary/hyperbolic.py:1040:13 error[unresolved-attribute] Attribute `eval` is not defined on `None` in union `Unknown | None`
+ sympy/functions/elementary/hyperbolic.py:1040:13 error[unresolved-attribute] Attribute `eval` is not defined on `None` in union `None | Unknown`
- sympy/physics/biomechanics/tests/test_activation.py:201:13 error[invalid-assignment] Object of type `None` is not assignable to attribute `activation` on type `Unknown | FirstOrderActivationDeGroote2016`
+ sympy/physics/biomechanics/tests/test_activation.py:201:13 error[invalid-assignment] Cannot assign to read-only property `activation` on object of type `FirstOrderActivationDeGroote2016`: Attempted assignment to `FirstOrderActivationDeGroote2016.activation` here
tornado (https://github.com/tornadoweb/tornado)
- tornado/http1connection.py:661:35 error[unresolved-attribute] Attribute `read_until` is not defined on `None` in union `Unknown | IOStream | None`
+ tornado/http1connection.py:661:35 error[unresolved-attribute] Attribute `read_until` is not defined on `None` in union `IOStream | None`
- tornado/http1connection.py:667:30 error[unresolved-attribute] Attribute `read_bytes` is not defined on `None` in union `Unknown | IOStream | None`
+ tornado/http1connection.py:667:30 error[unresolved-attribute] Attribute `read_bytes` is not defined on `None` in union `IOStream | None`
trio (https://github.com/python-trio/trio)
- src/trio/_tests/type_tests/check_wraps.py:9:5 error[type-assertion-failure] Type `Unknown | int` does not match asserted type `int`
- src/trio/_tests/type_tests/path.py:81:5 error[type-assertion-failure] Type `Unknown | bool` does not match asserted type `bool`
urllib3 (https://github.com/urllib3/urllib3)
- src/urllib3/poolmanager.py:615:13 error[unresolved-attribute] Attribute `host` is not defined on `None` in union `Url | None | Unknown`
+ src/urllib3/poolmanager.py:615:13 error[unresolved-attribute] Attribute `host` is not defined on `None` in union `Url | None`
vision (https://github.com/pytorch/vision)
- test/test_datasets.py:480:30 error[unsupported-operator] Operator `-` is not supported between objects of type `Unknown | str | tuple[str, ...] | int` and `Literal[1]`
+ test/test_datasets.py:480:30 error[unsupported-operator] Operator `-` is not supported between objects of type `str | tuple[str, ...] | int` and `Literal[1]`
xarray (https://github.com/pydata/xarray)
- xarray/tests/test_sparse.py:759:14 error[unresolved-attribute] Attribute `mean` is not defined on `DataArrayCoarsen` in union `Unknown | DataArrayCoarsen`
+ xarray/tests/test_sparse.py:759:14 error[unresolved-attribute] Object of type `DataArrayCoarsen` has no attribute `mean`
zope.interface (https://github.com/zopefoundation/zope.interface)
- src/zope/interface/tests/test_adapter.py:73:20 error[invalid-argument-type] Argument to function `len` is incorrect: Expected `Sized`, found `Unknown | None`
+ src/zope/interface/tests/test_adapter.py:73:20 error[invalid-argument-type] Argument to function `len` is incorrect: Expected `Sized`, found `None | Unknown`
+ src/zope/interface/tests/test_declarations.py:974:9 error[invalid-assignment] Object of type `tuple[InterfaceClass]` is not assignable to attribute `declared` of type `tuple[()]`
zulip (https://github.com/zulip/zulip)
- corporate/tests/test_stripe.py:9087:36 error[unresolved-attribute] Attribute `id` is not defined on `RemoteRealm` in union `Unknown | RemoteRealm`
+ corporate/tests/test_stripe.py:9087:36 error[unresolved-attribute] Object of type `RemoteRealm` has no attribute `id`
- zerver/tests/test_handle_push_notification.py:533:22 error[unresolved-attribute] Attribute `realm_id` is not defined on `UserProfile` in union `Unknown | UserProfile`
+ zerver/tests/test_handle_push_notification.py:533:22 error[unresolved-attribute] Object of type `UserProfile` has no attribute `realm_id`| class GridOut: | ||
| def __init__(self: "GridOut") -> None: | ||
| self._buffer = b"" | ||
| self._position = 0 |
There was a problem hiding this comment.
This PR caused us to start emitting 3 (true positive) diagnostics on this snippet about self._position attribute not existing -- other type checkers also emit those diagnostics.
AlexWaygood
left a comment
There was a problem hiding this comment.
Awesome!!
On this PR branch, we still union with Unknown here -- perhaps we should infer str there?
def f(x="foo"):
reveal_type(x) # Literal["foo"] | UnknownI'm okay postponing that to a follow-up PR, though.
| // gradual guarantee would suggest that if not annotated, all such external mutations | ||
| // should be valid. However, external modifications (or modifications through `global` | ||
| // statements) that would require a different public type are relatively rare. From a | ||
| // practical perspective, we get a better user experience by trusting the (promoted) |
There was a problem hiding this comment.
On main, we already do not union module-global types with Unknown. However, we don't currently promote module-global types; we just keep the precisely inferred Literal types.
I'm open to trying out a change where we promote module-global types, similar to what this PR does with other public types, but this PR does not (and should not) do that -- it should be done in a separate PR so that we can evaluate the ecosystem impact of that as an isolated change.
In fact, the whole reason why the variable immediately beneath this comment still exists on this PR branch is so that module-global public types can still be treated differently (not promoted) to other public types
| // practical perspective, we get a better user experience by trusting the (promoted) | |
| // practical perspective, we get a better user experience by trusting the |
There was a problem hiding this comment.
Great call, I'd actually missed the fact that we don't promote there. I think we probably should, for anything non-final? Agree it should be a separate PR.
There was a problem hiding this comment.
astral-sh/ty#3253 -- already working on this.
(FWIW I believe we're already scored as passing that file on the upstream repo — we use the |
* main: [ty] Fix bad diagnostic range for incorrect implicit `__init_subclass__` calls (#24541) [ty] Add a `SupportedPythonVersion` enum (#24412) [ty] Ignore unsupported editor-selected Python versions (#24498) [ty] Add snapshots for `__init_subclass__` diagnostics (#24539) [ty] Minor fix in tests (#24538) [ty] Allow `Final` variable assignments in `__post_init__` (#24529) [ty] Expand test suite for assignment errors (#24537) [ty] Use `map`, not `__map`, as the name of the mapping parameter in `TypedDict` `__init__` methods (#24535) [ty] Rework logic for synthesizing `TypedDict` methods (#24534) [flake8-bandit] Fix S103 false positives and negatives in mask analysis (#24424) [ty] mdtest.py: update dependencies (#24533) Rename patterns and arguments source order iterator method (#24532) [ty] Omit invalid keyword arguments from `TypedDict` signature (#24522) [ty] support super() in metaclass methods (#24483) [ty] Synthesize `__init__` for `TypedDict` (#24476)
def f(x="foo"):
reveal_type(x) # Literal["foo"] | UnknownNo, I think the union with |
There's some interesting disagreement among type checkers on that point. Pyrefly and pycroscope agree with you here, and reveal I agree with your analysis, though; |
|
I had to think through briefly in what cases it would actually make a difference, since this is an inferred type, not a declared type, so it's generally not being used as an "upper bound" type (it's generally being assigned-from, not assigned-to). The fact that it often won't matter is probably why pyright gets away with being wrong here. But there definitely are cases where it matters: probably the worst would be considering |
|
Oh, pyright's behavior is more correct here than I realized. It doesn't just infer That's actually pretty reasonable behavior IMO, and does parallel the (non-gradual-guarantee) way we treat un-annotated attributes after this PR. And gives better LSP experience for un-annotated code. So I wouldn't necessarily be opposed to exploring that as a follow-up. But I'd kind of want to wait for an actual user request. |
|
astral-sh/ty#3251 to consider the pyright approach to un-annotated arguments with defaults. |
* main: Bump typing conformance suite commit to latest upstream (#24553) [ty] Reject deleting`Final` attributes (#24508) [ty] Respect property deleters in attribute deletion checks (#24500) [ty] stop unioning Unknown into types of un-annotated attributes (#24531) [ty] Fix bad diagnostic range for incorrect implicit `__init_subclass__` calls (#24541) [ty] Add a `SupportedPythonVersion` enum (#24412) [ty] Ignore unsupported editor-selected Python versions (#24498) [ty] Add snapshots for `__init_subclass__` diagnostics (#24539) [ty] Minor fix in tests (#24538) [ty] Allow `Final` variable assignments in `__post_init__` (#24529) [ty] Expand test suite for assignment errors (#24537) [ty] Use `map`, not `__map`, as the name of the mapping parameter in `TypedDict` `__init__` methods (#24535) [ty] Rework logic for synthesizing `TypedDict` methods (#24534) [flake8-bandit] Fix S103 false positives and negatives in mask analysis (#24424) [ty] mdtest.py: update dependencies (#24533) Rename patterns and arguments source order iterator method (#24532) [ty] Omit invalid keyword arguments from `TypedDict` signature (#24522) [ty] support super() in metaclass methods (#24483) [ty] Synthesize `__init__` for `TypedDict` (#24476)
Summary
Fixes astral-sh/ty#1240.
After this PR, the only cases where we union in
Unknownto an un-annotated attribute type are if the inferred type isNoneor another non-literal singleton type. We now literal-promote inferred attribute types instead.This caused some conditional-implicit-attribute cases to oscillate between "defined" and "undefined", which required a cycle-normalization fix to make definedness monotone.
Test Plan
Adjusted many mdtest expectations.
Conformance suite results are positive, and add one newly-passing file. (The tool shows a reduction in true positives, but these are diagnostics going away on
assert_typelines where diagnostics are optionally permitted, not required, or even desirable.)Ecosystem diff looks expected/positive. A number of the new errors come from projects which declare types via type comments, which we don't support, so we infer types for those attributes instead. There are of course some cases where the inferred type is not the intended type, but that's expected for this PR, and the overall scale of new diagnostics looks very reasonable.
Codspeed shows performance improvements from 0-3%, and we also see a small reduction in memory usage.