fix [Feat] better behavior for getattr() w/ literal attribute names #4477 - #4540
Open
asukaminato0721 wants to merge 2 commits into
Open
fix [Feat] better behavior for getattr() w/ literal attribute names #4477#4540asukaminato0721 wants to merge 2 commits into
asukaminato0721 wants to merge 2 commits into
Conversation
Contributor
|
This pull request has been imported. If you are a Meta employee, you can view this in D115872345. (Because this pull request was imported automatically, there will not be any future comments.) |
This comment has been minimized.
This comment has been minimized.
maggiemoss
requested changes
Aug 17, 2026
|
Diff from mypy_primer, showing the effect of this PR on open source code: ============================================================
SUMMARY
============================================================
Total: +122 new errors, -118 fixed errors
Projects with changes (43):
pip: +8 -4
tornado: +4 -4
mitmproxy: +1 -1
rotki: +1 -1
pytest: +2 -1
jax: +4 -3
spark: +3 -5
prefect: +0 -2
altair: +2 -4
materialize: +6 -0
urllib3: +1 -0
scikit-learn: +8 -1
freqtrade: +1 -1
setuptools: +5 -9
scikit-build-core: +14 -27
apprise: +0 -1
psycopg: +1 -1
operator: +1 -0
manticore: +1 -0
beartype: +2 -2
streamlit: +3 -3
hydra-zen: +2 -0
pandera: +1 -1
strawberry: +2 -0
zulip: +1 -1
dd-trace-py: +6 -8
anyio: +1 -1
hydpy: +4 -10
pandas: +1 -0
mypy: +2 -1
werkzeug: +1 -0
core: +3 -1
trio: +1 -1
sphinx: +10 -11
rich: +1 -1
porcupine: +2 -0
spack: +4 -3
nox: +2 -2
scrapy: +2 -2
django-test-migrations: +1 -1
pylint: +1 -0
graphql-core: +2 -2
django-modern-rest: +4 -2
============================================================
FULL DIFF DETAILS
------------------------------------------------------------
pip (https://github.com/pypa/pip)
+ ERROR src/pip/_internal/cli/req_command.py:324:70-72: Cannot infer type of empty container; it will be treated as containing `Any` [implicit-any-empty-container]
- ERROR src/pip/_internal/exceptions/hashes.py:145:13-20: Implicit conversion of `Link | Any | None` to `bool` is not allowed [implicit-bool]
+ ERROR src/pip/_internal/exceptions/hashes.py:145:13-20: Implicit conversion of `Link | Requirement | None` to `bool` is not allowed [implicit-bool]
+ ERROR src/pip/_vendor/distlib/resources.py:346:45-57: Argument `type[LoaderProtocol] | type[NoneType]` is not assignable to parameter `key` with type `type[NoneType] | type[zipimporter]` in function `dict.get` [bad-argument-type]
- ERROR src/pip/_vendor/pkg_resources/__init__.py:3292:16-18: Implicit conversion of `Any | None` to `bool` is not allowed [implicit-bool]
+ ERROR src/pip/_vendor/pkg_resources/__init__.py:3292:16-18: Implicit conversion of `str | None` to `bool` is not allowed [implicit-bool]
- ERROR src/pip/_vendor/pkg_resources/__init__.py:3292:16-3294:14: Implicit conversion of `Unknown | None` to `bool` is not allowed [implicit-bool]
+ ERROR src/pip/_vendor/pkg_resources/__init__.py:3292:16-3294:14: Implicit conversion of `Literal[''] | bool | None` to `bool` is not allowed [implicit-bool]
+ ERROR src/pip/_vendor/pkg_resources/__init__.py:3293:69-82: Argument `str | None` is not assignable to parameter `prefix` with type `str | tuple[str, ...]` in function `str.startswith` [bad-argument-type]
- ERROR src/pip/_vendor/rich/traceback.py:448:28-65: Implicit conversion of `Any | None` to `bool` is not allowed [implicit-bool]
+ ERROR src/pip/_vendor/rich/traceback.py:448:28-65: Implicit conversion of `list[str] | None` to `bool` is not allowed [implicit-bool]
+ ERROR src/pip/_vendor/urllib3/util/request.py:167:13-32: Result of call expression is of type `int` and is not used; assign to `_` if this is intentional [unused-call-result]
tornado (https://github.com/tornadoweb/tornado)
- ERROR tornado/autoreload.py:178:16-20: Implicit conversion of `Any | None` to `bool` is not allowed [implicit-bool]
+ ERROR tornado/autoreload.py:178:16-20: Implicit conversion of `str | None` to `bool` is not allowed [implicit-bool]
- ERROR tornado/autoreload.py:181:20-29: The type of `path` is unknown; it is inferred as an implicit `Any` [unknown-variable-type]
- ERROR tornado/autoreload.py:221:8-12: Implicit conversion of `Any | None` to `bool` is not allowed [implicit-bool]
+ ERROR tornado/autoreload.py:221:8-12: Implicit conversion of `ModuleSpec | None` to `bool` is not allowed [implicit-bool]
- ERROR tornado/autoreload.py:221:8-40: Implicit conversion of `Unknown | None` to `bool` is not allowed [implicit-bool]
+ ERROR tornado/autoreload.py:221:8-40: Implicit conversion of `ModuleSpec | bool | None` to `bool` is not allowed [implicit-bool]
+ ERROR tornado/autoreload.py:276:5-38: `ModuleSpec | None` is not assignable to attribute `_original_spec` with type `None` [bad-assignment]
mitmproxy (https://github.com/mitmproxy/mitmproxy)
- ERROR mitmproxy/tools/console/flowview.py:315:24-29: Implicit conversion of `str | Any` to `bool` is not allowed [implicit-bool]
+ ERROR mitmproxy/tools/console/flowview.py:315:24-29: Implicit conversion of `Literal[''] | MultiDictView[str, str]` to `bool` is not allowed [implicit-bool]
rotki (https://github.com/rotki/rotki)
- ERROR rotkehlchen/utils/progress.py:69:12-91: Implicit conversion of `Any | None` to `bool` is not allowed [implicit-bool]
+ ERROR rotkehlchen/utils/progress.py:69:12-91: Implicit conversion of `str | Any | None` to `bool` is not allowed [implicit-bool]
pytest (https://github.com/pytest-dev/pytest)
- ERROR src/_pytest/config/__init__.py:1332:12-58: Implicit conversion of `Namespace | bool | Any | None` to `bool` is not allowed [implicit-bool]
+ ERROR src/_pytest/config/__init__.py:1332:12-58: Implicit conversion of `Literal[False] | Namespace | Any | None` to `bool` is not allowed [implicit-bool]
+ ERROR src/_pytest/terminal.py:1613:47-49: Cannot infer type of empty container; it will be treated as containing `Any` [implicit-any-empty-container]
jax (https://github.com/google/jax)
+ ERROR jax/_src/compilation_cache.py:94:11-95:74: Implicit conversion of `bool | object` to `bool` is not allowed [implicit-bool]
- ERROR jax/_src/pallas/mosaic_gpu/pipeline.py:313:7-57: Implicit conversion of `set[int | Any]` to `bool` is not allowed [implicit-bool]
+ ERROR jax/_src/pallas/mosaic_gpu/pipeline.py:313:7-57: Implicit conversion of `set[int]` to `bool` is not allowed [implicit-bool]
- ERROR jax/_src/pallas/mosaic_gpu/pipeline.py:315:6-26: Implicit conversion of `list[int | Any]` to `bool` is not allowed [implicit-bool]
+ ERROR jax/_src/pallas/mosaic_gpu/pipeline.py:315:6-26: Implicit conversion of `list[int]` to `bool` is not allowed [implicit-bool]
- ERROR jax/_src/pallas/mosaic_gpu/pipeline.py:315:6-78: Implicit conversion of `bool | list[int | Any] | Unknown` to `bool` is not allowed [implicit-bool]
+ ERROR jax/_src/pallas/mosaic_gpu/pipeline.py:315:6-78: Implicit conversion of `bool | list[int]` to `bool` is not allowed [implicit-bool]
spark (https://github.com/apache/spark)
- ERROR python/pyspark/pandas/resample.py:240:23-31: The type of `mod` is unknown; it is inferred as an implicit `Any` [unknown-variable-type]
- ERROR python/pyspark/pandas/resample.py:242:29-37: The type of `edge_cond` is unknown; it is inferred as an implicit `Any` [unknown-variable-type]
- ERROR python/pyspark/sql/transpile.py:1032:13-1037:51: Implicit conversion of `Literal[True] | list[arg] | list[expr] | list[Any] | Any` to `bool` is not allowed [implicit-bool]
+ ERROR python/pyspark/sql/transpile.py:1032:13-1037:51: Implicit conversion of `Literal[True] | list[arg] | list[expr] | list[@_]` to `bool` is not allowed [implicit-bool]
- ERROR python/pyspark/testing/unittestutils.py:53:8-12: Implicit conversion of `Any | None` to `bool` is not allowed [implicit-bool]
+ ERROR python/pyspark/testing/unittestutils.py:53:8-12: Implicit conversion of `ModuleSpec | None` to `bool` is not allowed [implicit-bool]
- ERROR python/pyspark/testing/unittestutils.py:53:8-26: Implicit conversion of `Unknown | None` to `bool` is not allowed [implicit-bool]
+ ERROR python/pyspark/testing/unittestutils.py:53:8-26: Implicit conversion of `ModuleSpec | str | None` to `bool` is not allowed [implicit-bool]
prefect (https://github.com/PrefectHQ/prefect)
- ERROR src/prefect/_internal/concurrency/threads.py:344:12-69: Returning implicit Any from function declared to return "bool" [no-any-return-implicit]
- ERROR src/prefect/_internal/concurrency/threads.py:375:12-71: Returning implicit Any from function declared to return "bool" [no-any-return-implicit]
altair (https://github.com/vega/altair)
+ ERROR altair/jupyter/jupyter_chart.py:398:46-48: Cannot infer type of empty container; it will be treated as containing `Any` [implicit-any-empty-container]
- ERROR altair/jupyter/jupyter_chart.py:401:20-22: The type of this argument is unknown [unknown-argument-type]
- ERROR altair/jupyter/jupyter_chart.py:402:34-42: The type of this argument is unknown [unknown-argument-type]
- ERROR altair/utils/schemapi.py:1043:12-56: Implicit conversion of `Any | None` to `bool` is not allowed [implicit-bool]
+ ERROR altair/utils/schemapi.py:1043:12-56: Implicit conversion of `Unknown | None` to `bool` is not allowed [implicit-bool]
- ERROR altair/utils/schemapi.py:1045:24-35: Returning implicit Any from function declared to return "_CopyImpl | Any" [no-any-return-implicit]
materialize (https://github.com/MaterializeInc/materialize)
+ ERROR misc/python/materialize/cli/scratch/claude.py:126:46-48: Cannot infer type of empty container; it will be treated as containing `Any` [implicit-any-empty-container]
+ ERROR misc/python/materialize/cli/scratch/claude.py:127:34-35: The type of this argument is unknown [unknown-argument-type]
+ ERROR misc/python/materialize/mzcompose/composition.py:225:57-59: Cannot infer type of empty container; it will be treated as containing `Any` [implicit-any-empty-container]
+ ERROR misc/python/materialize/mzcompose/composition.py:236:42-56: The type of this argument is unknown [unknown-argument-type]
+ ERROR misc/python/materialize/mzcompose/composition.py:239:71-73: Cannot infer type of empty container; it will be treated as containing `Any` [implicit-any-empty-container]
+ ERROR misc/python/materialize/mzcompose/composition.py:244:74-76: Cannot infer type of empty container; it will be treated as containing `Any` [implicit-any-empty-container]
urllib3 (https://github.com/urllib3/urllib3)
+ ERROR src/urllib3/util/request.py:210:13-32: Result of call expression is of type `int` and is not used; assign to `_` if this is intentional [unused-call-result]
scikit-learn (https://github.com/scikit-learn/scikit-learn)
+ ERROR sklearn/ensemble/tests/test_forest.py:1561:12-20: Object of class `_Sentinel` has no attribute `count` [missing-attribute]
+ ERROR sklearn/ensemble/tests/test_forest.py:1567:12-20: Object of class `_Sentinel` has no attribute `count` [missing-attribute]
+ ERROR sklearn/metrics/_plot/tests/test_roc_curve_display.py:354:44-45: The type of this argument is unknown [unknown-argument-type]
+ ERROR sklearn/neighbors/tests/test_lof.py:180:9-36: Result of call expression is of type `((*args: Unknown, **kwargs: Unknown) -> Unknown) | MethodType` and is not used; assign to `_` if this is intentional [unused-call-result]
- ERROR sklearn/tests/test_build.py:51:20-48: Implicit conversion of `str | Any` to `bool` is not allowed [implicit-bool]
+ ERROR sklearn/tests/test_build.py:51:20-48: Implicit conversion of `str | None` to `bool` is not allowed [implicit-bool]
+ ERROR sklearn/tests/test_multioutput.py:867:9-36: Result of call expression is of type `((*args: Unknown, **kwargs: Unknown) -> Unknown) | MethodType` and is not used; assign to `_` if this is intentional [unused-call-result]
+ ERROR sklearn/tests/test_pipeline.py:551:9-37: Result of call expression is of type `((*args: Unknown, **kwargs: Unknown) -> Unknown) | MethodType` and is not used; assign to `_` if this is intentional [unused-call-result]
+ ERROR sklearn/tests/test_pipeline.py:923:9-37: Result of call expression is of type `((*args: Unknown, **kwargs: Unknown) -> Unknown) | MethodType` and is not used; assign to `_` if this is intentional [unused-call-result]
freqtrade (https://github.com/freqtrade/freqtrade)
- ERROR freqtrade/optimize/analysis/recursive_helpers.py:20:21-69: Implicit conversion of `int | Any` to `bool` is not allowed [implicit-bool]
+ ERROR freqtrade/optimize/analysis/recursive_helpers.py:20:21-69: Implicit conversion of `int | None` to `bool` is not allowed [implicit-bool]
setuptools (https://github.com/pypa/setuptools)
- ERROR setuptools/_vendor/importlib_metadata/compat/py39.py:28:13-40: Implicit conversion of `Any | None` to `bool` is not allowed [implicit-bool]
+ ERROR setuptools/_vendor/importlib_metadata/compat/py39.py:28:13-40: Implicit conversion of `str | None` to `bool` is not allowed [implicit-bool]
- ERROR setuptools/_vendor/importlib_metadata/compat/py39.py:28:13-74: The type of this argument is unknown [unknown-argument-type]
- ERROR setuptools/_vendor/wheel/_bdist_wheel.py:455:9-461:10: Result of call expression is of type `Unknown | None` and is not used; assign to `_` if this is intentional [unused-call-result]
- ERROR setuptools/command/bdist_egg.py:252:9-256:11: Result of call expression is of type `Unknown | None` and is not used; assign to `_` if this is intentional [unused-call-result]
+ ERROR setuptools/command/bdist_egg.py:252:61-256:10: Argument `tuple[Literal['bdist_egg'], str, Unknown | None]` is not assignable to parameter `object` with type `tuple[str, str, str]` in function `list.append` [bad-argument-type]
- ERROR setuptools/command/bdist_wheel.py:459:9-463:11: Result of call expression is of type `Unknown | None` and is not used; assign to `_` if this is intentional [unused-call-result]
- ERROR setuptools/command/sdist.py:79:17-40: Result of call expression is of type `Unknown | None` and is not used; assign to `_` if this is intentional [unused-call-result]
- ERROR setuptools/config/_apply_pyprojecttoml.py:205:12-51: Implicit conversion of `Any | None` to `bool` is not allowed [implicit-bool]
+ ERROR setuptools/config/_apply_pyprojecttoml.py:205:12-51: Implicit conversion of `str | None` to `bool` is not allowed [implicit-bool]
- ERROR setuptools/config/_apply_pyprojecttoml.py:255:8-45: Implicit conversion of `list[Any] | Any` to `bool` is not allowed [implicit-bool]
+ ERROR setuptools/config/_apply_pyprojecttoml.py:255:8-45: Implicit conversion of `List | list[str] | list[@_]` to `bool` is not allowed [implicit-bool]
- ERROR setuptools/config/_apply_pyprojecttoml.py:262:8-45: Implicit conversion of `Any | None` to `bool` is not allowed [implicit-bool]
+ ERROR setuptools/config/_apply_pyprojecttoml.py:262:8-45: Implicit conversion of `Dict | dict[Unknown, list[str]] | None` to `bool` is not allowed [implicit-bool]
scikit-build-core (https://github.com/scikit-build/scikit-build-core)
- ERROR src/scikit_build_core/setuptools/build_cmake.py:182:19-51: Implicit conversion of `dict[Any, Any] | Any` to `bool` is not allowed [implicit-bool]
+ ERROR src/scikit_build_core/setuptools/build_cmake.py:182:19-51: Implicit conversion of `Mapping[str, str] | dict[@_, @_] | None` to `bool` is not allowed [implicit-bool]
- ERROR src/scikit_build_core/setuptools/build_cmake.py:185:21-41: The type of this argument is unknown [unknown-argument-type]
- ERROR src/scikit_build_core/setuptools/build_cmake.py:187:21-36: The type of this argument is unknown [unknown-argument-type]
- ERROR src/scikit_build_core/setuptools/build_cmake.py:192:21-52: Implicit conversion of `Any | None` to `bool` is not allowed [implicit-bool]
+ ERROR src/scikit_build_core/setuptools/build_cmake.py:192:21-52: Implicit conversion of `list[str] | None` to `bool` is not allowed [implicit-bool]
- ERROR src/scikit_build_core/setuptools/build_cmake.py:193:19-51: Implicit conversion of `dict[Any, Any] | Any` to `bool` is not allowed [implicit-bool]
+ ERROR src/scikit_build_core/setuptools/build_cmake.py:193:19-51: Implicit conversion of `Mapping[str, str] | dict[@_, @_] | None` to `bool` is not allowed [implicit-bool]
- ERROR src/scikit_build_core/setuptools/build_cmake.py:195:12-20: Implicit conversion of `list[Any]` to `bool` is not allowed [implicit-bool]
+ ERROR src/scikit_build_core/setuptools/build_cmake.py:195:12-20: Implicit conversion of `list[str]` to `bool` is not allowed [implicit-bool]
- ERROR src/scikit_build_core/setuptools/build_cmake.py:196:21-44: The type of this argument is unknown [unknown-argument-type]
- ERROR src/scikit_build_core/setuptools/build_cmake.py:201:25-43: The type of `package_parts` is unknown; it is inferred as an implicit `Any` [unknown-variable-type]
- ERROR src/scikit_build_core/setuptools/build_cmake.py:202:64-77: The type of this argument is unknown [unknown-argument-type]
- ERROR src/scikit_build_core/setuptools/build_cmake.py:203:62-75: The type of this argument is unknown [unknown-argument-type]
- ERROR src/scikit_build_core/setuptools/build_cmake.py:341:14-33: The type of this argument is unknown [unknown-argument-type]
- ERROR src/scikit_build_core/setuptools/build_cmake.py:341:50-81: Implicit conversion of `Any | None` to `bool` is not allowed [implicit-bool]
+ ERROR src/scikit_build_core/setuptools/build_cmake.py:341:50-81: Implicit conversion of `list[str] | None` to `bool` is not allowed [implicit-bool]
- ERROR src/scikit_build_core/setuptools/build_cmake.py:346:21-52: Implicit conversion of `Any | None` to `bool` is not allowed [implicit-bool]
+ ERROR src/scikit_build_core/setuptools/build_cmake.py:346:21-52: Implicit conversion of `list[str] | None` to `bool` is not allowed [implicit-bool]
- ERROR src/scikit_build_core/setuptools/build_cmake.py:347:12-20: Implicit conversion of `list[Any]` to `bool` is not allowed [implicit-bool]
+ ERROR src/scikit_build_core/setuptools/build_cmake.py:347:12-20: Implicit conversion of `list[str]` to `bool` is not allowed [implicit-bool]
- ERROR src/scikit_build_core/setuptools/build_cmake.py:353:25-43: The type of `package_parts` is unknown; it is inferred as an implicit `Any` [unknown-variable-type]
- ERROR src/scikit_build_core/setuptools/build_cmake.py:354:64-77: The type of this argument is unknown [unknown-argument-type]
- ERROR src/scikit_build_core/setuptools/build_cmake.py:355:61-74: The type of this argument is unknown [unknown-argument-type]
- ERROR src/scikit_build_core/setuptools/build_cmake.py:369:21-52: Implicit conversion of `Any | None` to `bool` is not allowed [implicit-bool]
+ ERROR src/scikit_build_core/setuptools/build_cmake.py:369:21-52: Implicit conversion of `list[str] | None` to `bool` is not allowed [implicit-bool]
- ERROR src/scikit_build_core/setuptools/build_cmake.py:381:21-40: The type of this argument is unknown [unknown-argument-type]
- ERROR src/scikit_build_core/setuptools/build_cmake.py:409:15-58: Implicit conversion of `Any | None` to `bool` is not allowed [implicit-bool]
+ ERROR src/scikit_build_core/setuptools/build_cmake.py:409:15-58: Implicit conversion of `dict[str, list[str]] | None` to `bool` is not allowed [implicit-bool]
- ERROR src/scikit_build_core/setuptools/build_cmake.py:410:12-19: Implicit conversion of `dict[Any, Any] | Any` to `bool` is not allowed [implicit-bool]
+ ERROR src/scikit_build_core/setuptools/build_cmake.py:410:12-19: Implicit conversion of `dict[str, list[str]]` to `bool` is not allowed [implicit-bool]
- ERROR src/scikit_build_core/setuptools/build_cmake.py:420:46-53: The type of this argument is unknown [unknown-argument-type]
- ERROR src/scikit_build_core/setuptools/build_cmake.py:491:27-74: Implicit conversion of `Any | None` to `bool` is not allowed [implicit-bool]
+ ERROR src/scikit_build_core/setuptools/build_cmake.py:491:27-74: Implicit conversion of `dict[str, Command] | None` to `bool` is not allowed [implicit-bool]
- ERROR src/scikit_build_core/setuptools/build_cmake.py:532:27-72: Implicit conversion of `dict[Any, Any] | Any` to `bool` is not allowed [implicit-bool]
+ ERROR src/scikit_build_core/setuptools/build_cmake.py:532:27-72: Implicit conversion of `Mapping[str, str] | dict[@_, @_] | None` to `bool` is not allowed [implicit-bool]
- ERROR src/scikit_build_core/setuptools/build_cmake.py:533:32-56: The type of this argument is unknown [unknown-argument-type]
- ERROR src/scikit_build_core/setuptools/build_cmake.py:555:49-80: Implicit conversion of `list[Any] | Any` to `bool` is not allowed [implicit-bool]
+ ERROR src/scikit_build_core/setuptools/build_cmake.py:555:49-80: Implicit conversion of `list[tuple[str, list[str]]] | list[@_] | None` to `bool` is not allowed [implicit-bool]
- ERROR src/scikit_build_core/setuptools/build_cmake.py:906:28-60: Implicit conversion of `list[Any] | Any` to `bool` is not allowed [implicit-bool]
+ ERROR src/scikit_build_core/setuptools/build_cmake.py:906:28-60: Implicit conversion of `list[Extension] | list[@_] | None` to `bool` is not allowed [implicit-bool]
apprise (https://github.com/caronc/apprise)
- ERROR apprise/plugins/xmpp/adapter.py:539:12-39: Implicit conversion of `Literal[False] | object` to `bool` is not allowed [implicit-bool]
psycopg (https://github.com/psycopg/psycopg)
- ERROR psycopg/psycopg/_copy_base.py:96:27-55: Implicit conversion of `Any | None` to `bool` is not allowed [implicit-bool]
+ ERROR psycopg/psycopg/_copy_base.py:96:27-55: Implicit conversion of `Transformer | None` to `bool` is not allowed [implicit-bool]
operator (https://github.com/canonical/operator)
+ ERROR ops/framework.py:298:37-52: Argument `type[EventBase]` is not assignable to parameter `cls` with type `type[Serializable]` in function `Framework.register_type` [bad-argument-type]
manticore (https://github.com/trailofbits/manticore)
+ ERROR manticore/core/worker.py:371:25-69: Cannot index into `dict[StateLists, Unknown]` [bad-index]
beartype (https://github.com/beartype/beartype)
- ERROR beartype/_util/module/utilmodget.py:365:9-24: Implicit conversion of `Any | None` to `bool` is not allowed [implicit-bool]
+ ERROR beartype/_util/module/utilmodget.py:365:9-24: Implicit conversion of `str | None` to `bool` is not allowed [implicit-bool]
- ERROR beartype/_util/module/utilmodget.py:365:9-367:37: Implicit conversion of `bool | Any | None` to `bool` is not allowed [implicit-bool]
+ ERROR beartype/_util/module/utilmodget.py:365:9-367:37: Implicit conversion of `Literal[''] | bool | None` to `bool` is not allowed [implicit-bool]
streamlit (https://github.com/streamlit/streamlit)
- ERROR lib/streamlit/components/v2/manifest_scanner.py:301:12-17: Implicit conversion of `Any | None` to `bool` is not allowed [implicit-bool]
+ ERROR lib/streamlit/components/v2/manifest_scanner.py:301:12-17: Implicit conversion of `list[PackagePath] | None` to `bool` is not allowed [implicit-bool]
- ERROR lib/streamlit/components/v2/manifest_scanner.py:455:8-34: Implicit conversion of `Literal[False] | Any | None` to `bool` is not allowed [implicit-bool]
+ ERROR lib/streamlit/components/v2/manifest_scanner.py:455:8-34: Implicit conversion of `Literal[False] | list[PackagePath] | None` to `bool` is not allowed [implicit-bool]
- ERROR lib/streamlit/elements/help.py:497:12-21: Implicit conversion of `Any | None` to `bool` is not allowed [implicit-bool]
+ ERROR lib/streamlit/elements/help.py:497:12-21: Implicit conversion of `type[object] | None` to `bool` is not allowed [implicit-bool]
hydra-zen (https://github.com/mit-ll-responsible-ai/hydra-zen)
+ ERROR src/hydra_zen/wrapper/_implementations.py:410:45-47: Cannot infer type of empty container; it will be treated as containing `Any` [implicit-any-empty-container]
+ ERROR src/hydra_zen/wrapper/_implementations.py:441:54-55: The type of this argument is unknown [unknown-argument-type]
pandera (https://github.com/pandera-dev/pandera)
- ERROR pandera/backends/narwhals/container.py:155:12-65: Implicit conversion of `Literal[False] | Any | None` to `bool` is not allowed [implicit-bool]
+ ERROR pandera/backends/narwhals/container.py:155:12-65: Implicit conversion of `Literal[False] | Unknown | None` to `bool` is not allowed [implicit-bool]
strawberry (https://github.com/strawberry-graphql/strawberry)
+ ERROR strawberry/types/nodes.py:108:23-72: Argument `list[FieldNode] | tuple[SelectionNode, ...]` is not assignable to parameter `field_nodes` with type `Collection[FieldNode]` in function `convert_selections` [bad-argument-type]
+ ERROR strawberry/types/nodes.py:130:23-68: Argument `list[FieldNode] | tuple[SelectionNode, ...]` is not assignable to parameter `field_nodes` with type `Collection[FieldNode]` in function `convert_selections` [bad-argument-type]
zulip (https://github.com/zulip/zulip)
- ERROR zerver/middleware.py:494:66-73: Argument `Any | None` is not assignable to parameter `urlconf` with type `str` in function `django.conf.urls.i18n.is_language_prefix_patterns_used` [bad-argument-type]
+ ERROR zerver/middleware.py:494:66-73: Argument `str | Any | None` is not assignable to parameter `urlconf` with type `str` in function `django.conf.urls.i18n.is_language_prefix_patterns_used` [bad-argument-type]
dd-trace-py (https://github.com/DataDog/dd-trace-py)
- ERROR ddtrace/appsec/_iast/_ast/visitor.py:551:70-80: Implicit conversion of `Any | None` to `bool` is not allowed [implicit-bool]
+ ERROR ddtrace/appsec/_iast/_ast/visitor.py:551:70-80: Implicit conversion of `expr | None` to `bool` is not allowed [implicit-bool]
- ERROR ddtrace/appsec/_iast/_ast/visitor.py:553:68-78: Implicit conversion of `Any | None` to `bool` is not allowed [implicit-bool]
+ ERROR ddtrace/appsec/_iast/_ast/visitor.py:553:68-78: Implicit conversion of `expr | None` to `bool` is not allowed [implicit-bool]
- ERROR ddtrace/appsec/_iast/_ast/visitor.py:558:64-74: Implicit conversion of `Any | None` to `bool` is not allowed [implicit-bool]
+ ERROR ddtrace/appsec/_iast/_ast/visitor.py:558:64-74: Implicit conversion of `expr | None` to `bool` is not allowed [implicit-bool]
- ERROR ddtrace/appsec/_iast/_ast/visitor.py:560:16-65: Implicit conversion of `Any | None` to `bool` is not allowed [implicit-bool]
+ ERROR ddtrace/appsec/_iast/_ast/visitor.py:560:16-65: Implicit conversion of `str | Any | None` to `bool` is not allowed [implicit-bool]
- ERROR ddtrace/appsec/_iast/_ast/visitor.py:573:20-23: Implicit conversion of `Unknown | None` to `bool` is not allowed [implicit-bool]
+ ERROR ddtrace/appsec/_iast/_ast/visitor.py:573:20-23: Implicit conversion of `str | Unknown | None` to `bool` is not allowed [implicit-bool]
- ERROR ddtrace/internal/module.py:311:33-42: The type of this argument is unknown [unknown-argument-type]
- ERROR ddtrace/internal/module.py:435:28-62: The type of `spec` is unknown; it is inferred as an implicit `Any` [unknown-variable-type]
- ERROR ddtrace/testing/internal/test_data.py:282:12-61: Implicit conversion of `Literal[False] | dict[Unknown, Unknown]` to `bool` is not allowed [implicit-bool]
+ ERROR ddtrace/testing/internal/test_data.py:282:12-61: Implicit conversion of `Literal[False] | dict[str, str]` to `bool` is not allowed [implicit-bool]
anyio (https://github.com/agronholm/anyio)
- ERROR src/anyio/abc/_tasks.py:39:55-56: Implicit conversion of `Unknown | None` to `bool` is not allowed [implicit-bool]
+ ERROR src/anyio/abc/_tasks.py:39:55-56: Implicit conversion of `str | Unknown | None` to `bool` is not allowed [implicit-bool]
hydpy (https://github.com/hydpy-dev/hydpy)
- ERROR hydpy/core/autodoctools.py:446:8-18: Implicit conversion of `tuple[()] | Any` to `bool` is not allowed [implicit-bool]
+ ERROR hydpy/core/autodoctools.py:446:8-18: Implicit conversion of `tuple[type[Method], ...]` to `bool` is not allowed [implicit-bool]
- ERROR hydpy/core/autodoctools.py:1283:48-53: The type of this argument is unknown [unknown-argument-type]
- ERROR hydpy/core/autodoctools.py:1311:15-66: The type of `doc` is unknown; it is inferred as an implicit `Any` [unknown-variable-type]
+ ERROR hydpy/core/autodoctools.py:1311:15-27: `+` is not supported between `None` and `Literal['\n\n']` [unsupported-operation]
- ERROR hydpy/core/objecttools.py:1268:9-18: The type of this argument is unknown [unknown-argument-type]
- ERROR hydpy/core/objecttools.py:1270:22-42: The type of this argument is unknown [unknown-argument-type]
- ERROR hydpy/core/objecttools.py:1372:9-18: The type of this argument is unknown [unknown-argument-type]
- ERROR hydpy/core/objecttools.py:1374:22-42: The type of this argument is unknown [unknown-argument-type]
- ERROR hydpy/cythons/modelutils.py:1499:12-29: Implicit conversion of `tuple[()] | Any` to `bool` is not allowed [implicit-bool]
+ ERROR hydpy/cythons/modelutils.py:1499:12-29: Implicit conversion of `tuple[type[Submodel], ...]` to `bool` is not allowed [implicit-bool]
- ERROR hydpy/cythons/modelutils.py:1499:12-50: Implicit conversion of `list[str] | Any` to `bool` is not allowed [implicit-bool]
+ ERROR hydpy/cythons/modelutils.py:1499:12-50: Implicit conversion of `list[str] | tuple[type[Submodel], ...]` to `bool` is not allowed [implicit-bool]
- ERROR hydpy/docs/prepare.py:90:36-42: The type of this argument is unknown [unknown-argument-type]
pandas (https://github.com/pandas-dev/pandas)
+ ERROR pandas/core/nanops.py:1709:28-58: Implicit conversion of `Literal[False] | int` to `bool` is not allowed [implicit-bool]
mypy (https://github.com/python/mypy)
+ ERROR mypy/moduleinspect.py:58:30-64: `MutableSequence[str] | None` is not assignable to `list[str] | None` [bad-assignment]
- ERROR mypy/stubgenc.py:721:16-40: Implicit conversion of `Any | None` to `bool` is not allowed [implicit-bool]
+ ERROR mypy/stubgenc.py:721:16-40: Implicit conversion of `str | Any | None` to `bool` is not allowed [implicit-bool]
werkzeug (https://github.com/pallets/werkzeug)
+ ERROR tests/live_apps/run.py:23:33-35: Cannot infer type of empty container; it will be treated as containing `Any` [implicit-any-empty-container]
core (https://github.com/home-assistant/core)
+ ERROR homeassistant/components/cert_expiry/diagnostics.py:34:50-66: Implicit conversion of `datetime | None` to `bool` is not allowed [implicit-bool]
+ ERROR homeassistant/components/cert_expiry/diagnostics.py:40:16-38: Implicit conversion of `ValidationFailure | None` to `bool` is not allowed [implicit-bool]
- ERROR homeassistant/helpers/intent.py:74:12-49: Implicit conversion of `Any | None` to `bool` is not allowed [implicit-bool]
+ ERROR homeassistant/helpers/intent.py:74:12-49: Implicit conversion of `str | None` to `bool` is not allowed [implicit-bool]
trio (https://github.com/python-trio/trio)
- ERROR src/trio/_tests/test_threads.py:251:12-30: Implicit conversion of `Any | None` to `bool` is not allowed [implicit-bool]
+ ERROR src/trio/_tests/test_threads.py:251:12-30: Implicit conversion of `_NamedFuncPointer | None` to `bool` is not allowed [implicit-bool]
sphinx (https://github.com/sphinx-doc/sphinx)
- ERROR sphinx/ext/autodoc/_dynamic/_importer.py:243:24-32: Implicit conversion of `str | Any` to `bool` is not allowed [implicit-bool]
+ ERROR sphinx/ext/autodoc/_dynamic/_importer.py:243:24-32: Implicit conversion of `str | None` to `bool` is not allowed [implicit-bool]
- ERROR sphinx/ext/autodoc/_dynamic/_importer.py:243:24-62: Implicit conversion of `Literal[''] | bool | Unknown` to `bool` is not allowed [implicit-bool]
+ ERROR sphinx/ext/autodoc/_dynamic/_importer.py:243:24-62: Implicit conversion of `Literal[''] | bool | None` to `bool` is not allowed [implicit-bool]
- ERROR sphinx/ext/autodoc/_dynamic/_type_comments.py:145:12-24: Implicit conversion of `Any | None` to `bool` is not allowed [implicit-bool]
+ ERROR sphinx/ext/autodoc/_dynamic/_type_comments.py:145:12-24: Implicit conversion of `str | None` to `bool` is not allowed [implicit-bool]
+ ERROR sphinx/ext/autodoc/_dynamic/_type_comments.py:147:62-70: Argument `FunctionType` is not assignable to parameter `type_comment` with type `FunctionDef` in function `signature_from_ast` [bad-argument-type]
- ERROR sphinx/pycode/__init__.py:43:12-18: Implicit conversion of `Any | None` to `bool` is not allowed [implicit-bool]
+ ERROR sphinx/pycode/__init__.py:43:12-18: Implicit conversion of `LoaderProtocol | None` to `bool` is not allowed [implicit-bool]
- ERROR sphinx/pycode/__init__.py:43:12-58: Implicit conversion of `Any | None` to `bool` is not allowed [implicit-bool]
+ ERROR sphinx/pycode/__init__.py:43:12-58: Implicit conversion of `LoaderProtocol | Any | None` to `bool` is not allowed [implicit-bool]
- ERROR sphinx/pycode/__init__.py:53:12-81: Implicit conversion of `Literal[False] | Any | None` to `bool` is not allowed [implicit-bool]
+ ERROR sphinx/pycode/__init__.py:53:12-81: Implicit conversion of `Literal[False] | LoaderProtocol | Any | None` to `bool` is not allowed [implicit-bool]
- ERROR sphinx/pycode/__init__.py:53:33-39: Implicit conversion of `Any | None` to `bool` is not allowed [implicit-bool]
+ ERROR sphinx/pycode/__init__.py:53:33-39: Implicit conversion of `LoaderProtocol | None` to `bool` is not allowed [implicit-bool]
- ERROR sphinx/testing/fixtures.py:230:12-24: Implicit conversion of `str | Any` to `bool` is not allowed [implicit-bool]
+ ERROR sphinx/testing/fixtures.py:230:12-24: Implicit conversion of `Literal[''] | Any` to `bool` is not allowed [implicit-bool]
- ERROR sphinx/util/typing.py:343:20-28: Implicit conversion of `tuple[()] | Any` to `bool` is not allowed [implicit-bool]
+ ERROR sphinx/util/typing.py:343:20-28: Implicit conversion of `tuple[Any, ...]` to `bool` is not allowed [implicit-bool]
- ERROR sphinx/util/typing.py:354:42-43: The type of this argument is unknown [unknown-argument-type]
- ERROR sphinx/util/typing.py:355:35-47: The type of this argument is unknown [unknown-argument-type]
rich (https://github.com/Textualize/rich)
- ERROR rich/traceback.py:470:28-65: Implicit conversion of `Any | None` to `bool` is not allowed [implicit-bool]
+ ERROR rich/traceback.py:470:28-65: Implicit conversion of `list[str] | None` to `bool` is not allowed [implicit-bool]
porcupine (https://github.com/Akuli/porcupine)
+ ERROR porcupine/pluginloader.py:139:65-67: Cannot infer type of empty container; it will be treated as containing `Any` [implicit-any-empty-container]
+ ERROR porcupine/pluginloader.py:140:63-65: Cannot infer type of empty container; it will be treated as containing `Any` [implicit-any-empty-container]
spack (https://github.com/spack/spack)
+ ERROR lib/spack/spack/cmd/compiler.py:160:59-61: Cannot infer type of empty container; it will be treated as containing `Any` [implicit-any-empty-container]
- ERROR lib/spack/spack/cmd/compiler.py:176:12-46: Implicit conversion of `list[Any] | Any` to `bool` is not allowed [implicit-bool]
+ ERROR lib/spack/spack/cmd/compiler.py:176:12-46: Implicit conversion of `list[@_] | Unknown` to `bool` is not allowed [implicit-bool]
+ ERROR lib/spack/spack/cmd/info.py:660:8-32: Implicit conversion of `classproperty[str | None] | str | None` to `bool` is not allowed [implicit-bool]
- ERROR lib/spack/spack/compilers/adaptor.py:184:16-81: Returning implicit Any from function declared to return "list[str]" [no-any-return-implicit]
- ERROR lib/spack/spack/database.py:846:18-47: Implicit conversion of `Any | None` to `bool` is not allowed [implicit-bool]
+ ERROR lib/spack/spack/database.py:846:18-47: Implicit conversion of `str | Any | None` to `bool` is not allowed [implicit-bool]
nox (https://github.com/wntrblm/nox)
- ERROR nox/_cli.py:243:9-245:68: Implicit conversion of `Literal[''] | ModuleType | bool | Any | None` to `bool` is not allowed [implicit-bool]
+ ERROR nox/_cli.py:243:9-245:68: Implicit conversion of `Literal[''] | ModuleType | bool | None` to `bool` is not allowed [implicit-bool]
- ERROR nox/_cli.py:244:14-59: Implicit conversion of `str | Any` to `bool` is not allowed [implicit-bool]
+ ERROR nox/_cli.py:244:14-59: Implicit conversion of `str | None` to `bool` is not allowed [implicit-bool]
scrapy (https://github.com/scrapy/scrapy)
- ERROR scrapy/crawler.py:564:42-74: Implicit conversion of `Any | None` to `bool` is not allowed [implicit-bool]
+ ERROR scrapy/crawler.py:564:42-74: Implicit conversion of `Spider | None` to `bool` is not allowed [implicit-bool]
- ERROR scrapy/crawler.py:676:38-70: Implicit conversion of `Any | None` to `bool` is not allowed [implicit-bool]
+ ERROR scrapy/crawler.py:676:38-70: Implicit conversion of `Spider | None` to `bool` is not allowed [implicit-bool]
django-test-migrations (https://github.com/wemake-services/django-test-migrations)
- ERROR django_test_migrations/migrator.py:132:16-30: Implicit conversion of `Any | None` to `bool` is not allowed [implicit-bool]
+ ERROR django_test_migrations/migrator.py:132:16-30: Implicit conversion of `tuple[str, str] | None` to `bool` is not allowed [implicit-bool]
pylint (https://github.com/pycqa/pylint)
+ ERROR pylint/checkers/utils.py:943:12-22: Returned type `list[NodeNG | Unknown]` is not assignable to declared return type `list[Attribute | Name | None]` [bad-return]
graphql-core (https://github.com/graphql-python/graphql-core)
- ERROR src/graphql/type/schema.py:217:20-29: Implicit conversion of `Any | None` to `bool` is not allowed [implicit-bool]
+ ERROR src/graphql/type/schema.py:217:20-29: Implicit conversion of `str | None` to `bool` is not allowed [implicit-bool]
- ERROR src/graphql/utilities/ast_to_dict.py:63:16-19: Implicit conversion of `Any | None` to `bool` is not allowed [implicit-bool]
+ ERROR src/graphql/utilities/ast_to_dict.py:63:16-19: Implicit conversion of `Location | None` to `bool` is not allowed [implicit-bool]
django-modern-rest (https://github.com/wemake-services/django-modern-rest)
+ ERROR dmr/internal/django.py:153:27-47: Expected a callable, got `MultiPartParser` [not-callable]
- ERROR dmr/security/django_session/auth.py:127:16-20: Implicit conversion of `Any | None` to `bool` is not allowed [implicit-bool]
+ ERROR dmr/security/django_session/auth.py:127:16-20: Implicit conversion of `AbstractBaseUser | AnonymousUser | None` to `bool` is not allowed [implicit-bool]
- ERROR dmr/security/django_session/auth.py:168:16-29: The type of `user` is unknown; it is inferred as an implicit `Any` [unknown-variable-type]
+ ERROR dmr/throttling/cache_keys.py:139:38-46: Unnecessary `str()` call; argument is already of type `str` [unnecessary-type-conversion]
+ ERROR dmr/throttling/cache_keys.py:145:34-43: Unnecessary `str()` call; argument is already of type `str` [unnecessary-type-conversion] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #4477
Literal-name getattr now reuses normal attribute inference for class instances instead of always falling back to typeshed’s Any.
It still runs the ordinary builtin call validation first, then only overrides the return type when the call is getattr(obj, "literal", default?), the receiver is a ClassType, and the attribute lookup succeeds.
Test Plan
add test