Fix unannotated attribute type inference bug (issue #1159)#3835
Conversation
Previously, Pyrefly incorrectly locked onto the first textual assignment to an unannotated attribute inside a constructor, leading to false-positive bad-assignment errors if the attribute was assigned different types across different control flow branches or initialization steps. This change modifies Pyrefly's class scope compiler to collect all assignments to an attribute inside constructors (and other recognized setup methods), and then unions their types in the solver. Type annotations, if present, still strictly override and enforce the declared type.
|
Diff from mypy_primer, showing the effect of this PR on open source code: pip (https://github.com/pypa/pip)
- ERROR src/pip/_vendor/pkg_resources/__init__.py:3395:16-30: Returned type `dict[None, list[Unknown]]` is not assignable to declared return type `dict[str | None, list[Requirement]]` [bad-return]
tornado (https://github.com/tornadoweb/tornado)
- ERROR tornado/httpserver.py:308:35-39: `None` is not assignable to attribute `address_family` with type `AddressFamily` [bad-assignment]
+ ERROR tornado/netutil.py:476:13-35: Object of class `NoneType` has no attribute `shutdown` [missing-attribute]
cki-lib (https://gitlab.com/cki-project/cki-lib)
+ ERROR cki_lib/kcidb/file.py:49:34-38: `list[dict[@_, @_]]` is not assignable to dict key with type `dict[str, Unknown]` [bad-assignment]
+ ERROR cki_lib/kcidb/file.py:52:35-36: Cannot index into `dict[str, Unknown]` [bad-index]
+ ERROR cki_lib/kcidb/file.py:55:16-25: Cannot index into `str` [bad-index]
+ ERROR cki_lib/kcidb/file.py:65:33-42: No matching overload found for function `typing.MutableMapping.setdefault` called with arguments: (Unknown, list[@_]) [no-matching-overload]
+ ERROR cki_lib/kcidb/file.py:66:13-34: Object of class `dict` has no attribute `append` [missing-attribute]
+ ERROR cki_lib/kcidb/file.py:68:21-41: Object of class `dict` has no attribute `index` [missing-attribute]
+ ERROR cki_lib/kcidb/file.py:76:38-50: Argument `str | Unknown` is not assignable to parameter `config` with type `dict[str, Any]` in function `cki_lib.config_tree.merge_dicts` [bad-argument-type]
+ ERROR cki_lib/kcidb/file.py:77:21-41: Object of class `dict` has no attribute `index` [missing-attribute]
+ ERROR cki_lib/kcidb/file.py:80:33-42: No matching overload found for function `typing.MutableMapping.setdefault` called with arguments: (Unknown, list[@_]) [no-matching-overload]
+ ERROR cki_lib/kcidb/file.py:81:13-34: Object of class `dict` has no attribute `append` [missing-attribute]
mitmproxy (https://github.com/mitmproxy/mitmproxy)
+ ERROR mitmproxy/tools/console/flowview.py:346:33-63: `Message | Unknown | None` is not assignable to `Message` [bad-assignment]
steam.py (https://github.com/Gobot1234/steam.py)
- ERROR steam/app.py:458:31-35: `None` is not assignable to attribute `updated_at` with type `datetime` [bad-assignment]
- ERROR steam/app.py:1753:35-39: `None` is not assignable to attribute `price_overview` with type `AppPriceOverview` [bad-assignment]
bokeh (https://github.com/bokeh/bokeh)
- ERROR src/bokeh/server/server.py:439:22-32: `int` is not assignable to attribute `_port` with type `None` [bad-assignment]
- ERROR src/bokeh/server/server.py:440:29-41: `str | None` is not assignable to attribute `_address` with type `None` [bad-assignment]
jax (https://github.com/google/jax)
+ ERROR jax/experimental/jax2tf/tests/cross_compilation_check.py:84:14-31: Object of class `NoneType` has no attribute `exists` [missing-attribute]
+ ERROR jax/experimental/jax2tf/tests/cross_compilation_check.py:90:14-33: Object of class `NoneType` has no attribute `makedirs` [missing-attribute]
+ ERROR jax/experimental/jax2tf/tests/cross_compilation_check.py:97:11-27: Object of class `NoneType` has no attribute `GFile` [missing-attribute]
+ ERROR jax/experimental/pallas/ops/tpu/paged_attention/paged_attention_kernel.py:84:9-38: Object of class `NoneType` has no attribute `at` [missing-attribute]
spark (https://github.com/apache/spark)
+ ERROR python/pyspark/core/broadcast.py:269:42-86: Object of class `NoneType` has no attribute `setupDecryptionServer` [missing-attribute]
+ ERROR python/pyspark/core/broadcast.py:271:17-65: Object of class `NoneType` has no attribute `waitTillBroadcastDataSent` [missing-attribute]
+ ERROR python/pyspark/core/context.py:562:9-30: Object of class `NoneType` has no attribute `setLogLevel` [missing-attribute]
+ ERROR python/pyspark/core/context.py:616:16-33: Object of class `NoneType` has no attribute `version` [missing-attribute]
+ ERROR python/pyspark/core/context.py:634:16-28: Object of class `NoneType` has no attribute `sc` [missing-attribute]
+ ERROR python/pyspark/core/context.py:652:16-28: Object of class `NoneType` has no attribute `sc` [missing-attribute]
+ ERROR python/pyspark/core/context.py:665:16-35: Object of class `NoneType` has no attribute `startTime` [missing-attribute]
+ ERROR python/pyspark/core/context.py:679:16-28: Object of class `NoneType` has no attribute `sc` [missing-attribute]
+ ERROR python/pyspark/core/context.py:693:16-28: Object of class `NoneType` has no attribute `sc` [missing-attribute]
+ ERROR python/pyspark/core/context.py:738:20-38: Object of class `NoneType` has no attribute `emptyRDD` [missing-attribute]
+ ERROR python/pyspark/core/context.py:872:54-66: Object of class `NoneType` has no attribute `sc` [missing-attribute]
+ ERROR python/pyspark/core/context.py:976:20-40: Object of class `NoneType` has no attribute `objectFile` [missing-attribute]
+ ERROR python/pyspark/core/context.py:1040:20-38: Object of class `NoneType` has no attribute `textFile` [missing-attribute]
+ ERROR python/pyspark/core/context.py:1120:13-37: Object of class `NoneType` has no attribute `wholeTextFiles` [missing-attribute]
+ ERROR python/pyspark/core/context.py:1176:13-34: Object of class `NoneType` has no attribute `binaryFiles` [missing-attribute]
+ ERROR python/pyspark/core/context.py:1225:20-43: Object of class `NoneType` has no attribute `binaryRecords` [missing-attribute]
+ ERROR python/pyspark/core/context.py:1726:16-40: Object of class `NoneType` has no attribute `checkpointFile` [missing-attribute]
+ ERROR python/pyspark/core/context.py:1783:20-35: Object of class `NoneType` has no attribute `union` [missing-attribute]
+ ERROR python/pyspark/core/context.py:1948:9-21: Object of class `NoneType` has no attribute `sc` [missing-attribute]
+ ERROR python/pyspark/core/context.py:1962:17-29: Object of class `NoneType` has no attribute `sc` [missing-attribute]
+ ERROR python/pyspark/core/context.py:2076:9-21: Object of class `NoneType` has no attribute `sc` [missing-attribute]
+ ERROR python/pyspark/core/context.py:2090:17-29: Object of class `NoneType` has no attribute `sc` [missing-attribute]
+ ERROR python/pyspark/core/context.py:2113:9-21: Object of class `NoneType` has no attribute `sc` [missing-attribute]
+ ERROR python/pyspark/core/context.py:2128:16-28: Object of class `NoneType` has no attribute `sc` [missing-attribute]
+ ERROR python/pyspark/core/context.py:2129:20-32: Object of class `NoneType` has no attribute `sc` [missing-attribute]
+ ERROR python/pyspark/core/context.py:2216:9-30: Object of class `NoneType` has no attribute `setJobGroup` [missing-attribute]
+ ERROR python/pyspark/core/context.py:2240:9-39: Object of class `NoneType` has no attribute `setInterruptOnCancel` [missing-attribute]
+ ERROR python/pyspark/core/context.py:2302:9-28: Object of class `NoneType` has no attribute `addJobTag` [missing-attribute]
+ ERROR python/pyspark/core/context.py:2335:9-31: Object of class `NoneType` has no attribute `removeJobTag` [missing-attribute]
+ ERROR python/pyspark/core/context.py:2363:16-36: Object of class `NoneType` has no attribute `getJobTags` [missing-attribute]
+ ERROR python/pyspark/core/context.py:2386:9-31: Object of class `NoneType` has no attribute `clearJobTags` [missing-attribute]
+ ERROR python/pyspark/core/context.py:2414:9-35: Object of class `NoneType` has no attribute `setLocalProperty` [missing-attribute]
+ ERROR python/pyspark/core/context.py:2427:16-42: Object of class `NoneType` has no attribute `getLocalProperty` [missing-attribute]
+ ERROR python/pyspark/core/context.py:2445:9-36: Object of class `NoneType` has no attribute `setJobDescription` [missing-attribute]
+ ERROR python/pyspark/core/context.py:2453:16-28: Object of class `NoneType` has no attribute `sc` [missing-attribute]
+ ERROR python/pyspark/core/context.py:2471:9-21: Object of class `NoneType` has no attribute `sc` [missing-attribute]
+ ERROR python/pyspark/core/context.py:2493:16-43: Object of class `NoneType` has no attribute `cancelJobsWithTag` [missing-attribute]
+ ERROR python/pyspark/core/context.py:2507:9-21: Object of class `NoneType` has no attribute `sc` [missing-attribute]
+ ERROR python/pyspark/core/context.py:2515:30-53: Object of class `NoneType` has no attribute `statusTracker` [missing-attribute]
+ ERROR python/pyspark/core/context.py:2571:48-60: Object of class `NoneType` has no attribute `sc` [missing-attribute]
+ ERROR python/pyspark/core/context.py:2627:22-41: Object of class `NoneType` has no attribute `resources` [missing-attribute]
+ ERROR python/pyspark/sql/types.py:1587:31-47: Argument `StructField | Unknown` is not assignable to parameter `fields` with type `list[StructField] | None` in function `StructType.__init__` [bad-argument-type]
+ ERROR python/pyspark/streaming/tests/test_context.py:32:18-38: Object of class `NoneType` has no attribute `queueStream` [missing-attribute]
+ ERROR python/pyspark/streaming/tests/test_context.py:37:9-23: Object of class `NoneType` has no attribute `start` [missing-attribute]
+ ERROR python/pyspark/streaming/tests/test_context.py:38:9-22: Object of class `NoneType` has no attribute `stop` [missing-attribute]
+ ERROR python/pyspark/streaming/tests/test_context.py:43:9-23: Object of class `NoneType` has no attribute `start` [missing-attribute]
+ ERROR python/pyspark/streaming/tests/test_context.py:44:9-22: Object of class `NoneType` has no attribute `stop` [missing-attribute]
+ ERROR python/pyspark/streaming/tests/test_context.py:45:9-22: Object of class `NoneType` has no attribute `stop` [missing-attribute]
+ ERROR python/pyspark/streaming/tests/test_context.py:49:19-39: Object of class `NoneType` has no attribute `queueStream` [missing-attribute]
+ ERROR python/pyspark/streaming/tests/test_context.py:81:19-39: Object of class `NoneType` has no attribute `queueStream` [missing-attribute]
+ ERROR python/pyspark/streaming/tests/test_context.py:82:20-40: Object of class `NoneType` has no attribute `queueStream` [missing-attribute]
+ ERROR python/pyspark/streaming/tests/test_context.py:83:20-34: Object of class `NoneType` has no attribute `union` [missing-attribute]
+ ERROR python/pyspark/streaming/tests/test_context.py:89:20-40: Object of class `NoneType` has no attribute `queueStream` [missing-attribute]
+ ERROR python/pyspark/streaming/tests/test_context.py:90:20-40: Object of class `NoneType` has no attribute `queueStream` [missing-attribute]
+ ERROR python/pyspark/streaming/tests/test_context.py:91:20-40: Object of class `NoneType` has no attribute `queueStream` [missing-attribute]
+ ERROR python/pyspark/streaming/tests/test_context.py:97:19-37: Object of class `NoneType` has no attribute `transform` [missing-attribute]
+ ERROR python/pyspark/streaming/tests/test_context.py:103:19-39: Object of class `NoneType` has no attribute `queueStream` [missing-attribute]
+ ERROR python/pyspark/streaming/tests/test_context.py:110:9-29: Object of class `NoneType` has no attribute `queueStream` [missing-attribute]
+ ERROR python/pyspark/streaming/tests/test_context.py:111:9-23: Object of class `NoneType` has no attribute `start` [missing-attribute]
+ ERROR python/pyspark/streaming/tests/test_context.py:115:9-22: Object of class `NoneType` has no attribute `stop` [missing-attribute]
+ ERROR python/pyspark/streaming/tests/test_context.py:167:9-23: Object of class `NoneType` has no attribute `start` [missing-attribute]
+ ERROR python/pyspark/streaming/tests/test_context.py:168:26-60: Object of class `NoneType` has no attribute `awaitTerminationOrTimeout` [missing-attribute]
+ ERROR python/pyspark/streaming/tests/test_context.py:169:9-22: Object of class `NoneType` has no attribute `stop` [missing-attribute]
+ ERROR python/pyspark/streaming/tests/test_context.py:170:25-59: Object of class `NoneType` has no attribute `awaitTerminationOrTimeout` [missing-attribute]
+ ERROR python/pyspark/util.py:611:29-49: Object of class `NoneType` has no attribute `addTag` [missing-attribute]
+ ERROR python/pyspark/util.py:630:28-48: Object of class `NoneType` has no attribute `client` [missing-attribute]
prefect (https://github.com/PrefectHQ/prefect)
- ERROR src/integrations/prefect-sqlalchemy/prefect_sqlalchemy/database.py:193:31-48: No matching overload found for function `sqlalchemy.engine.create.create_engine` called with arguments: (**dict[str, dict[str, Any] | Any]) [no-matching-overload]
+ ERROR src/integrations/prefect-sqlalchemy/prefect_sqlalchemy/database.py:193:31-48: No matching overload found for function `sqlalchemy.engine.create.create_engine` called with arguments: (**dict[str, URL | dict[str, Any] | Unknown]) [no-matching-overload]
- ERROR src/integrations/prefect-sqlalchemy/prefect_sqlalchemy/database.py:824:38-53: Unpacked keyword argument `dict[str, Any] | Any` is not assignable to parameter `url` with type `URL | str` in function `sqlalchemy.ext.asyncio.engine.create_async_engine` [bad-argument-type]
+ ERROR src/integrations/prefect-sqlalchemy/prefect_sqlalchemy/database.py:824:38-53: Unpacked keyword argument `URL | dict[str, Any] | Unknown` is not assignable to parameter `url` with type `URL | str` in function `sqlalchemy.ext.asyncio.engine.create_async_engine` [bad-argument-type]
+ ERROR src/prefect/task_engine.py:973:17-55: Class `NotSet` has no class attribute `isolation_level` [missing-attribute]
+ ERROR src/prefect/task_engine.py:1603:17-55: Class `NotSet` has no class attribute `isolation_level` [missing-attribute]
- ERROR src/prefect/tasks.py:556:33-40: `CachePolicy` is not assignable to attribute `cache_policy` with type `_None | None` [bad-assignment]
- ERROR src/prefect/tasks.py:561:73-85: `CacheKeyFnPolicy | CachePolicy | _None | type[NotSet]` is not assignable to attribute `cache_policy` with type `_None | None` [bad-assignment]
- ERROR src/prefect/tasks.py:581:17-36: `NoneType | float | int | list[float]` is not assignable to attribute `retry_delay_seconds` with type `list[float]` [bad-assignment]
- ERROR src/prefect/tasks.py:805:17-807:46: Argument `((int) -> list[float]) | float | int | list[float] | type[NotSet]` is not assignable to parameter `retry_delay_seconds` with type `((int) -> list[float]) | float | int | list[float] | None` in function `Task.__init__` [bad-argument-type]
+ ERROR src/prefect/tasks.py:805:17-807:46: Argument `((int) -> list[float]) | float | int | list[float] | type[NotSet] | None` is not assignable to parameter `retry_delay_seconds` with type `((int) -> list[float]) | float | int | list[float] | None` in function `Task.__init__` [bad-argument-type]
aiortc (https://github.com/aiortc/aiortc)
+ ERROR src/aiortc/rtcrtpreceiver.py:476:43-48: Argument `int | list[int] | Unknown` is not assignable to parameter `bitrate` with type `int` in function `aiortc.rtp.pack_remb_fci` [bad-argument-type]
+ ERROR src/aiortc/rtcrtpreceiver.py:476:43-48: Argument `int | list[int] | Unknown` is not assignable to parameter `ssrcs` with type `list[int]` in function `aiortc.rtp.pack_remb_fci` [bad-argument-type]
materialize (https://github.com/MaterializeInc/materialize)
- ERROR misc/python/materialize/output_consistency/enum/enum_operation_param.py:49:34-38: `None` is not assignable to attribute `invalid_value` with type `str` [bad-assignment]
- ERROR misc/python/materialize/output_consistency/validation/validation_message.py:129:45-49: `None` is not assignable to attribute `concerned_expression_str` with type `str` [bad-assignment]
- ERROR misc/python/materialize/output_consistency/validation/validation_message.py:130:46-50: `None` is not assignable to attribute `concerned_expression_hash` with type `int` [bad-assignment]
freqtrade (https://github.com/freqtrade/freqtrade)
- ERROR freqtrade/freqai/freqai_interface.py:350:21-41: Argument `DataFrame | Series` is not assignable to parameter `dataframe` with type `DataFrame` in function `freqtrade.strategy.interface.IStrategy.set_freqai_targets` [bad-argument-type]
+ ERROR freqtrade/freqai/freqai_interface.py:350:21-41: Argument `DataFrame | Series | Unknown` is not assignable to parameter `dataframe` with type `DataFrame` in function `freqtrade.strategy.interface.IStrategy.set_freqai_targets` [bad-argument-type]
- ERROR freqtrade/freqai/freqai_interface.py:354:21-44: Argument `DataFrame | Series` is not assignable to parameter `dataframe` with type `DataFrame` in function `freqtrade.strategy.interface.IStrategy.set_freqai_targets` [bad-argument-type]
+ ERROR freqtrade/freqai/freqai_interface.py:354:21-44: Argument `DataFrame | Series | Unknown` is not assignable to parameter `dataframe` with type `DataFrame` in function `freqtrade.strategy.interface.IStrategy.set_freqai_targets` [bad-argument-type]
more-itertools (https://github.com/more-itertools/more-itertools)
- ERROR more_itertools/more.py:3041:27-44: `deque[@_]` is not assignable to attribute `_cache` with type `list[Unknown]` [bad-assignment]
+ ERROR more_itertools/more.py:5508:21-28: Cannot set item in `list[None]` [unsupported-operation]
pwndbg (https://github.com/pwndbg/pwndbg)
- ERROR pwndbg/aglib/heap/ptmalloc.py:443:34-92: Argument `Value | None` is not assignable to parameter `x` with type `Buffer | SupportsIndex | SupportsInt | SupportsTrunc | str` in function `int.__new__` [bad-argument-type]
+ ERROR pwndbg/aglib/heap/ptmalloc.py:443:34-92: Argument `Value | Unknown | None` is not assignable to parameter `x` with type `Buffer | SupportsIndex | SupportsInt | SupportsTrunc | str` in function `int.__new__` [bad-argument-type]
- ERROR pwndbg/aglib/heap/ptmalloc.py:452:17-75: Argument `Value | None` is not assignable to parameter `x` with type `Buffer | SupportsIndex | SupportsInt | SupportsTrunc | str` in function `int.__new__` [bad-argument-type]
+ ERROR pwndbg/aglib/heap/ptmalloc.py:452:17-75: Argument `Value | Unknown | None` is not assignable to parameter `x` with type `Buffer | SupportsIndex | SupportsInt | SupportsTrunc | str` in function `int.__new__` [bad-argument-type]
- ERROR pwndbg/aglib/heap/ptmalloc.py:1359:25-44: Argument `Value | None` is not assignable to parameter `x` with type `Buffer | SupportsIndex | SupportsInt | SupportsTrunc | str` in function `int.__new__` [bad-argument-type]
+ ERROR pwndbg/aglib/heap/ptmalloc.py:1359:25-44: Argument `Value | Unknown | None` is not assignable to parameter `x` with type `Buffer | SupportsIndex | SupportsInt | SupportsTrunc | str` in function `int.__new__` [bad-argument-type]
setuptools (https://github.com/pypa/setuptools)
+ ERROR setuptools/_distutils/command/build_clib.py:91:47-60: Argument `Compiler | Unknown` is not assignable to parameter `compiler` with type `str | None` in function `setuptools._distutils.compilers.C.base.new_compiler` [bad-argument-type]
+ ERROR setuptools/_distutils/command/build_ext.py:327:22-35: Argument `Compiler | Unknown` is not assignable to parameter `compiler` with type `str | None` in function `setuptools._distutils.compilers.C.base.new_compiler` [bad-argument-type]
comtypes (https://github.com/enthought/comtypes)
- ERROR comtypes/automation.py:398:30-35: `_Pointer[Unknown]` is not assignable to attribute `__keepref` with type `_CArgObject` [bad-assignment]
apprise (https://github.com/caronc/apprise)
- ERROR apprise/apprise_attachment.py:123:29-33: `None` is not assignable to attribute `location` with type `ContentLocation` [bad-assignment]
- ERROR apprise/attachment/base.py:172:26-30: `None` is not assignable to attribute `cache` with type `bool | int` [bad-assignment]
- ERROR apprise/attachment/http.py:150:26-30: Argument `tuple[Unknown, Unknown | None] | None` is not assignable to parameter `auth` with type `((PreparedRequest) -> PreparedRequest) | AuthBase | tuple[str, str] | None` in function `requests.api.get` [bad-argument-type]
+ ERROR apprise/attachment/http.py:150:26-30: Argument `tuple[str | Unknown, str | Unknown | None] | None` is not assignable to parameter `auth` with type `((PreparedRequest) -> PreparedRequest) | AuthBase | tuple[str, str] | None` in function `requests.api.get` [bad-argument-type]
- ERROR apprise/config/http.py:186:22-26: Argument `tuple[Unknown, Unknown | None] | None` is not assignable to parameter `auth` with type `((PreparedRequest) -> PreparedRequest) | AuthBase | tuple[str, str] | None` in function `requests.api.post` [bad-argument-type]
+ ERROR apprise/config/http.py:186:22-26: Argument `tuple[str | Unknown, str | Unknown | None] | None` is not assignable to parameter `auth` with type `((PreparedRequest) -> PreparedRequest) | AuthBase | tuple[str, str] | None` in function `requests.api.post` [bad-argument-type]
+ ERROR apprise/persistent_store.py:467:37-469:26: No matching overload found for function `posixpath.join` called with arguments: (str | Unknown | None, str) [no-matching-overload]
+ ERROR apprise/persistent_store.py:550:31-77: No matching overload found for function `posixpath.join` called with arguments: (str | Unknown | None, str) [no-matching-overload]
- ERROR apprise/persistent_store.py:416:32-36: `None` is not assignable to attribute `__base_path` with type `str` [bad-assignment]
- ERROR apprise/persistent_store.py:417:32-36: `None` is not assignable to attribute `__temp_path` with type `str` [bad-assignment]
- ERROR apprise/persistent_store.py:418:32-36: `None` is not assignable to attribute `__data_path` with type `str` [bad-assignment]
+ ERROR apprise/persistent_store.py:779:31-77: No matching overload found for function `posixpath.join` called with arguments: (str | Unknown | None, str) [no-matching-overload]
- ERROR apprise/persistent_store.py:793:31-799:18: No matching overload found for function `gzip.open` called with arguments: (str, compresslevel=int, encoding=str | None, errors=str | None, newline=str | None) [no-matching-overload]
+ ERROR apprise/persistent_store.py:793:31-799:18: No matching overload found for function `gzip.open` called with arguments: (Unknown, compresslevel=int, encoding=str | None, errors=str | None, newline=str | None) [no-matching-overload]
+ ERROR apprise/persistent_store.py:1007:33-51: No matching overload found for function `posixpath.basename` called with arguments: (str | Unknown | None) [no-matching-overload]
+ ERROR apprise/persistent_store.py:1020:29-45: Argument `str | Unknown | None` is not assignable to parameter `name` with type `PathLike[bytes] | PathLike[str] | bytes | str` in function `os.makedirs` [bad-argument-type]
+ ERROR apprise/persistent_store.py:1035:29-45: Argument `str | Unknown | None` is not assignable to parameter `name` with type `PathLike[bytes] | PathLike[str] | bytes | str` in function `os.makedirs` [bad-argument-type]
+ ERROR apprise/persistent_store.py:1049:29-45: Argument `str | Unknown | None` is not assignable to parameter `name` with type `PathLike[bytes] | PathLike[str] | bytes | str` in function `os.makedirs` [bad-argument-type]
+ ERROR apprise/persistent_store.py:1298:37-1301:26: No matching overload found for function `posixpath.join` called with arguments: (str | Unknown | None, str) [no-matching-overload]
+ ERROR apprise/persistent_store.py:1305:28-68: `+` is not supported between `None` and `Literal['[/\\\\].+']` [unsupported-operation]
+ ERROR apprise/persistent_store.py:1305:37-55: `str | Unknown | None` is not assignable to any of constraints `str`, `bytes` of type variable `AnyStr` [bad-specialization]
+ ERROR apprise/persistent_store.py:1308:21-1309:33: `+` is not supported between `None` and `Literal['[/\\\\].+']` [unsupported-operation]
+ ERROR apprise/persistent_store.py:1308:30-48: `str | Unknown | None` is not assignable to any of constraints `str`, `bytes` of type variable `AnyStr` [bad-specialization]
+ ERROR apprise/persistent_store.py:1321:41-70: No matching overload found for function `posixpath.join` called with arguments: (str | Unknown | None, Literal['**'], Literal['*']) [no-matching-overload]
+ ERROR apprise/persistent_store.py:1326:71-77: No matching overload found for function `re.Pattern.match` called with arguments: (PathLike[bytes] | PathLike[str] | bytes | int | str) [no-matching-overload]
+ ERROR apprise/persistent_store.py:1336:41-70: No matching overload found for function `posixpath.join` called with arguments: (str | Unknown | None, Literal['**'], Literal['*']) [no-matching-overload]
+ ERROR apprise/persistent_store.py:1853:28-1856:10: No matching overload found for function `posixpath.join` called with arguments: (str | Unknown | None, str) [no-matching-overload]
- ERROR apprise/persistent_store.py:1866:16-27: Returned type `Unknown | None` is not assignable to declared return type `PersistentStoreMode` [bad-return]
+ ERROR apprise/persistent_store.py:1866:16-27: Returned type `PersistentStoreMode | Unknown | None` is not assignable to declared return type `PersistentStoreMode` [bad-return]
- ERROR apprise/plugins/apprise_api.py:400:22-26: Argument `tuple[Unknown, Unknown | None] | None` is not assignable to parameter `auth` with type `((PreparedRequest) -> PreparedRequest) | AuthBase | tuple[str, str] | None` in function `requests.api.post` [bad-argument-type]
+ ERROR apprise/plugins/apprise_api.py:400:22-26: Argument `tuple[str | Unknown, str | Unknown | None] | None` is not assignable to parameter `auth` with type `((PreparedRequest) -> PreparedRequest) | AuthBase | tuple[str, str] | None` in function `requests.api.post` [bad-argument-type]
- ERROR apprise/plugins/bark.py:279:26-30: `None` is not assignable to attribute `badge` with type `int` [bad-assignment]
- ERROR apprise/plugins/bark.py:282:26-30: `None` is not assignable to attribute `badge` with type `int` [bad-assignment]
- ERROR apprise/plugins/bark.py:436:26-30: Argument `tuple[Unknown, Unknown | None] | None` is not assignable to parameter `auth` with type `((PreparedRequest) -> PreparedRequest) | AuthBase | tuple[str, str] | None` in function `requests.api.post` [bad-argument-type]
+ ERROR apprise/plugins/bark.py:436:26-30: Argument `tuple[str | Unknown, str | Unknown | None] | None` is not assignable to parameter `auth` with type `((PreparedRequest) -> PreparedRequest) | AuthBase | tuple[str, str] | None` in function `requests.api.post` [bad-argument-type]
- ERROR apprise/plugins/bulkvs.py:257:26-30: Argument `tuple[Unknown | None, Unknown | None]` is not assignable to parameter `auth` with type `((PreparedRequest) -> PreparedRequest) | AuthBase | tuple[str, str] | None` in function `requests.api.post` [bad-argument-type]
+ ERROR apprise/plugins/bulkvs.py:257:26-30: Argument `tuple[str | Unknown | None, str | Unknown | None]` is not assignable to parameter `auth` with type `((PreparedRequest) -> PreparedRequest) | AuthBase | tuple[str, str] | None` in function `requests.api.post` [bad-argument-type]
- ERROR apprise/plugins/clicksend.py:208:26-52: Argument `tuple[Unknown | None, Unknown | None]` is not assignable to parameter `auth` with type `((PreparedRequest) -> PreparedRequest) | AuthBase | tuple[str, str] | None` in function `requests.api.post` [bad-argument-type]
+ ERROR apprise/plugins/clicksend.py:208:26-52: Argument `tuple[str | Unknown | None, str | Unknown | None]` is not assignable to parameter `auth` with type `((PreparedRequest) -> PreparedRequest) | AuthBase | tuple[str, str] | None` in function `requests.api.post` [bad-argument-type]
- ERROR apprise/plugins/custom_form.py:406:22-26: Argument `tuple[Unknown, Unknown | None] | None` is not assignable to parameter `auth` with type `((PreparedRequest) -> PreparedRequest) | AuthBase | tuple[str, str] | None` in function `requests.api.request` [bad-argument-type]
+ ERROR apprise/plugins/custom_form.py:406:22-26: Argument `tuple[str | Unknown, str | Unknown | None] | None` is not assignable to parameter `auth` with type `((PreparedRequest) -> PreparedRequest) | AuthBase | tuple[str, str] | None` in function `requests.api.request` [bad-argument-type]
- ERROR apprise/plugins/custom_json.py:321:22-26: Argument `tuple[Unknown, Unknown | None] | None` is not assignable to parameter `auth` with type `((PreparedRequest) -> PreparedRequest) | AuthBase | tuple[str, str] | None` in function `requests.api.request` [bad-argument-type]
+ ERROR apprise/plugins/custom_json.py:321:22-26: Argument `tuple[str | Unknown, str | Unknown | None] | None` is not assignable to parameter `auth` with type `((PreparedRequest) -> PreparedRequest) | AuthBase | tuple[str, str] | None` in function `requests.api.request` [bad-argument-type]
- ERROR apprise/plugins/custom_xml.py:412:22-26: Argument `tuple[Unknown, Unknown | None] | None` is not assignable to parameter `auth` with type `((PreparedRequest) -> PreparedRequest) | AuthBase | tuple[str, str] | None` in function `requests.api.request` [bad-argument-type]
+ ERROR apprise/plugins/custom_xml.py:412:22-26: Argument `tuple[str | Unknown, str | Unknown | None] | None` is not assignable to parameter `auth` with type `((PreparedRequest) -> PreparedRequest) | AuthBase | tuple[str, str] | None` in function `requests.api.request` [bad-argument-type]
- ERROR apprise/plugins/dapnet.py:271:34-43: Argument `Unknown | None` is not assignable to parameter `username` with type `bytes | str` in function `requests.auth.HTTPBasicAuth.__init__` [bad-argument-type]
+ ERROR apprise/plugins/dapnet.py:271:34-43: Argument `str | Unknown | None` is not assignable to parameter `username` with type `bytes | str` in function `requests.auth.HTTPBasicAuth.__init__` [bad-argument-type]
- ERROR apprise/plugins/dapnet.py:271:54-67: Argument `Unknown | None` is not assignable to parameter `password` with type `bytes | str` in function `requests.auth.HTTPBasicAuth.__init__` [bad-argument-type]
+ ERROR apprise/plugins/dapnet.py:271:54-67: Argument `str | Unknown | None` is not assignable to parameter `password` with type `bytes | str` in function `requests.auth.HTTPBasicAuth.__init__` [bad-argument-type]
- ERROR apprise/plugins/dbus.py:288:27-31: `None` is not assignable to attribute `x_axis` with type `int` [bad-assignment]
- ERROR apprise/plugins/dbus.py:289:27-31: `None` is not assignable to attribute `y_axis` with type `int` [bad-assignment]
- ERROR apprise/plugins/discord.py:294:26-30: `None` is not assignable to attribute `flags` with type `int` [bad-assignment]
- ERROR apprise/plugins/email/base.py:318:17-320:59: `NotifyFormat | OverflowMode | bool | float | str | None` is not assignable to attribute `secure_mode` with type `str | None` [bad-assignment]
- ERROR apprise/plugins/email/base.py:407:34-410:18: `tuple[Literal[False] | str | Unknown, str | Any | Unknown]` is not assignable to attribute `from_addr` with type `list[bool | str]` [bad-assignment]
- ERROR apprise/plugins/email/base.py:590:40-592:22: `bool | int | str | tuple[str] | Unknown | None` is not assignable to attribute `secure_mode` with type `str | None` [bad-assignment]
+ ERROR apprise/plugins/email/base.py:590:40-592:22: `NotifyFormat | OverflowMode | bool | float | int | str | tuple[str] | Unknown | None` is not assignable to attribute `secure_mode` with type `NotifyFormat | OverflowMode | bool | float | str | None` [bad-assignment]
+ ERROR apprise/plugins/email/base.py:624:21-38: Cannot set item in `tuple[bool | str | Unknown, str | Any | Unknown]` [unsupported-operation]
- ERROR apprise/plugins/email/base.py:662:17-26: Argument `Unknown | None` is not assignable to parameter `port` with type `int` in function `smtplib.SMTP.__init__` [bad-argument-type]
+ ERROR apprise/plugins/email/base.py:662:17-26: Argument `int | Unknown | None` is not assignable to parameter `port` with type `int` in function `smtplib.SMTP.__init__` [bad-argument-type]
- ERROR apprise/plugins/email/base.py:662:17-26: Argument `Unknown | None` is not assignable to parameter `port` with type `int` in function `smtplib.SMTP_SSL.__init__` [bad-argument-type]
+ ERROR apprise/plugins/email/base.py:662:17-26: Argument `int | Unknown | None` is not assignable to parameter `port` with type `int` in function `smtplib.SMTP_SSL.__init__` [bad-argument-type]
- ERROR apprise/plugins/email/base.py:705:25-42: Argument `bool | str` is not assignable to parameter `from_addr` with type `str` in function `smtplib.SMTP.sendmail` [bad-argument-type]
+ ERROR apprise/plugins/email/base.py:705:25-42: Argument `bool | str | Unknown` is not assignable to parameter `from_addr` with type `str` in function `smtplib.SMTP.sendmail` [bad-argument-type]
- ERROR apprise/plugins/email/base.py:808:21-51: Argument `tuple[Literal[True] | str, Literal[True] | str]` is not assignable to parameter `pair` with type `tuple[str | None, str]` in function `email.utils.formataddr` [bad-argument-type]
+ ERROR apprise/plugins/email/base.py:808:21-51: Argument `tuple[Literal[True] | str | Unknown, Literal[True] | str | Unknown]` is not assignable to parameter `pair` with type `tuple[str | None, str]` in function `email.utils.formataddr` [bad-argument-type]
- ERROR apprise/plugins/email/base.py:813:41-59: Argument `tuple[Literal[False], Literal[True] | str]` is not assignable to parameter `pair` with type `tuple[str | None, str]` in function `email.utils.formataddr` [bad-argument-type]
+ ERROR apprise/plugins/email/base.py:813:41-59: Argument `tuple[Literal[False], Literal[True] | str | Unknown]` is not assignable to parameter `pair` with type `tuple[str | None, str]` in function `email.utils.formataddr` [bad-argument-type]
- ERROR apprise/plugins/email/base.py:817:17-43: Argument `tuple[Literal[False], bool | str]` is not assignable to parameter `pair` with type `tuple[str | None, str]` in function `email.utils.formataddr` [bad-argument-type]
+ ERROR apprise/plugins/email/base.py:817:17-43: Argument `tuple[Literal[False], bool | str | Unknown]` is not assignable to parameter `pair` with type `tuple[str | None, str]` in function `email.utils.formataddr` [bad-argument-type]
- ERROR apprise/plugins/emby.py:680:32-53: Argument `tuple[Literal['UserId'], Unknown | None]` is not assignable to parameter `object` with type `tuple[str, str]` in function `list.append` [bad-argument-type]
+ ERROR apprise/plugins/emby.py:680:32-53: Argument `tuple[Literal['UserId'], str | Unknown | None]` is not assignable to parameter `object` with type `tuple[str, str]` in function `list.append` [bad-argument-type]
- ERROR apprise/plugins/enigma2.py:170:32-68: `LazyTranslation | NotifyFormat | OverflowMode | bool | float | frozenset[str] | str | None` is not assignable to attribute `timeout` with type `int` [bad-assignment]
- ERROR apprise/plugins/enigma2.py:174:28-68: `NotifyFormat | OverflowMode | bool | float | None` is not assignable to attribute `timeout` with type `int` [bad-assignment]
+ ERROR apprise/plugins/enigma2.py:289:24-30: Argument `dict[str, LazyTranslation | NotifyFormat | OverflowMode | bool | float | frozenset[str] | int | str | Unknown | None]` is not assignable to parameter `params` with type `Iterable[tuple[bytes | float | int | str, Iterable[bytes | float | int | str] | bytes | float | int | str | None]] | SupportsItems[bytes | float | int | str, Iterable[bytes | float | int | str] | bytes | float | int | str | None] | bytes | str | tuple[bytes | float | int | str, Iterable[bytes | float | int | str] | bytes | float | int | str | None] | None` in function `requests.api.get` [bad-argument-type]
- ERROR apprise/plugins/enigma2.py:291:22-26: Argument `tuple[Unknown, Unknown | None] | None` is not assignable to parameter `auth` with type `((PreparedRequest) -> PreparedRequest) | AuthBase | tuple[str, str] | None` in function `requests.api.get` [bad-argument-type]
+ ERROR apprise/plugins/enigma2.py:291:22-26: Argument `tuple[str | Unknown, str | Unknown | None] | None` is not assignable to parameter `auth` with type `((PreparedRequest) -> PreparedRequest) | AuthBase | tuple[str, str] | None` in function `requests.api.get` [bad-argument-type]
- ERROR apprise/plugins/fcm/__init__.py:244:17-246:34: `LazyTranslation | bool | str` is not assignable to attribute `mode` with type `str` [bad-assignment]
+ ERROR apprise/plugins/fcm/color.py:103:20-36: `+` is not supported between `Literal['#']` and `Match[str]` [unsupported-operation]
+ ERROR apprise/plugins/fcm/oauth.py:255:21-42: Object of class `DHPrivateKey` has no attribute `sign`
+ Object of class `MLKEM1024PrivateKey` has no attribute `sign`
+ Object of class `MLKEM768PrivateKey` has no attribute `sign`
+ Object of class `X25519PrivateKey` has no attribute `sign`
+ Object of class `X448PrivateKey` has no attribute `sign` [missing-attribute]
- ERROR apprise/plugins/fluxer.py:404:26-30: `None` is not assignable to attribute `flags` with type `int` [bad-assignment]
- ERROR apprise/plugins/fortysixelks.py:225:26-52: Argument `tuple[Unknown | None, Unknown | None]` is not assignable to parameter `auth` with type `((PreparedRequest) -> PreparedRequest) | AuthBase | tuple[str, str] | None` in function `requests.api.post` [bad-argument-type]
+ ERROR apprise/plugins/fortysixelks.py:225:26-52: Argument `tuple[str | Unknown | None, str | Unknown | None]` is not assignable to parameter `auth` with type `((PreparedRequest) -> PreparedRequest) | AuthBase | tuple[str, str] | None` in function `requests.api.post` [bad-argument-type]
- ERROR apprise/plugins/glib.py:242:27-31: `None` is not assignable to attribute `x_axis` with type `int` [bad-assignment]
- ERROR apprise/plugins/glib.py:243:27-31: `None` is not assignable to attribute `y_axis` with type `int` [bad-assignment]
- ERROR apprise/plugins/ifttt.py:176:35-45: `list[Unknown] | set[Unknown] | tuple[Unknown, ...]` is not assignable to attribute `del_tokens` with type `list[Unknown]` [bad-assignment]
- ERROR apprise/plugins/ifttt.py:180:35-57: `set[Unknown]` is not assignable to attribute `del_tokens` with type `list[Unknown]` [bad-assignment]
- ERROR apprise/plugins/jira.py:399:27-66: `NotifyFormat | OverflowMode | bool | float | int | str | None` is not assignable to attribute `action` with type `str | None` [bad-assignment]
- ERROR apprise/plugins/kodi.py:274:22-26: Argument `tuple[Unknown, Unknown | None] | None` is not assignable to parameter `auth` with type `((PreparedRequest) -> PreparedRequest) | AuthBase | tuple[str, str] | None` in function `requests.api.post` [bad-argument-type]
+ ERROR apprise/plugins/kodi.py:274:22-26: Argument `tuple[str | Unknown, str | Unknown | None] | None` is not assignable to parameter `auth` with type `((PreparedRequest) -> PreparedRequest) | AuthBase | tuple[str, str] | None` in function `requests.api.post` [bad-argument-type]
- ERROR apprise/plugins/mailgun.py:290:34-293:18: `tuple[Literal[False] | str | Unknown, str | Any | Unknown]` is not assignable to attribute `from_addr` with type `list[str]` [bad-assignment]
- ERROR apprise/plugins/mailgun.py:434:31-45: Argument `list[str]` is not assignable to parameter `pair` with type `tuple[str | None, str]` in function `email.utils.formataddr` [bad-argument-type]
+ ERROR apprise/plugins/mailgun.py:434:31-45: Argument `list[str] | tuple[bool | str | Unknown, str | Any | Unknown]` is not assignable to parameter `pair` with type `tuple[str | None, str]` in function `email.utils.formataddr` [bad-argument-type]
- ERROR apprise/plugins/mastodon.py:320:31-74: `NotifyFormat | OverflowMode | bool | float | str | None` is not assignable to attribute `visibility` with type `str | None` [bad-assignment]
- ERROR apprise/plugins/mattermost.py:264:25-62: `NotifyFormat | OverflowMode | bool | float | str | None` is not assignable to attribute `mode` with type `str | None` [bad-assignment]
- ERROR apprise/plugins/misskey.py:184:31-74: `NotifyFormat | OverflowMode | bool | float | str | None` is not assignable to attribute `visibility` with type `str | None` [bad-assignment]
- ERROR apprise/plugins/nextcloud.py:344:22-26: Argument `tuple[Unknown, Unknown | None] | None` is not assignable to parameter `auth` with type `((PreparedRequest) -> PreparedRequest) | AuthBase | tuple[str, str] | None` in function `requests.api.post` [bad-argument-type]
+ ERROR apprise/plugins/nextcloud.py:344:22-26: Argument `tuple[str | Unknown, str | Unknown | None] | None` is not assignable to parameter `auth` with type `((PreparedRequest) -> PreparedRequest) | AuthBase | tuple[str, str] | None` in function `requests.api.post` [bad-argument-type]
- ERROR apprise/plugins/nextcloud.py:344:22-26: Argument `tuple[Unknown, Unknown | None] | None` is not assignable to parameter `auth` with type `((PreparedRequest) -> PreparedRequest) | AuthBase | tuple[str, str] | None` in function `requests.api.get` [bad-argument-type]
+ ERROR apprise/plugins/nextcloud.py:344:22-26: Argument `tuple[str | Unknown, str | Unknown | None] | None` is not assignable to parameter `auth` with type `((PreparedRequest) -> PreparedRequest) | AuthBase | tuple[str, str] | None` in function `requests.api.get` [bad-argument-type]
- ERROR apprise/plugins/nextcloudtalk.py:224:26-52: Argument `tuple[Unknown | None, Unknown | None]` is not assignable to parameter `auth` with type `((PreparedRequest) -> PreparedRequest) | AuthBase | tuple[str, str] | None` in function `requests.api.post` [bad-argument-type]
+ ERROR apprise/plugins/nextcloudtalk.py:224:26-52: Argument `tuple[str | Unknown | None, str | Unknown | None]` is not assignable to parameter `auth` with type `((PreparedRequest) -> PreparedRequest) | AuthBase | tuple[str, str] | None` in function `requests.api.post` [bad-argument-type]
- ERROR apprise/plugins/notica.py:238:22-26: Argument `tuple[Unknown, Unknown | None] | None` is not assignable to parameter `auth` with type `((PreparedRequest) -> PreparedRequest) | AuthBase | tuple[str, str] | None` in function `requests.api.post` [bad-argument-type]
+ ERROR apprise/plugins/notica.py:238:22-26: Argument `tuple[str | Unknown, str | Unknown | None] | None` is not assignable to parameter `auth` with type `((PreparedRequest) -> PreparedRequest) | AuthBase | tuple[str, str] | None` in function `requests.api.post` [bad-argument-type]
- ERROR apprise/plugins/notificationapi.py:360:33-362:14: `Unknown | None` is not assignable to attribute `message_type` with type `str` [bad-assignment]
- ERROR apprise/plugins/notificationapi.py:687:28-691:14: No matching overload found for function `typing.MutableMapping.update` called with arguments: (dict[str, dict[Unknown, Unknown]]) [no-matching-overload]
- ERROR apprise/plugins/notificationapi.py:706:36-714:22: No matching overload found for function `typing.MutableMapping.update` called with arguments: (dict[str, dict[str, str | Unknown]]) [no-matching-overload]
- ERROR apprise/plugins/notificationapi.py:725:36-732:22: No matching overload found for function `typing.MutableMapping.update` called with arguments: (dict[str, dict[str, str | Unknown]]) [no-matching-overload]
- ERROR apprise/plugins/notificationapi.py:735:25-70: Object of class `str` has no attribute `update` [missing-attribute]
+ ERROR apprise/plugins/notificationapi.py:735:25-70: Object of class `NoneType` has no attribute `update`
+ Object of class `str` has no attribute `update` [missing-attribute]
- ERROR apprise/plugins/notificationapi.py:743:36-750:22: No matching overload found for function `typing.MutableMapping.update` called with arguments: (dict[str, dict[str, str | Unknown | None]]) [no-matching-overload]
- ERROR apprise/plugins/notificationapi.py:753:36-761:22: No matching overload found for function `typing.MutableMapping.update` called with arguments: (dict[str, dict[str, str | Unknown | None]]) [no-matching-overload]
- ERROR apprise/plugins/notificationapi.py:764:36-771:22: No matching overload found for function `typing.MutableMapping.update` called with arguments: (dict[str, dict[str, str | Unknown]]) [no-matching-overload]
- ERROR apprise/plugins/notificationapi.py:774:36-782:22: No matching overload found for function `typing.MutableMapping.update` called with arguments: (dict[str, dict[str, str | Unknown]]) [no-matching-overload]
- ERROR apprise/plugins/notificationapi.py:787:28-796:14: No matching overload found for function `typing.MutableMapping.update` called with arguments: (dict[str, dict[str, dict[str, Unknown]]]) [no-matching-overload]
... (truncated 75 lines) ...
operator (https://github.com/canonical/operator)
- ERROR ops/_private/harness.py:3159:25-32: `_TestingModelBackend` is not assignable to attribute `_backend` with type `type[_TestingModelBackend]` [bad-assignment]
mongo-python-driver (https://github.com/mongodb/mongo-python-driver)
+ ERROR pymongo/asynchronous/change_stream.py:246:13-25: Argument `AsyncCollection[_DocumentType] | AsyncCollection[Any] | AsyncDatabase[_DocumentType] | AsyncDatabase[Any] | AsyncMongoClient[_DocumentType] | Unknown` is not assignable to parameter `target` with type `AsyncCollection[Any] | AsyncDatabase[Any]` in function `pymongo.asynchronous.aggregation._AggregationCommand.__init__` [bad-argument-type]
+ ERROR pymongo/synchronous/change_stream.py:244:13-25: Argument `Collection[_DocumentType] | Collection[Any] | Database[_DocumentType] | Database[Any] | MongoClient[_DocumentType] | Unknown` is not assignable to parameter `target` with type `Collection[Any] | Database[Any]` in function `pymongo.synchronous.aggregation._AggregationCommand.__init__` [bad-argument-type]
beartype (https://github.com/beartype/beartype)
+ ERROR beartype/vale/_core/_valecore.py:257:16-30: Returned type `(() -> str) | object | str` is not assignable to declared return type `(() -> str) | str` [bad-return]
pandera (https://github.com/pandera-dev/pandera)
+ ERROR pandera/api/xarray/model.py:696:63-68: Argument `type[Any] | tuple[Any, ...] | Any | None` is not assignable to parameter `nested_data_array_model` with type `type[Any] | None` in function `pandera.api.xarray.model_components.XarrayFieldInfo.__init__` [bad-argument-type]
+ ERROR pandera/api/xarray/model.py:718:37-52: Class `Any` has no class attribute `to_schema`
+ Object of class `tuple` has no attribute `to_schema` [missing-attribute]
+ ERROR pandera/typing/common.py:259:39-47: Argument `tuple[Any, ...] | Any` is not assignable to parameter `obj` with type `(...) -> Any` in function `inspect.signature` [bad-argument-type]
- ERROR pandera/typing/common.py:251:20-45: `tuple[Any, ...] | Any | None` is not assignable to attribute `arg` with type `None` [bad-assignment]
- ERROR pandera/typing/common.py:277:28-31: `type[Any]` is not assignable to attribute `arg` with type `None` [bad-assignment]
- ERROR pandera/typing/common.py:280:28-42: `type[Any] | Any` is not assignable to attribute `arg` with type `None` [bad-assignment]
aiohttp (https://github.com/aio-libs/aiohttp)
- ERROR aiohttp/web_fileresponse.py:323:17-50: Cannot set item in `Mapping[str, str]` [unsupported-operation]
- ERROR aiohttp/web_fileresponse.py:359:21-54: Cannot set item in `Mapping[str, str]` [unsupported-operation]
- ERROR aiohttp/web_fileresponse.py:379:13-49: Cannot set item in `Mapping[str, str]` [unsupported-operation]
- ERROR aiohttp/web_fileresponse.py:380:13-37: Cannot set item in `Mapping[str, str]` [unsupported-operation]
- ERROR aiohttp/web_fileresponse.py:390:9-42: Cannot set item in `Mapping[str, str]` [unsupported-operation]
- ERROR aiohttp/web_fileresponse.py:395:13-46: Cannot set item in `Mapping[str, str]` [unsupported-operation]
+ ERROR aiohttp/web_response.py:110:18-26: Class member `StreamResponse._headers` overrides parent class `HeadersMixin` in an inconsistent manner [bad-override-mutable-attribute]
- ERROR aiohttp/web_response.py:201:16-29: Returned type `Mapping[str, str]` is not assignable to declared return type `CIMultiDict[str]` [bad-return]
- ERROR aiohttp/web_response.py:216:13-47: Cannot set item in `Mapping[str, str]` [unsupported-operation]
- ERROR aiohttp/web_response.py:218:13-30: Object of class `Mapping` has no attribute `pop` [missing-attribute]
- ERROR aiohttp/web_response.py:264:13-30: Object of class `Mapping` has no attribute `pop` [missing-attribute]
- ERROR aiohttp/web_response.py:266:13-46: Cannot set item in `Mapping[str, str]` [unsupported-operation]
- ERROR aiohttp/web_response.py:270:13-46: Cannot set item in `Mapping[str, str]` [unsupported-operation]
- ERROR aiohttp/web_response.py:274:13-46: Cannot set item in `Mapping[str, str]` [unsupported-operation]
- ERROR aiohttp/web_response.py:298:13-30: Object of class `Mapping` has no attribute `pop` [missing-attribute]
- ERROR aiohttp/web_response.py:302:13-37: Cannot set item in `Mapping[str, str]` [unsupported-operation]
- ERROR aiohttp/web_response.py:305:13-37: Cannot set item in `Mapping[str, str]` [unsupported-operation]
- ERROR aiohttp/web_response.py:309:13-37: Cannot set item in `Mapping[str, str]` [unsupported-operation]
- ERROR aiohttp/web_response.py:326:9-36: Cannot set item in `Mapping[str, str]` [unsupported-operation]
- ERROR aiohttp/web_response.py:332:9-45: Cannot set item in `Mapping[str, str]` [unsupported-operation]
- ERROR aiohttp/web_response.py:338:9-29: Object of class `Mapping` has no attribute `popall` [missing-attribute]
- ERROR aiohttp/web_response.py:384:35-42: Argument `Mapping[str, str]` is not assignable to parameter `headers` with type `CIMultiDict[str]` in function `aiohttp.helpers.populate_with_cookies` [bad-argument-type]
- ERROR aiohttp/web_response.py:397:17-48: Cannot set item in `Mapping[str, str]` [unsupported-operation]
- ERROR aiohttp/web_response.py:404:25-56: Cannot set item in `Mapping[str, str]` [unsupported-operation]
- ERROR aiohttp/web_response.py:414:21-49: Cannot delete item in `Mapping[str, str]` [unsupported-operation]
- ERROR aiohttp/web_response.py:418:21-52: Cannot delete item in `Mapping[str, str]` [unsupported-operation]
- ERROR aiohttp/web_response.py:421:13-31: Object of class `Mapping` has no attribute `setdefault` [missing-attribute]
- ERROR aiohttp/web_response.py:422:9-27: Object of class `Mapping` has no attribute `setdefault` [missing-attribute]
- ERROR aiohttp/web_response.py:423:9-27: Object of class `Mapping` has no attribute `setdefault` [missing-attribute]
- ERROR aiohttp/web_response.py:429:21-45: Cannot set item in `Mapping[str, str]` [unsupported-operation]
- ERROR aiohttp/web_response.py:431:17-41: Cannot set item in `Mapping[str, str]` [unsupported-operation]
- ERROR aiohttp/web_response.py:441:49-62: Argument `Mapping[str, str]` is not assignable to parameter `headers` with type `CIMultiDict[str]` in function `aiohttp.abc.AbstractStreamWriter.write_headers` [bad-argument-type]
- ERROR aiohttp/web_response.py:624:17-43: Cannot set item in `Mapping[str, str]` [unsupported-operation]
- ERROR aiohttp/web_response.py:630:25-37: Cannot set item in `Mapping[str, str]` [unsupported-operation]
- ERROR aiohttp/web_response.py:702:21-55: Cannot delete item in `Mapping[str, str]` [unsupported-operation]
- ERROR aiohttp/web_response.py:706:21-55: Cannot set item in `Mapping[str, str]` [unsupported-operation]
- ERROR aiohttp/web_response.py:713:21-55: Cannot set item in `Mapping[str, str]` [unsupported-operation]
- ERROR aiohttp/web_response.py:733:9-45: Cannot set item in `Mapping[str, str]` [unsupported-operation]
- ERROR aiohttp/web_response.py:734:9-43: Cannot set item in `Mapping[str, str]` [unsupported-operation]
vision (https://github.com/pytorch/vision)
- ERROR torchvision/transforms/v2/_augment.py:81:26-30: `None` is not assignable to attribute `value` with type `list[float]` [bad-assignment]
zulip (https://github.com/zulip/zulip)
- ERROR corporate/lib/stripe.py:4433:44-54: `dict[str, Any]` is not assignable to dict key `extra_data` with type `Realm | datetime | int` [bad-assignment]
- ERROR corporate/lib/stripe.py:4436:45-54: `UserProfile` is not assignable to dict key `acting_user` with type `Realm | datetime | int` [bad-assignment]
sockeye (https://github.com/awslabs/sockeye)
+ ERROR sockeye/checkpoint_decoder.py:166:83-89: Argument `tuple[Any, ...]` is not assignable to parameter `strings` with type `list[str]` in function `sockeye.inference.make_input_from_multiple_strings` [bad-argument-type]
+ ERROR sockeye/checkpoint_decoder.py:221:71-95: Argument `tuple[Any, ...] | Unknown` is not assignable to parameter `strings` with type `list[str]` in function `sockeye.inference.make_input_from_multiple_strings` [bad-argument-type]
- ERROR sockeye/data_io.py:284:34-38: `None` is not assignable to attribute `unk_id_source` with type `int` [bad-assignment]
- ERROR sockeye/data_io.py:1281:36-47: Argument `Unknown | None` is not assignable to parameter `object` with type `int` in function `list.insert` [bad-argument-type]
+ ERROR sockeye/data_io.py:1281:36-47: Argument `int | Unknown | None` is not assignable to parameter `object` with type `int` in function `list.insert` [bad-argument-type]
- ERROR sockeye/data_io.py:1283:33-44: Argument `Unknown | None` is not assignable to parameter `object` with type `int` in function `list.append` [bad-argument-type]
+ ERROR sockeye/data_io.py:1283:33-44: Argument `int | Unknown | None` is not assignable to parameter `object` with type `int` in function `list.append` [bad-argument-type]
+ ERROR sockeye/rerank.py:79:23-75: Object of class `float` has no attribute `score`
+ Object of class `int` has no attribute `score` [missing-attribute]
bandersnatch (https://github.com/pypa/bandersnatch)
- ERROR src/bandersnatch/mirror.py:263:16-265:10: Returned type `int | None` is not assignable to declared return type `int` [bad-return]
- ERROR src/bandersnatch/mirror.py:263:19-265:10: `int | None` is not assignable to upper bound `SupportsDunderGT[Any] | SupportsDunderLT[Any]` of type variable `SupportsRichComparisonT` [bad-specialization]
- ERROR src/bandersnatch/mirror.py:356:52-70: Argument `int | None` is not assignable to parameter `serial` with type `int` in function `bandersnatch.simple.SimpleAPI.sync_index_page` [bad-argument-type]
- ERROR src/bandersnatch/storage.py:68:34-54: `type[Any]` is not assignable to attribute `configuration` with type `ConfigParser` [bad-assignment]
+ ERROR src/bandersnatch/storage.py:70:31-59: `type[Any]` is not subscriptable [unsupported-operation]
+ ERROR src/bandersnatch_storage_plugins/s3.py:139:21-45: `type[Any]` is not subscriptable [unsupported-operation]
+ ERROR src/bandersnatch_storage_plugins/s3.py:159:25-49: `type[Any]` is not subscriptable [unsupported-operation]
ignite (https://github.com/pytorch/ignite)
+ ERROR ignite/handlers/checkpoint.py:475:57-65: Argument `Number | int | Unknown` is not assignable to parameter `new` with type `float | int` in function `Checkpoint._compare_fn` [bad-argument-type]
+ ERROR ignite/handlers/checkpoint.py:516:48-56: Argument `Number | int | Unknown` is not assignable to parameter `priority` with type `float | int` in function `Item.__new__` [bad-argument-type]
dragonchain (https://github.com/dragonchain/dragonchain)
- ERROR dragonchain/lib/dto/models_utest.py:344:30-54: Argument `Unknown | None` is not assignable to parameter `d1` with type `Mapping[Any, object]` in function `unittest.case.TestCase.assertDictEqual` [bad-argument-type]
+ ERROR dragonchain/lib/dto/models_utest.py:344:30-54: Argument `Any | Unknown | None` is not assignable to parameter `d1` with type `Mapping[Any, object]` in function `unittest.case.TestCase.assertDictEqual` [bad-argument-type]
websockets (https://github.com/aaugustin/websockets)
- ERROR src/websockets/asyncio/connection.py:69:34-52: `int | None` is not assignable to attribute `max_queue_low` with type `None` [bad-assignment]
- ERROR src/websockets/asyncio/connection.py:73:36-56: `int | None` is not assignable to attribute `write_limit_low` with type `None` [bad-assignment]
- ERROR src/websockets/protocol.py:120:36-58: `int | None` is not assignable to attribute `max_fragment_size` with type `None` [bad-assignment]
dd-trace-py (https://github.com/DataDog/dd-trace-py)
- ERROR ddtrace/contrib/internal/subprocess/patch.py:327:40-54: Argument `list[Unknown] | None` is not assignable to parameter `iterable` with type `Iterable[Unknown]` in function `collections.deque.__init__` [bad-argument-type]
+ ERROR ddtrace/contrib/internal/subprocess/patch.py:327:40-54: Argument `list[str] | list[Unknown] | None` is not assignable to parameter `iterable` with type `Iterable[str]` in function `collections.deque.__init__` [bad-argument-type]
- ERROR ddtrace/contrib/internal/tornado/stack_context.py:68:33-37: `None` is not assignable to attribute `new_contexts` with type `tuple[Unknown, Self@TracerStackContext]` [bad-assignment]
- ERROR ddtrace/vendor/dogstatsd/base.py:503:30-34: `None` is not assignable to attribute `_flush_thread` with type `Thread` [bad-assignment]
- ERROR ddtrace/vendor/ply/yacc.py:1437:27-43: `tuple[Unknown, ...]` is not assignable to attribute `prod` with type `list[Unknown]` [bad-assignment]
pandas (https://github.com/pandas-dev/pandas)
- ERROR pandas/core/dtypes/dtypes.py:652:16-32: Returned type `Index | None` is not assignable to declared return type `Index` [bad-return]
+ ERROR pandas/core/dtypes/dtypes.py:652:16-32: Returned type `Index | Any | None` is not assignable to declared return type `Index` [bad-return]
- ERROR pandas/core/strings/accessor.py:201:27-37: `Index` is not assignable to attribute `_index` with type `None` [bad-assignment]
- ERROR pandas/core/strings/accessor.py:202:26-35: `Hashable` is not assignable to attribute `_name` with type `None` [bad-assignment]
+ ERROR pandas/io/parsers/base_parser.py:245:37-46: Argument `int | integer` is not assignable to parameter `object` with type `tuple[Any, ...]` in function `list.insert` [bad-argument-type]
+ ERROR pandas/io/parsers/c_parser_wrapper.py:217:52-62: Argument `Sequence[Hashable] | list[Unknown] | Unknown` is not assignable to parameter `column_names` with type `list[str]` in function `_concatenate_chunks` [bad-argument-type]
+ ERROR pandas/io/parsers/python_parser.py:303:21-35: Argument `list[int | integer] | list[Unknown] | Unknown` is not assignable to parameter `index_col` with type `Sequence[int] | bool | None` in function `pandas.io.common.is_potential_multi_index` [bad-argument-type]
+ ERROR pandas/io/parsers/python_parser.py:340:17-31: Argument `list[int | integer] | list[Unknown] | Unknown` is not assignable to parameter `index_col` with type `Sequence[int] | bool | None` in function `pandas.io.common.is_potential_multi_index` [bad-argument-type]
+ ERROR pandas/io/sas/sas7bdat.py:560:63-80: Argument `bytes | str | Unknown` is not assignable to parameter `b` with type `bytes` in function `SAS7BDATReader._convert_header_text` [bad-argument-type]
+ ERROR pandas/io/stata.py:1757:24-38: Object of class `list` has no attribute `startswith` [missing-attribute]
+ ERROR pandas/io/stata.py:1759:81-84: Argument `list[list[list[list[str] | list[Unknown] | str | Unknown] | list[str] | list[Unknown] | str | Unknown] | list[list[str] | list[Unknown] | str | Unknown] | list[str] | list[Unknown] | str | Unknown] | list[list[list[str] | list[Unknown] | str | Unknown] | list[str] | list[Unknown] | str | Unknown] | list[list[str] | list[Unknown] | str | Unknown] | list[str] | list[Unknown] | str | Unknown` is not assignable to parameter `fmt` with type `str` in function `_stata_elapsed_date_to_datetime_vec` [bad-argument-type]
+ ERROR pandas/io/stata.py:1764:47-60: Argument `list[list[list[list[list[str] | list[Unknown] | str | Unknown] | list[str] | list[Unknown] | str | Unknown] | list[list[str] | list[Unknown] | str | Unknown] | list[str] | list[Unknown] | str | Unknown] | list[list[list[str] | list[Unknown] | str | Unknown] | list[str] | list[Unknown] | str | Unknown] | list[list[str] | list[Unknown] | str | Unknown] | list[str] | list[Unknown] | str | Unknown] | list[str]` is not assignable to parameter `lbllist` with type `Sequence[str]` in function `StataReader._do_convert_categoricals` [bad-argument-type]
meson (https://github.com/mesonbuild/meson)
- ERROR mesonbuild/cmake/interpreter.py:373:96-114: Argument `Unknown | None` is not assignable to parameter `clib_compiler` with type `Compiler | MissingCompiler` in function `mesonbuild.cmake.tracetargets.resolve_cmake_trace_targets` [bad-argument-type]
+ ERROR mesonbuild/cmake/interpreter.py:373:96-114: Argument `Compiler | Unknown | None` is not assignable to parameter `clib_compiler` with type `Compiler | MissingCompiler` in function `mesonbuild.cmake.tracetargets.resolve_cmake_trace_targets` [bad-argument-type]
+ ERROR mesonbuild/compilers/compilers.py:783:27-67: Object of class `NoneType` has no attribute `get_command` [missing-attribute]
- ERROR mesonbuild/compilers/compilers.py:787:50-57: Argument `list[str | None]` is not assignable to parameter `args` with type `list[str]` in function `mesonbuild.utils.universal.Popen_safe` [bad-argument-type]
+ ERROR mesonbuild/compilers/compilers.py:787:50-57: Argument `list[str | None] | Unknown` is not assignable to parameter `args` with type `list[str]` in function `mesonbuild.utils.universal.Popen_safe` [bad-argument-type]
- ERROR mesonbuild/dependencies/boost.py:371:21-56: `str | None` is not assignable to attribute `arch` with type `str` [bad-assignment]
+ ERROR mesonbuild/dependencies/boost.py:623:51-60: Argument `str | None` is not assignable to parameter `arch` with type `str` in function `BoostLibraryFile.arch_matches` [bad-argument-type]
+ ERROR mesonbuild/dependencies/pkgconfig.py:147:82-102: Object of class `NoneType` has no attribute `get_path` [missing-attribute]
- ERROR mesonbuild/dependencies/pkgconfig.py:241:23-27: `None` is not assignable to attribute `pkgbin` with type `ExternalProgram` [bad-assignment]
+ ERROR mesonbuild/dependencies/pkgconfig.py:288:42-65: Object of class `NoneType` has no attribute `get_command` [missing-attribute]
- ERROR mesonbuild/environment.py:230:32-36: `None` is not assignable to attribute `exe_wrapper` with type `ExternalProgram` [bad-assignment]
- ERROR mesonbuild/mconf.py:394:42-49: Argument `Unknown | None` is not assignable to parameter `builddata` with type `Build` in function `mesonbuild.mintro.write_meson_info_file` [bad-argument-type]
+ ERROR mesonbuild/mconf.py:394:42-49: Argument `Build | Unknown | None` is not assignable to parameter `builddata` with type `Build` in function `mesonbuild.mintro.write_meson_info_file` [bad-argument-type]
+ ERROR mesonbuild/modules/i18n.py:156:68-75: Argument `list[str | None] | list[str] | list[Any]` is not assignable to parameter `arguments` with type `list[str]` in function `XgettextProgram._get_rsp_file` [bad-argument-type]
+ ERROR mesonbuild/modules/python.py:557:21-558:44: Argument `list[str | None] | list[str] | list[Any]` is not assignable to parameter `args` with type `list[str]` in function `mesonbuild.utils.universal.Popen_safe` [bad-argument-type]
+ ERROR mesonbuild/modules/python.py:569:66-82: No matching overload found for function `str.join` called with arguments: (list[str | None] | list[str] | list[Any]) [no-matching-overload]
+ ERROR mesonbuild/programs.py:144:24-38: No matching overload found for function `str.join` called with arguments: (list[str | None] | list[str] | list[Any]) [no-matching-overload]
+ ERROR mesonbuild/programs.py:389:16-31: Returned type `list[str | None] | list[str] | list[Any]` is not assignable to declared return type `list[str]` [bad-return]
- ERROR mesonbuild/scripts/depfixer.py:500:48-55: Argument `Unknown | None` is not assignable to parameter `ifile` with type `BinaryIO` in function `SectionHeader.__init__` [bad-argument-type]
+ ERROR mesonbuild/scripts/depfixer.py:500:48-55: Argument `BufferedRandom | Unknown | None` is not assignable to parameter `ifile` with type `BinaryIO` in function `SectionHeader.__init__` [bad-argument-type]
- ERROR mesonbuild/scripts/depfixer.py:527:30-37: Argument `Unknown | None` is not assignable to parameter `ifile` with type `BinaryIO` in function `DynamicEntry.__init__` [bad-argument-type]
+ ERROR mesonbuild/scripts/depfixer.py:527:30-37: Argument `BufferedRandom | Unknown | None` is not assignable to parameter `ifile` with type `BinaryIO` in function `DynamicEntry.__init__` [bad-argument-type]
- ERROR mesonbuild/scripts/depfixer.py:538:29-36: Argument `Unknown | None` is not assignable to parameter `ifile` with type `BinaryIO` in function `DynsymEntry.__init__` [bad-argument-type]
+ ERROR mesonbuild/scripts/depfixer.py:538:29-36: Argument `BufferedRandom | Unknown | None` is not assignable to parameter `ifile` with type `BinaryIO` in function `DynsymEntry.__init__` [bad-argument-type]
- ERROR mesonbuild/scripts/depfixer.py:723:25-32: Argument `Unknown | None` is not assignable to parameter `ofile` with type `BinaryIO` in function `DynamicEntry.write` [bad-argument-type]
+ ERROR mesonbuild/scripts/depfixer.py:723:25-32: Argument `BufferedRandom | Unknown | None` is not assignable to parameter `ofile` with type `BinaryIO` in function `DynamicEntry.write` [bad-argument-type]
core (https://github.com/home-assistant/core)
- ERROR homeassistant/components/doods/image_processing.py:244:23-33: Argument `list[int]` is not assignable to parameter `box` with type `tuple[float, float, float, float]` in function `homeassistant.util.pil.draw_box` [bad-argument-type]
+ ERROR homeassistant/components/doods/image_processing.py:244:23-33: Argument `list[int] | list[Unknown]` is not assignable to parameter `box` with type `tuple[float, float, float, float]` in function `homeassistant.util.pil.draw_box` [bad-argument-type]
- ERROR homeassistant/components/influxdb/sensor.py:212:25-219:14: `InfluxQLSensorData` is not assignable to attribute `data` with type `InfluxFluxSensorData` [bad-assignment]
- ERROR homeassistant/components/kankun/switch.py:86:26-30: `None` is not assignable to attribute `_auth` with type `tuple[Unknown, Unknown]` [bad-assignment]
- ERROR homeassistant/components/modbus/cover.py:99:34-54: Argument `Any | None` is not assignable to parameter `value` with type `bool | int | str` in function `ModbusCover._set_attr_state` [bad-argument-type]
+ ERROR homeassistant/components/modbus/cover.py:99:34-54: Argument `bool | Unknown | None` is not assignable to parameter `value` with type `bool | int | str` in function `ModbusCover._set_attr_state` [bad-argument-type]
- ERROR homeassistant/components/neurio_energy/sensor.py:186:41-68: `Literal[UnitOfEnergy.KILO_WATT_HOUR]` is not assignable to attribute `_unit_of_measurement` with type `UnitOfPower` [bad-assignment]
- ERROR homeassistant/components/neurio_energy/sensor.py:196:41-68: `Literal[UnitOfEnergy.KILO_WATT_HOUR]` is not assignable to attribute `_unit_of_measurement` with type `UnitOfPower` [bad-assignment]
sphinx (https://github.com/sphinx-doc/sphinx)
+ ERROR sphinx/builders/changes.py:166:22-36: Argument `BuiltinTemplateLoader | Unknown` is not assignable to parameter `renderer` with type `BaseRenderer | None` in function `sphinx.util.fileutil.copy_asset_file` [bad-argument-type]
+ ERROR sphinx/builders/gettext.py:267:32-79: Object of class `SandboxedEnvironment` has no attribute `extract_translations` [missing-attribute]
+ ERROR sphinx/builders/html/__init__.py:863:30-44: Argument `BuiltinTemplateLoader | Unknown` is not assignable to parameter `renderer` with type `BaseRenderer | None` in function `sphinx.util.fileutil.copy_asset` [bad-argument-type]
+ ERROR sphinx/builders/html/__init__.py:890:26-40: Argument `BuiltinTemplateLoader | Unknown` is not assignable to parameter `renderer` with type `BaseRenderer | None` in function `sphinx.util.fileutil.copy_asset` [bad-argument-type]
+ ERROR sphinx/ext/napoleon/docstring.py:501:22-60: Object of class `Config` has no attribute `napoleon_preprocess_types` [missing-attribute]
+ ERROR sphinx/ext/napoleon/docstring.py:504:30-64: Object of class `Config` has no attribute `napoleon_type_aliases` [missing-attribute]
+ ERROR sphinx/ext/napoleon/docstring.py:510:41-53: Argument `sphinx.ext.napoleon.Config | sphinx.config.Config` is not assignable to parameter `config` with type `sphinx.config.Config | None` in function `GoogleDocstring.__init__` [bad-argument-type]
+ ERROR sphinx/ext/napoleon/docstring.py:533:41-53: Argument `sphinx.ext.napoleon.Config | sphinx.config.Config` is not assignable to parameter `config` with type `sphinx.config.Config | None` in function `GoogleDocstring.__init__` [bad-argument-type]
+ ERROR sphinx/ext/napoleon/docstring.py:552:47-85: Object of class `Config` has no attribute `napoleon_preprocess_types` [missing-attribute]
+ ERROR sphinx/ext/napoleon/docstring.py:555:34-68: Object of class `Config` has no attribute `napoleon_type_aliases` [missing-attribute]
+ ERROR sphinx/ext/napoleon/docstring.py:559:43-55: Argument `sphinx.ext.napoleon.Config | sphinx.config.Config` is not assignable to parameter `config` with type `sphinx.config.Config | None` in function `GoogleDocstring.__init__` [bad-argument-type]
+ ERROR sphinx/ext/napoleon/docstring.py:808:12-49: Object of class `Config` has no attribute `napoleon_custom_sections` [missing-attribute]
+ ERROR sphinx/ext/napoleon/docstring.py:809:26-63: Type `object` is not iterable [not-iterable]
+ ERROR sphinx/ext/napoleon/docstring.py:879:16-46: Object of class `Config` has no attribute `napoleon_use_ivar` [missing-attribute]
+ ERROR sphinx/ext/napoleon/docstring.py:896:12-42: Object of class `Config` has no attribute `napoleon_use_ivar` [missing-attribute]
+ ERROR sphinx/ext/napoleon/docstring.py:905:26-75: Object of class `Config` has no attribute `napoleon_use_admonition_for_examples` [missing-attribute]
+ ERROR sphinx/ext/napoleon/docstring.py:942:12-45: Object of class `Config` has no attribute `napoleon_use_keyword` [missing-attribute]
+ ERROR sphinx/ext/napoleon/docstring.py:961:26-72: Object of class `Config` has no attribute `napoleon_use_admonition_for_notes` [missing-attribute]
+ ERROR sphinx/ext/napoleon/docstring.py:965:12-43: Object of class `Config` has no attribute `napoleon_use_param` [missing-attribute]
+ ERROR sphinx/ext/napoleon/docstring.py:974:12-43: Object of class `Config` has no attribute `napoleon_use_param` [missing-attribute]
+ ERROR sphinx/ext/napoleon/docstring.py:1001:12-43: Object of class `Config` has no attribute `napoleon_use_param` [missing-attribute]
+ ERROR sphinx/ext/napoleon/docstring.py:1010:26-77: Object of class `Config` has no attribute `napoleon_use_admonition_for_references` [missing-attribute]
+ ERROR sphinx/ext/napoleon/docstring.py:1016:41-72: Object of class `Config` has no attribute `napoleon_use_rtype` [missing-attribute]
+ ERROR sphinx/ext/napoleon/docstring.py:1089:12-50: Object of class `Config` has no attribute `napoleon_attr_annotations` [missing-attribute]
+ ERROR sphinx/ext/napoleon/docstring.py:1248:12-50: Object of class `Config` has no attribute `napoleon_preprocess_types` [missing-attribute]
+ ERROR sphinx/ext/napoleon/docstring.py:1251:30-64: Object of class `Config` has no attribute `napoleon_type_aliases` [missing-attribute]
+ ERROR sphinx/ext/napoleon/docstring.py:1257:39-51: Argument `sphinx.ext.napoleon.Config | sphinx.config.Config` is not assignable to parameter `config` with type `sphinx.config.Config | None` in function `NumpyDocstring.__init__` [bad-argument-type]
+ ERROR sphinx/ext/napoleon/docstring.py:1370:28-62: Object of class `Config` has no attribute `napoleon_type_aliases` [missing-attribute]
parso (https://github.com/davidhalter/parso)
+ ERROR parso/python/errors.py:415:18-40: Object of class `NoneType` has no attribute `add_block` [missing-attribute]
+ ERROR parso/python/errors.py:416:24-43: Object of class `NoneType` has no attribute `blocks` [missing-attribute]
+ ERROR parso/python/errors.py:470:32-56: Object of class `NoneType` has no attribute `add_context` [missing-attribute]
+ ERROR parso/python/errors.py:489:9-30: Object of class `NoneType` has no attribute `finalize` [missing-attribute]
pydantic (https://github.com/pydantic/pydantic)
- ERROR pydantic/_internal/_validate_call.py:127:54-79: `((input: Any, *, strict: bool | None = None, extra: Literal['allow', 'forbid', 'ignore'] | None = None, from_attributes: bool | None = None, context: Any | None = None, self_instance: Any | None = None, allow_partial: Literal['off', 'on', 'trailing-strings'] | bool = False, by_alias: bool | None = None, by_name: bool | None = None) -> Any) | (self: SchemaValidator, input: Any, *, strict: bool | None = None, extra: Literal['allow', 'forbid', 'ignore'] | None = None, from_attributes: bool | None = None, context: Any | None = None, self_instance: Any | None = None, allow_partial: Literal['off', 'on', 'trailing-strings'] | bool = False, by_alias: bool | None = None, by_name: bool | None = None) -> Any` is not assignable to attribute `__return_pydantic_validator__` with type `(aw: Awaitable[Any]) -> Coroutine[Unknown, Unknown, None]` [bad-assignment]
- ERROR pydantic/_internal/_validate_call.py:129:50-54: `None` is not assignable to attribute `__return_pydantic_validator__` with type `(aw: Awaitable[Any]) -> Coroutine[Unknown, Unknown, None]` [bad-assignment]
discord.py (https://github.com/Rapptz/discord.py)
- ERROR discord/components.py:574:27-31: `None` is not assignable to attribute `_emoji` with type `PartialEmoji` [bad-assignment]
- ERROR discord/embeds.py:251:31-66: `datetime | None` is not assignable to attribute `_timestamp` with type `datetime` [bad-assignment]
- ERROR discord/embeds.py:362:31-35: `None` is not assignable to attribute `_timestamp` with type `datetime` [bad-assignment]
PyGithub (https://github.com/PyGithub/PyGithub)
+ ERROR github/Requester.py:932:57-71: Argument `list[str | Unknown | None] | list[str]` is not assignable to parameter `domain_or_domains` with type `list[str] | str` in function `Requester.__hostnameHasDomain` [bad-argument-type]
|
Primer Diff Classification❌ 4 regression(s) | ✅ 31 improvement(s) | ➖ 3 neutral | 38 project(s) total | +254, -208 errors 4 regression(s) across pip, apprise, beartype, aiohttp. error kinds:
Detailed analysis❌ Regression (4)pip (-1)
apprise (+81, -102)
All claims about Python types, the
beartype (+1)
aiohttp (+1, -38)
The 1 new Per-category reasoning:
✅ Improvement (31)tornado (+1, -1)
cki-lib (+10)
Per-category assessment:
mitmproxy (+1)
steam.py (-2)
bokeh (-2)
jax (+4)
spark (+66)
prefect (+5, -6)
Per-category reasoning:
aiortc (+1)
materialize (-3)
The analysis correctly identifies these as false positives caused by a first-assignment-wins inference model, and correctly states that the union-based accumulator model resolves them. The description of the code behavior, types, and branching logic is all accurate.
more-itertools (+1, -1)
setuptools (+2)
comtypes (-1)
operator (-1)
mongo-python-driver (+2)
In The The code works correctly at runtime because subclasses (
pandera (+2, -3)
The 2 new errors are more nuanced:
Overall, the type inference for
vision (-1)
zulip (-2)
sockeye (+4, -3)
For the removed errors:
For the new errors:
The overall change is mixed but slightly negative due to the 4 new false positives vs 3 removed false positives.
bandersnatch (+3, -4)
Per-category reasoning:
ignite (+2)
websockets (-3)
dd-trace-py (+1, -4)
The 1 new error at Net result: 3 false positives removed, 1 error improved in accuracy. This is clearly an improvement.
pandas (+9, -3)
meson (+16, -10)
Per-category reasoning:
core (+2, -6)
Per-category reasoning:
sphinx (+28)
The PR's intent was to fix issue #1159 by unioning branch types, but it has the side effect of introducing
parso (+4)
pydantic (-2)
discord.py (-3)
PyGithub (+1)
➖ Neutral (3)freqtrade (+2, -2)
pwndbg (+3, -3)
dragonchain (+1, -1)
Suggested fixesSummary: The PR's union-all-assignments model correctly fixes first-assignment-wins false positives in constructors, but causes ~80+ pyrefly-only false positives by (1) unioning assignments from non-constructor methods into the attribute type, polluting it with Unknown/unrelated types, (2) not respecting 1. In the method_defined_attributes merging logic in
2. In the DefinedInMethod arm of
3. In the override checking logic (likely in the class field or override validation code), add a guard to suppress bad-override-mutable-attribute when the parent class attribute is defined via a property or abstract method (not a plain field). In aiohttp, HeadersMixin._headers is effectively an abstract/property-like attribute that subclasses are expected to provide with a concrete type. The check should only fire for plain mutable fields, not for attributes that serve as abstract interface points.
Was this helpful? React with 👍 or 👎 Classification by primer-classifier (3 heuristic, 35 LLM) |
|
@yangdanny97 has imported this pull request. If you are a Meta employee, you can view this in D108836452. |
Summary
This PR resolves the unannotated attribute type inference bug where Pyrefly locked onto the first textual assignment to an attribute inside constructor methods (leading to false-positive
bad-assignmenterrors and incorrect type inference).Behavioral Changes
This PR changes the following type-checking behaviors:
intin the body of__init__and conditionally assigned anstrwill resolve toint | strrather than throwing abad-assignmenterror on the reassignment.cls.val) and an instance receiver (self.val) in constructors, it correctly resolves as class-visible (a class attribute) regardless of the declaration order of the constructors in the class body.__init__,__new__,__post_init__) always take precedence over unrecognized helper methods.__new__and__init__), we union their types.bad-assignmenterrors in case types are incompatible.self.val: int) and class body definitions (e.g.val = 0) still strictly override type inference as before, ensuring that type constraints are still strictly checked.High-Level Implementation Details
To support these behavioral improvements, we transitioned Pyrefly's class analysis from a "first-assignment-wins" model to an accumulator-based model:
__new__,__init__,__post_init__) into a vector instead of discarding subsequent ones.receiver_kindfield to track field visibility independently from individual method signatures, upgrading it toClassif any constructor assigns tocls.val.Fixes #1159
Test Plan
attributes.rscovering branching unions, unrecognized helper methods, class-level priority, annotation overrides, and class method receiver union/upgrade behaviors.python3 test.py