[ty] remove static_expression_truthiness and improve reachability analysis by mtshiba · Pull Request #22971 · astral-sh/ruff (original) (raw)
mypy_primer results
Changes were detected when running on open source projects
pip (https://github.com/pypa/pip)
- src/pip/_internal/resolution/legacy/resolver.py:455:69: error[invalid-argument-type] Argument to bound method
prepare_installed_requirementis incorrect: Expectedstr, foundstr | None - src/pip/_internal/resolution/legacy/resolver.py:477:20: warning[possibly-missing-attribute] Attribute
schememay be missing on object of typeUnknown | Link | None - Found 625 diagnostics
- Found 623 diagnostics
spack (https://github.com/spack/spack)
- lib/spack/spack/test/builder.py:137:12: error[unresolved-attribute] Object of type
Builderhas no attributepkg_with_dispatcher - Found 4338 diagnostics
- Found 4337 diagnostics
kopf (https://github.com/nolar/kopf)
- kopf/_kits/hierarchies.py:51:21: error[invalid-assignment] Object of type
list[Unknown]is not assignable to attributeowner_referenceson typeV1ObjectMetaProtocol | None - kopf/_kits/hierarchies.py:89:21: error[invalid-assignment] Object of type
list[Unknown]is not assignable to attributeowner_referenceson typeV1ObjectMetaProtocol | None - kopf/_kits/hierarchies.py:130:21: error[invalid-assignment] Object of type
dict[Unknown, Unknown]is not assignable to attributelabelson typeV1ObjectMetaProtocol | None - kopf/_kits/hierarchies.py:191:56: warning[possibly-missing-attribute] Attribute
generate_namemay be missing on object of typeV1ObjectMetaProtocol | None - Found 296 diagnostics
- Found 292 diagnostics
ignite (https://github.com/pytorch/ignite)
- tests/ignite/metrics/test_precision.py:377:17: warning[possibly-missing-attribute] Attribute
cpumay be missing on object of typeUnknown | int | float | ... omitted 3 union elements - tests/ignite/metrics/test_precision.py:461:17: warning[possibly-missing-attribute] Attribute
devicemay be missing on object of typeint | Unknown - tests/ignite/metrics/test_precision.py:462:24: warning[possibly-missing-attribute] Attribute
devicemay be missing on object of typeint | Unknown - tests/ignite/metrics/test_precision.py:462:48: warning[possibly-missing-attribute] Attribute
devicemay be missing on object of typeint | Unknown - tests/ignite/metrics/test_precision.py:467:21: warning[possibly-missing-attribute] Attribute
devicemay be missing on object of typeint | Unknown - tests/ignite/metrics/test_precision.py:468:28: warning[possibly-missing-attribute] Attribute
devicemay be missing on object of typeint | Unknown - tests/ignite/metrics/test_precision.py:468:54: warning[possibly-missing-attribute] Attribute
devicemay be missing on object of typeint | Unknown - tests/ignite/metrics/test_precision.py:471:24: warning[possibly-missing-attribute] Attribute
devicemay be missing on object of typeint | Unknown - tests/ignite/metrics/test_precision.py:471:68: warning[possibly-missing-attribute] Attribute
devicemay be missing on object of typeint | Unknown - tests/ignite/metrics/test_precision.py:471:89: warning[possibly-missing-attribute] Attribute
devicemay be missing on object of typeint | Unknown - tests/ignite/metrics/test_precision.py:494:17: warning[possibly-missing-attribute] Attribute
devicemay be missing on object of typeint | Unknown - tests/ignite/metrics/test_precision.py:495:24: warning[possibly-missing-attribute] Attribute
devicemay be missing on object of typeint | Unknown - tests/ignite/metrics/test_precision.py:495:48: warning[possibly-missing-attribute] Attribute
devicemay be missing on object of typeint | Unknown - tests/ignite/metrics/test_precision.py:500:21: warning[possibly-missing-attribute] Attribute
devicemay be missing on object of typeint | Unknown - tests/ignite/metrics/test_precision.py:501:28: warning[possibly-missing-attribute] Attribute
devicemay be missing on object of typeint | Unknown - tests/ignite/metrics/test_precision.py:501:54: warning[possibly-missing-attribute] Attribute
devicemay be missing on object of typeint | Unknown - tests/ignite/metrics/test_precision.py:504:24: warning[possibly-missing-attribute] Attribute
devicemay be missing on object of typeint | Unknown - tests/ignite/metrics/test_precision.py:504:68: warning[possibly-missing-attribute] Attribute
devicemay be missing on object of typeint | Unknown - tests/ignite/metrics/test_precision.py:504:89: warning[possibly-missing-attribute] Attribute
devicemay be missing on object of typeint | Unknown - tests/ignite/metrics/test_recall.py:380:17: warning[possibly-missing-attribute] Attribute
cpumay be missing on object of typeUnknown | int | float | ... omitted 3 union elements - tests/ignite/metrics/test_recall.py:463:17: warning[possibly-missing-attribute] Attribute
devicemay be missing on object of typeint | Unknown - tests/ignite/metrics/test_recall.py:464:24: warning[possibly-missing-attribute] Attribute
devicemay be missing on object of typeint | Unknown - tests/ignite/metrics/test_recall.py:464:48: warning[possibly-missing-attribute] Attribute
devicemay be missing on object of typeint | Unknown - tests/ignite/metrics/test_recall.py:469:21: warning[possibly-missing-attribute] Attribute
devicemay be missing on object of typeint | Unknown - tests/ignite/metrics/test_recall.py:470:28: warning[possibly-missing-attribute] Attribute
devicemay be missing on object of typeint | Unknown - tests/ignite/metrics/test_recall.py:470:54: warning[possibly-missing-attribute] Attribute
devicemay be missing on object of typeint | Unknown - tests/ignite/metrics/test_recall.py:473:24: warning[possibly-missing-attribute] Attribute
devicemay be missing on object of typeint | Unknown - tests/ignite/metrics/test_recall.py:473:68: warning[possibly-missing-attribute] Attribute
devicemay be missing on object of typeint | Unknown - tests/ignite/metrics/test_recall.py:473:89: warning[possibly-missing-attribute] Attribute
devicemay be missing on object of typeint | Unknown - tests/ignite/metrics/test_recall.py:497:17: warning[possibly-missing-attribute] Attribute
devicemay be missing on object of typeint | Unknown - tests/ignite/metrics/test_recall.py:498:24: warning[possibly-missing-attribute] Attribute
devicemay be missing on object of typeint | Unknown - tests/ignite/metrics/test_recall.py:498:48: warning[possibly-missing-attribute] Attribute
devicemay be missing on object of typeint | Unknown - tests/ignite/metrics/test_recall.py:503:21: warning[possibly-missing-attribute] Attribute
devicemay be missing on object of typeint | Unknown - tests/ignite/metrics/test_recall.py:504:28: warning[possibly-missing-attribute] Attribute
devicemay be missing on object of typeint | Unknown - tests/ignite/metrics/test_recall.py:504:54: warning[possibly-missing-attribute] Attribute
devicemay be missing on object of typeint | Unknown - tests/ignite/metrics/test_recall.py:507:24: warning[possibly-missing-attribute] Attribute
devicemay be missing on object of typeint | Unknown - tests/ignite/metrics/test_recall.py:507:68: warning[possibly-missing-attribute] Attribute
devicemay be missing on object of typeint | Unknown - tests/ignite/metrics/test_recall.py:507:89: warning[possibly-missing-attribute] Attribute
devicemay be missing on object of typeint | Unknown - Found 2072 diagnostics
- Found 2034 diagnostics
dulwich (https://github.com/dulwich/dulwich)
- dulwich/porcelain/init.py:2138:18: warning[possibly-unresolved-reference] Name
path1used when possibly not defined - dulwich/porcelain/init.py:2143:18: warning[possibly-unresolved-reference] Name
path2used when possibly not defined - Found 227 diagnostics
- Found 225 diagnostics
pyodide (https://github.com/pyodide/pyodide)
- src/tests/test_webloop.py:466:16: error[unresolved-attribute] Object of type
AbstractEventLoophas no attribute_in_progress - Found 939 diagnostics
- Found 938 diagnostics
trio (https://github.com/python-trio/trio)
- src/trio/_tests/test_ssl.py:925:15: error[call-non-callable] Object of type
Noneis not callable - src/trio/testing/_raises_group.py:714:17: error[unsupported-operator] Operator
+=is not supported between objects of typeNoneandstr - src/trio/testing/_raises_group.py:714:88: warning[possibly-unresolved-reference] Name
expectedused when possibly not defined - src/trio/testing/_raises_group.py:714:136: warning[possibly-unresolved-reference] Name
expectedused when possibly not defined - Found 481 diagnostics
- Found 477 diagnostics
prefect (https://github.com/PrefectHQ/prefect)
- src/integrations/prefect-dbt/prefect_dbt/core/settings.py:94:28: error[invalid-assignment] Object of type
dict[Any, Any] | int | dict[str, Any] | ... omitted 4 union elementsis not assignable todict[str, Any]
- src/integrations/prefect-dbt/prefect_dbt/core/settings.py:94:28: error[invalid-assignment] Object of type
dict[str, Any] | int | dict[Any, Any] | ... omitted 4 union elementsis not assignable todict[str, Any]
- src/prefect/cli/deploy/_core.py:86:21: error[invalid-assignment] Object of type
dict[Any, Any] | int | dict[str, Any] | ... omitted 4 union elementsis not assignable todict[str, Any]
- src/prefect/cli/deploy/_core.py:86:21: error[invalid-assignment] Object of type
dict[str, Any] | int | dict[Any, Any] | ... omitted 4 union elementsis not assignable todict[str, Any]
- src/prefect/deployments/steps/core.py:137:38: error[invalid-argument-type] Argument is incorrect: Argument type
dict[Any, Any] | int | dict[str, Any] | ... omitted 4 union elementsdoes not satisfy constraints (str,int,int | float,bool,dict[Any, Any],list[Any],None) of type variableT
- src/prefect/deployments/steps/core.py:137:38: error[invalid-argument-type] Argument is incorrect: Argument type
dict[str, Any] | int | dict[Any, Any] | ... omitted 4 union elementsdoes not satisfy constraints (str,int,int | float,bool,dict[Any, Any],list[Any],None) of type variableT
- src/prefect/utilities/templating.py:320:13: error[invalid-assignment] Invalid subscript assignment with key of type
objectand value of typeUnknown | int | dict[str, Any] | ... omitted 4 union elementson object of typedict[str, Any]
- src/prefect/utilities/templating.py:320:13: error[invalid-assignment] Invalid subscript assignment with key of type
objectand value of typedict[str, Any] | int | Unknown | ... omitted 4 union elementson object of typedict[str, Any]
- src/prefect/utilities/templating.py:323:16: error[invalid-return-type] Return type does not match returned value: expected
T@resolve_block_document_references | dict[str, Any], foundlist[Unknown | int | dict[str, Any] | ... omitted 4 union elements]
- src/prefect/utilities/templating.py:323:16: error[invalid-return-type] Return type does not match returned value: expected
T@resolve_block_document_references | dict[str, Any], foundlist[Unknown | dict[str, Any] | int | ... omitted 4 union elements]
- src/prefect/workers/base.py:232:13: error[invalid-argument-type] Argument is incorrect: Argument type
str | int | dict[str, Any] | ... omitted 3 union elementsdoes not satisfy constraints (str,int,int | float,bool,dict[Any, Any],list[Any],None) of type variableT
- src/prefect/workers/base.py:232:13: error[invalid-argument-type] Argument is incorrect: Argument type
dict[str, Any] | int | str | ... omitted 3 union elementsdoes not satisfy constraints (str,int,int | float,bool,dict[Any, Any],list[Any],None) of type variableT
dd-trace-py (https://github.com/DataDog/dd-trace-py)
- tests/appsec/iast/taint_sinks/test_vulnerability_detection.py:69:12: warning[possibly-missing-attribute] Attribute
vulnerability_budgetmay be missing on object of typeIASTEnvironment | None - tests/appsec/iast/taint_sinks/test_vulnerability_detection.py:70:12: warning[possibly-missing-attribute] Attribute
vulnerabilities_request_limitmay be missing on object of typeIASTEnvironment | None - tests/appsec/iast/taint_sinks/test_vulnerability_detection.py:84:12: warning[possibly-missing-attribute] Attribute
is_first_vulnerabilitymay be missing on object of typeIASTEnvironment | None - tests/appsec/iast/taint_sinks/test_vulnerability_detection.py:85:12: warning[possibly-missing-attribute] Attribute
vulnerability_budgetmay be missing on object of typeIASTEnvironment | None - tests/appsec/iast/taint_sinks/test_vulnerability_detection.py:86:12: warning[possibly-missing-attribute] Attribute
vulnerabilities_request_limitmay be missing on object of typeIASTEnvironment | None - tests/appsec/iast/taint_sinks/test_vulnerability_detection.py:87:12: warning[possibly-missing-attribute] Attribute
vulnerabilities_request_limitmay be missing on object of typeIASTEnvironment | None - tests/appsec/iast/taint_sinks/test_vulnerability_detection.py:88:12: warning[possibly-missing-attribute] Attribute
vulnerabilities_request_limitmay be missing on object of typeIASTEnvironment | None - Found 8560 diagnostics
- Found 8553 diagnostics
static-frame (https://github.com/static-frame/static-frame)
- static_frame/core/util.py:1402:32: warning[possibly-unresolved-reference] Name
rowsused when possibly not defined - Found 1827 diagnostics
- Found 1826 diagnostics
sympy (https://github.com/sympy/sympy)
- sympy/polys/matrices/tests/test_xxm.py:88:20: warning[possibly-missing-attribute] Attribute
to_ddmmay be missing on object of typeSDM | DDM | DFM | DFM_dummy - sympy/polys/matrices/tests/test_xxm.py:90:20: warning[possibly-missing-attribute] Attribute
to_ddmmay be missing on object of typeSDM | DDM | DFM | DFM_dummy - sympy/polys/matrices/tests/test_xxm.py:94:20: warning[possibly-missing-attribute] Attribute
to_ddmmay be missing on object of typeSDM | DDM | DFM | DFM_dummy - sympy/polys/numberfields/galoisgroups.py:126:21: warning[possibly-unresolved-reference] Name
current_degreeused when possibly not defined - Found 15656 diagnostics
- Found 15652 diagnostics
core (https://github.com/home-assistant/core)
- homeassistant/components/universal/media_player.py:677:24: warning[possibly-unresolved-reference] Name
child_state_orderused when possibly not defined
- homeassistant/util/variance.py:47:12: error[invalid-return-type] Return type does not match returned value: expected
(**_P@ignore_variance) -> _R@ignore_variance, found_Wrapped[_P@ignore_variance, int | _R@ignore_variance | float | datetime, _P@ignore_variance, _R@ignore_variance | int | float | datetime]
scipy (https://github.com/scipy/scipy)
- scipy/optimize/tests/test_bracket.py:318:9: error[unresolved-attribute] Unresolved attribute
counton typedef f(x) -> Unknown - scipy/stats/tests/test_resampling.py:1223:16: error[unresolved-attribute] Function
testhas no attributebatch_size - scipy/stats/tests/test_resampling.py:1226:9: error[unresolved-attribute] Unresolved attribute
counteron typedef test(x, axis) -> Unknown - scipy/stats/tests/test_resampling.py:1228:16: error[unresolved-attribute] Function
testhas no attributecounter - scipy/stats/tests/test_resampling.py:1229:16: error[unresolved-attribute] Function
testhas no attributebatch_size - scipy/stats/tests/test_resampling.py:1232:9: error[unresolved-attribute] Unresolved attribute
counteron typedef test(x, axis) -> Unknown - scipy/stats/tests/test_resampling.py🔢16: error[unresolved-attribute] Function
testhas no attributecounter - scipy/stats/tests/test_resampling.py:1235:16: error[unresolved-attribute] Function
testhas no attributebatch_size - scipy/stats/tests/test_resampling.py:1415:16: error[unresolved-attribute] Function
statistichas no attributebatch_size - scipy/stats/tests/test_resampling.py:1417:9: error[unresolved-attribute] Unresolved attribute
counteron typedef statistic(x, y, axis) -> Unknown - scipy/stats/tests/test_resampling.py:1420:16: error[unresolved-attribute] Function
statistichas no attributecounter - scipy/stats/tests/test_resampling.py:1421:16: error[unresolved-attribute] Function
statistichas no attributebatch_size - scipy/stats/tests/test_resampling.py:1423:9: error[unresolved-attribute] Unresolved attribute
counteron typedef statistic(x, y, axis) -> Unknown - scipy/stats/tests/test_resampling.py:1426:16: error[unresolved-attribute] Function
statistichas no attributecounter - scipy/stats/tests/test_resampling.py:1427:16: error[unresolved-attribute] Function
statistichas no attributebatch_size - Found 8057 diagnostics
- Found 8042 diagnostics
Memory usage changes were detected when running on open source projects
sphinx (https://github.com/sphinx-doc/sphinx)
- TOTAL MEMORY USAGE: ~287MB
- TOTAL MEMORY USAGE: ~301MB