Skip to content

Fix false positive redundant-expr for 'if x and y' when body always raises#21636

Closed
piyush-003 wants to merge 3 commits into
python:masterfrom
piyush-003:fix-redundant-expr-and
Closed

Fix false positive redundant-expr for 'if x and y' when body always raises#21636
piyush-003 wants to merge 3 commits into
python:masterfrom
piyush-003:fix-redundant-expr-and

Conversation

@piyush-003

Copy link
Copy Markdown

Fixes #21533

Problem

mypy reports a false positive redundant-expr warning for this code:

if not _is_seq_of(a, Cat) and not _is_seq_of(a, int):
    raise TypeError("unexpected")

Error: Left operand of "and" is always true [redundant-expr]

But this equivalent code has no error:

if not _is_seq_of(a, Cat):
    if not _is_seq_of(a, int):
        raise TypeError("unexpected")

Both should behave the same way.

What I found

The issue is in how mypy processes and expressions. When evaluating
the right side, it uses the already-narrowed types from the left side
and then incorrectly concludes the left side was always true.

The root cause is find_isinstance_check returning Never instead of
the correct type for the false case of TypeIs with constrained TypeVars.

Fix

In visit_if_stmt, before evaluating the condition, if the condition is
an and expression and the body always raises, set right_always=True
to suppress the false warning.

I looked into fixing the root cause in find_isinstance_check but that
touches a lot of logic and could break other things, so I went with this
safer approach for now.

Note on AI assistance

I used an AI assistant to help me understand the codebase and trace the bug.
The investigation, understanding of the root cause, and the fix itself were
worked through step by step. As per the contributing guidelines, I am
disclosing this.

@piyush-003 piyush-003 force-pushed the fix-redundant-expr-and branch from 18377c9 to 5927510 Compare June 22, 2026 18:57
@github-actions

Copy link
Copy Markdown
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

kornia (https://github.com/kornia/kornia)
+ kornia/enhance/histogram.py:214: error: Item "None" of "Any | None" has no attribute "shape"  [union-attr]
+ kornia/enhance/histogram.py:214: error: Item "None" of "Any | None" has no attribute "dim"  [union-attr]
+ kornia/augmentation/container/image.py:135: error: Argument 1 to "len" has incompatible type "list[float] | None"; expected "Sized"  [arg-type]

spack (https://github.com/spack/spack)
+ lib/spack/spack/patch.py:354: error: Argument 1 to "check" of "Checker" has incompatible type "str | None"; expected "str"  [arg-type]
+ lib/spack/spack/spec.py:2863: error: Item "None" of "InstallRecord | None" has no attribute "spec"  [union-attr]
+ lib/spack/spack/spec.py:2863: error: Item "None" of "InstallRecord | None" has no attribute "deprecated_for"  [union-attr]
+ lib/spack/spack/environment/environment.py:136: error: Value of type "dict[str, Any] | None" is not indexable  [index]
+ lib/spack/spack/environment/environment.py:1631: error: Argument 1 to "len" has incompatible type "list[Spec] | None"; expected "Sized"  [arg-type]
+ lib/spack/spack/environment/environment.py:1636: error: Argument 1 to "len" has incompatible type "list[str] | None"; expected "Sized"  [arg-type]
+ lib/spack/spack/cmd/mark.py:66: error: Need type annotation for "specs_from_cli" (hint: "specs_from_cli: list[<type>] = ...")  [var-annotated]

python-chess (https://github.com/niklasf/python-chess)
+ chess/engine.py:146: error: Unsupported operand types for < ("int" and "None")  [operator]
+ chess/engine.py:146: note: Right operand is of type "int | None"
+ chess/engine.py:148: error: Unsupported operand types for > ("int" and "None")  [operator]
+ chess/engine.py:148: note: Left operand is of type "int | None"
+ chess/engine.py:2328: error: Item "None" of "Limit | None" has no attribute "white_clock"  [union-attr]
+ chess/engine.py:2328: error: Item "None" of "Limit | None" has no attribute "black_clock"  [union-attr]
+ chess/engine.py:2498: error: Unsupported right operand type for in ("str | None")  [operator]

optuna (https://github.com/optuna/optuna)
+ optuna/distributions.py:151: error: Unsupported operand types for >= ("int" and "None")  [operator]
+ optuna/distributions.py:151: note: Left operand is of type "float | None"
+ optuna/samplers/nsgaii/_crossovers/_vsbx.py:67: error: Unsupported operand types for > ("float" and "None")  [operator]
+ optuna/samplers/nsgaii/_crossovers/_vsbx.py:67: note: Left operand is of type "float | None"
+ optuna/samplers/nsgaii/_crossovers/_sbx.py:66: error: Unsupported operand types for > ("float" and "None")  [operator]
+ optuna/samplers/nsgaii/_crossovers/_sbx.py:66: note: Left operand is of type "float | None"
+ optuna/pruners/_successive_halving.py:130: error: Unsupported operand types for < ("str" and "int")  [operator]
+ optuna/pruners/_successive_halving.py:130: note: Left operand is of type "str | int"
+ optuna/storages/_rdb/storage.py:228: error: Unsupported operand types for >= ("int" and "None")  [operator]
+ optuna/storages/_rdb/storage.py:228: note: Left operand is of type "int | None"
+ optuna/visualization/_timeline.py:56: error: Unsupported operand types for >= ("int" and "None")  [operator]
+ optuna/visualization/_timeline.py:56: note: Left operand is of type "int | None"
+ optuna/visualization/matplotlib/_timeline.py:45: error: Unsupported operand types for >= ("int" and "None")  [operator]
+ optuna/visualization/matplotlib/_timeline.py:45: note: Left operand is of type "int | None"
+ optuna/visualization/matplotlib/_contour.py:157: error: Incompatible return value type (got "tuple[list[str | float | None], list[str | float]]", expected "tuple[list[str | float], list[str | float]]")  [return-value]
+ optuna/visualization/matplotlib/_contour.py:212: error: Argument 2 to "_calculate_axis_data" has incompatible type "list[str | float | None]"; expected "Sequence[str | float]"  [arg-type]

spark (https://github.com/apache/spark)
+ python/pyspark/core/context.py:199: error: Item "None" of "Any | None" has no attribute "gateway_parameters"  [union-attr]
+ python/pyspark/pandas/frame.py:8590: error: Item "list[Any]" of "list[Any] | dict[Any, Any]" has no attribute "keys"  [union-attr]
+ python/pyspark/sql/connect/session.py:518: error: Item "Iterable[Any]" of "DataFrame | Any | Iterable[Any]" has no attribute "ndim"  [union-attr]
+ python/pyspark/streaming/dstream.py:597: error: Unsupported operand types for * ("None" and "int")  [operator]
+ python/pyspark/streaming/dstream.py:597: note: Left operand is of type "int | None"
+ python/pyspark/mllib/stat/_statistics.py:304: error: Argument 1 to "len" has incompatible type "Vector | None"; expected "Sized"  [arg-type]

psycopg (https://github.com/psycopg/psycopg)
+ psycopg/psycopg/_connection_base.py:311: error: Value of type "tuple[Xid, bool] | None" is not indexable  [index]
+ psycopg_pool/psycopg_pool/pool_async.py:321: error: Unsupported operand types for >= ("float" and "None")  [operator]
+ psycopg_pool/psycopg_pool/pool_async.py:321: note: Left operand is of type "float | None"
+ psycopg_pool/psycopg_pool/pool.py:284: error: Unsupported operand types for >= ("float" and "None")  [operator]
+ psycopg_pool/psycopg_pool/pool.py:284: note: Left operand is of type "float | None"
+ psycopg_pool/psycopg_pool/null_pool_async.py:100: error: Unsupported operand types for >= ("float" and "None")  [operator]
+ psycopg_pool/psycopg_pool/null_pool_async.py:100: note: Left operand is of type "float | None"
+ psycopg_pool/psycopg_pool/null_pool.py:104: error: Unsupported operand types for >= ("float" and "None")  [operator]
+ psycopg_pool/psycopg_pool/null_pool.py:104: note: Left operand is of type "float | None"

prefect (https://github.com/PrefectHQ/prefect)
+ src/prefect/types/names.py:30: error: Argument 2 to "match" has incompatible type "str | None"; expected "str"  [arg-type]
+ src/prefect/types/names.py:54: error: Argument 2 to "match" has incompatible type "str | None"; expected "str"  [arg-type]
+ src/prefect/_internal/schemas/validators.py:183: error: Unsupported operand types for < ("int" and "None")  [operator]
+ src/prefect/_internal/schemas/validators.py:183: note: Left operand is of type "int | None"
+ src/prefect/_internal/schemas/validators.py:594: error: Argument 1 to "len" has incompatible type "int | float | list[int] | list[float] | None"; expected "Sized"  [arg-type]
+ src/prefect/_internal/schemas/validators.py:609: error: Unsupported operand types for > ("int" and "None")  [operator]
+ src/prefect/_internal/schemas/validators.py:609: note: Left operand is of type "float | None"
+ src/prefect/_internal/schemas/validators.py:658: error: Argument 1 to "len" has incompatible type "str | None"; expected "Sized"  [arg-type]
+ src/prefect/client/orchestration/_deployments/client.py:366: error: Item "ValueError" of "Any | ValueError" has no attribute "response"  [union-attr]
+ src/prefect/client/orchestration/_deployments/client.py:1080: error: Item "ValueError" of "Any | ValueError" has no attribute "response"  [union-attr]
+ src/prefect/concurrency/services.py:79: error: Unsupported operand types for >= ("int" and "None")  [operator]
+ src/prefect/concurrency/services.py:79: note: Left operand is of type "int | None"
+ src/prefect/concurrency/services.py:177: error: Unsupported operand types for >= ("int" and "None")  [operator]
+ src/prefect/concurrency/services.py:177: note: Left operand is of type "int | None"
+ src/prefect/runner/storage.py:182: error: Argument 2 to "match" has incompatible type "str | None"; expected "str"  [arg-type]
+ src/prefect/tasks.py:589: error: Unsupported operand types for > ("int" and "None")  [operator]
+ src/prefect/tasks.py:589: note: Left operand is of type "float | None"
+ src/prefect/transactions.py:206: error: Item "None" of "ResultStore | None" has no attribute "supports_isolation_level"  [union-attr]
+ src/prefect/runner/runner.py:234: error: Unsupported right operand type for in ("str | None")  [operator]
+ src/prefect/server/api/concurrency_limits.py:476: error: Item "None" of "Any | None" has no attribute "limit"  [union-attr]
+ src/prefect/server/api/concurrency_limits.py:481: error: Item "None" of "Any | None" has no attribute "concurrency_limit"  [union-attr]
+ src/prefect/input/run_input.py:638: error: Unsupported operand types for >= ("float" and "None")  [operator]
+ src/prefect/input/run_input.py:638: note: Right operand is of type "float | None"
+ src/prefect/input/run_input.py:747: error: Unsupported operand types for >= ("float" and "None")  [operator]
+ src/prefect/input/run_input.py:747: note: Right operand is of type "float | None"
+ src/prefect/flow_runs.py:744: error: Item "None" of "State[Any] | None" has no attribute "type"  [union-attr]
+ src/prefect/flow_runs.py:768: error: Item "None" of "State[Any] | None" has no attribute "type"  [union-attr]
+ src/prefect/workers/base.py:650: error: Unsupported right operand type for in ("str | None")  [operator]
+ src/prefect/workers/base.py:1201: error: Setting? has no attribute "value"  [attr-defined]
+ src/prefect/deployments/flow_runs.py:118: error: Unsupported operand types for > ("int" and "None")  [operator]
+ src/prefect/deployments/flow_runs.py:118: note: Left operand is of type "float | None"
+ src/prefect/deployments/flow_runs.py:316: error: Unsupported operand types for > ("int" and "None")  [operator]
+ src/prefect/deployments/flow_runs.py:316: note: Left operand is of type "float | None"
+ src/prefect/cli/transfer/_migratable_resources/deployments.py:148: error: Argument 1 to "get" of "dict" has incompatible type "UUID | None"; expected "UUID"  [arg-type]
+ src/prefect/cli/transfer/_migratable_resources/deployments.py:164: error: Argument 1 to "get" of "dict" has incompatible type "UUID | None"; expected "UUID"  [arg-type]
+ src/prefect/cli/task_run.py:60: error: Item "None" of "str | None" has no attribute "lower"  [union-attr]
+ src/prefect/cli/task_run.py:136: error: Item "None" of "str | None" has no attribute "lower"  [union-attr]
+ src/prefect/cli/task_run.py:279: error: Item "None" of "str | None" has no attribute "lower"  [union-attr]
- src/prefect/cli/shell.py:231: error: Incompatible types in "await" (actual type "UUID | Coroutine[Any, Any, UUID]", expected type "Awaitable[Any]")  [misc]
+ src/prefect/cli/shell.py:204: error: Unsupported operand types for > ("int" and "None")  [operator]
+ src/prefect/cli/shell.py:204: note: Left operand is of type "int | None"
+ src/prefect/cli/result_storage.py:104: error: Item "None" of "str | None" has no attribute "lower"  [union-attr]
+ src/prefect/cli/profile.py:52: error: Item "None" of "str | None" has no attribute "lower"  [union-attr]
+ src/prefect/cli/profile.py:288: error: Item "None" of "str | None" has no attribute "lower"  [union-attr]
+ src/prefect/cli/flow.py:54: error: Item "None" of "str | None" has no attribute "lower"  [union-attr]
+ src/prefect/cli/config.py:200: error: Item "None" of "str | None" has no attribute "lower"  [union-attr]
- src/prefect/cli/api.py:227: error: Argument 1 to "request" of "BaseAsyncClient" has incompatible type "str"; expected "Literal['GET', 'POST', 'PUT', 'DELETE', 'PATCH']"  [arg-type]
- src/prefect/cli/api.py:228: error: Argument 2 to "request" of "BaseAsyncClient" has incompatible type "str"; expected "Literal['/admin/storage', '/admin/settings', '/admin/version', '/artifacts/', '/artifacts/{id}', '/artifacts/{key}/latest', '/artifacts/count', '/artifacts/filter', '/artifacts/latest/count', '/artifacts/latest/filter', '/automations/', '/automations/{id}', '/automations/count', '/automations/filter', '/automations/owned-by/{resource_id}', '/automations/related-to/{resource_id}', '/block_capabilities/', '/block_documents/', '/block_documents/{id}', '/block_documents/count', '/block_documents/filter', '/block_schemas/', '/block_schemas/{id}', '/block_schemas/checksum/{checksum}', '/block_schemas/filter', '/block_types/', '/block_types/{id}', '/block_types/filter', '/block_types/install_system_block_types', '/block_types/slug/{slug}', '/block_types/slug/{slug}/block_documents', '/block_types/slug/{slug}/block_documents/name/{block_document_name}', '/collections/views/{view}', '/concurrency_limits/', '/concurrency_limits/{id}', '/concurrency_limits/decrement', '/concurrency_limits/filter', '/concurrency_limits/increment', '/concurrency_limits/tag/{tag}', '/concurrency_limits/tag/{tag}/reset', '/csrf-token', '/deployments/', '/deployments/{id}', '/deployments/{id}/branch', '/deployments/{id}/create_flow_run', '/deployments/{id}/pause_deployment', '/deployments/{id}/resume_deployment', '/deployments/{id}/schedule', '/deployments/{id}/schedules', '/deployments/{id}/schedules/{schedule_id}', '/deployments/{id}/work_queue_check', '/deployments/count', '/deployments/filter', '/deployments/get_scheduled_flow_runs', '/deployments/name/{flow_name}/{deployment_name}', '/deployments/paginate', '/events', '/events/count-by/{countable}', '/events/filter', '/events/filter/next', '/flow_run_states/', '/flow_run_states/{id}', '/flow_runs/', '/flow_runs/{id}', '/flow_runs/{id}/graph', '/flow_runs/{id}/graph-v2', '/flow_runs/{id}/input', '/flow_runs/{id}/input/{key}', '/flow_runs/{id}/input/filter', '/flow_runs/{id}/labels', '/flow_runs/{id}/logs/download', '/flow_runs/{id}/resume', '/flow_runs/{id}/set_state', '/flow_runs/count', '/flow_runs/filter', '/flow_runs/history', '/flow_runs/lateness', '/flow_runs/paginate', '/flows/', '/flows/{id}', '/flows/count', '/flows/filter', '/flows/name/{name}', '/flows/paginate', '/health', '/hello', '/logs/', '/logs/filter', '/ready', '/saved_searches/', '/saved_searches/{id}', '/saved_searches/filter', '/task_run_states/', '/task_run_states/{id}', '/task_runs/', '/task_runs/{id}', '/task_runs/{id}/set_state', '/task_runs/count', '/task_runs/filter', '/task_runs/history', '/task_workers/filter', '/templates/validate', '/ui/flow_runs/count-task-runs', '/ui/flow_runs/history', '/ui/flows/count-deployments', '/ui/flows/next-runs', '/ui/schemas/validate', '/ui/task_runs/count', '/ui/task_runs/dashboard/counts', '/v2/concurrency_limits/', '/v2/concurrency_limits/{id_or_name}', '/v2/concurrency_limits/decrement', '/v2/concurrency_limits/decrement-with-lease', '/v2/concurrency_limits/filter', '/v2/concurrency_limits/increment', '/v2/concurrency_limits/increment-with-lease', '/v2/concurrency_limits/leases/{lease_id}/renew', '/variables/', '/variables/{id}', '/variables/count', '/variables/filter', '/variables/name/{name}', '/version', '/work_pools/', '/work_pools/{name}', '/work_pools/{name}/concurrency_status', '/work_pools/{name}/get_scheduled_flow_runs', '/work_pools/{work_pool_name}/queues', '/work_pools/{work_pool_name}/queues/{name}', '/work_pools/{work_pool_name}/queues/filter', '/work_pools/{work_pool_name}/workers/{name}', '/work_pools/{work_pool_name}/workers/filter', '/work_pools/{work_pool_name}/workers/heartbeat', '/work_pools/count', '/work_pools/filter', '/work_queues/', '/work_queues/{id}', '/work_queues/{id}/get_runs', '/work_queues/{id}/concurrency_status', '/work_queues/{id}/status', '/work_queues/filter', '/work_queues/name/{name}']"  [arg-type]
- src/prefect/cli/flow_run.py:265: error: Argument "key" to "sorted" has incompatible type "Callable[[FlowRun], Any | None]"; expected "Callable[[FlowRun], SupportsDunderLT[Any] | SupportsDunderGT[Any]]"  [arg-type]
- src/prefect/cli/flow_run.py:265: error: Incompatible return value type (got "Any | None", expected "SupportsDunderLT[Any] | SupportsDunderGT[Any]")  [return-value]
- src/prefect/cli/flow_run.py:268: error: Item "None" of "State[Any] | None" has no attribute "state_details"  [union-attr]
- src/prefect/cli/flow_run.py:269: error: Item "None" of "State[Any] | None" has no attribute "is_scheduled"  [union-attr]
- src/prefect/cli/flow_run.py:270: error: Item "None" of "State[Any] | None" has no attribute "timestamp"  [union-attr]
- src/prefect/cli/flow_run.py:276: error: Item "None" of "State[Any] | None" has no attribute "type"  [union-attr]
+ src/prefect/cli/variable.py:63: error: Item "None" of "str | None" has no attribute "lower"  [union-attr]
+ src/prefect/cli/variable.py:118: error: Item "None" of "str | None" has no attribute "lower"  [union-attr]
+ src/prefect/cli/global_concurrency_limit.py:48: error: Item "None" of "str | None" has no attribute "lower"  [union-attr]
+ src/prefect/cli/global_concurrency_limit.py:126: error: Item "None" of "str | None" has no attribute "lower"  [union-attr]
+ src/prefect/cli/flow_run.py:124: error: Item "None" of "str | None" has no attribute "lower"  [union-attr]
+ src/prefect/cli/flow_run.py:186: error: Item "None" of "str | None" has no attribute "lower"  [union-attr]
+ src/prefect/cli/flow_run.py:419: error: Item "None" of "State[Any] | None" has no attribute "is_completed"  [union-attr]
+ src/prefect/cli/flow_run.py:474: error: Item "None" of "State[Any] | None" has no attribute "is_completed"  [union-attr]
+ src/prefect/cli/flow_run.py:540: error: Item "None" of "str | None" has no attribute "lower"  [union-attr]
+ src/prefect/cli/deployment.py:157: error: Item "None" of "str | None" has no attribute "lower"  [union-attr]
+ src/prefect/cli/deployment.py:221: error: Item "None" of "str | None" has no attribute "lower"  [union-attr]
- src/prefect/cli/deployment.py:750: error: Value of "anchor_date" has incompatible type "datetime"; expected "str"  [typeddict-item]
+ src/prefect/cli/deployment.py:1067: error: Item "None" of "str | None" has no attribute "lower"  [union-attr]
+ src/prefect/cli/concurrency_limit.py:82: error: Item "None" of "str | None" has no attribute "lower"  [union-attr]
+ src/prefect/cli/concurrency_limit.py:148: error: Item "None" of "str | None" has no attribute "lower"  [union-attr]
+ src/prefect/cli/block.py:277: error: Item "None" of "str | None" has no attribute "lower"  [union-attr]
+ src/prefect/cli/block.py:432: error: Item "None" of "str | None" has no attribute "lower"  [union-attr]
+ src/prefect/cli/block.py:487: error: Item "None" of "str | None" has no attribute "lower"  [union-attr]
+ src/prefect/cli/block.py:543: error: Item "None" of "str | None" has no attribute "lower"  [union-attr]
+ src/prefect/cli/automation.py:130: error: Item "None" of "str | None" has no attribute "lower"  [union-attr]
+ src/prefect/cli/artifact.py:62: error: Item "None" of "str | None" has no attribute "lower"  [union-attr]
+ src/prefect/cli/artifact.py:133: error: Item "None" of "str | None" has no attribute "lower"  [union-attr]
- src/prefect/cli/automation.py:216: error: Incompatible types in assignment (expression has type "Automation | None", variable has type "list[Automation]")  [assignment]
- src/prefect/cli/automation.py:219: error: "list[Automation]" has no attribute "id"  [attr-defined]
- src/prefect/cli/automation.py:220: error: "list[Automation]" has no attribute "id"  [attr-defined]
- src/prefect/cli/automation.py:267: error: Incompatible types in assignment (expression has type "Automation | None", variable has type "list[Automation]")  [assignment]
- src/prefect/cli/automation.py:270: error: "list[Automation]" has no attribute "id"  [attr-defined]
- src/prefect/cli/automation.py:271: error: "list[Automation]" has no attribute "id"  [attr-defined]
- src/prefect/cli/automation.py:341: error: Argument 1 to "delete_automation" of "AutomationAsyncClient" has incompatible type "str"; expected "UUID"  [arg-type]
- src/prefect/cli/automation.py:345: error: Incompatible types in assignment (expression has type "list[Automation]", variable has type "Automation | None")  [assignment]
- src/prefect/cli/artifact.py:93: error: Argument "key" to "sorted" has incompatible type "Callable[[Artifact], str | None]"; expected "Callable[[Artifact], SupportsDunderLT[Any] | SupportsDunderGT[Any]]"  [arg-type]
- src/prefect/cli/artifact.py:93: error: Incompatible return value type (got "str | None", expected "SupportsDunderLT[Any] | SupportsDunderGT[Any]")  [return-value]
+ src/prefect/cli/cloud/webhook.py:47: error: Item "None" of "str | None" has no attribute "lower"  [union-attr]
+ src/prefect/cli/cloud/webhook.py:82: error: Item "None" of "str | None" has no attribute "lower"  [union-attr]
+ src/prefect/cli/cloud/asset.py:64: error: Item "None" of "str | None" has no attribute "lower"  [union-attr]
+ src/prefect/cli/server.py:291: error: Item "None" of "str | None" has no attribute "lower"  [union-attr]
+ src/prefect/cli/server.py:564: error: Item "None" of "str | None" has no attribute "lower"  [union-attr]
+ src/prefect/cli/cloud/__init__.py:333: error: Item "None" of "str | None" has no attribute "lower"  [union-attr]
+ src/prefect/cli/work_pool.py:146: error: Item "None" of "list[str] | None" has no attribute "__iter__" (not iterable)  [union-attr]
+ src/prefect/cli/work_pool.py:165: error: Item "None" of "list[str] | None" has no attribute "__iter__" (not iterable)  [union-attr]
+ src/prefect/cli/work_pool.py:529: error: Item "None" of "str | None" has no attribute "lower"  [union-attr]
+ src/prefect/cli/work_pool.py:602: error: Item "None" of "str | None" has no attribute "lower"  [union-attr]
+ src/prefect/cli/work_pool.py:638: error: Item "None" of "str | None" has no attribute "lower"  [union-attr]
- src/prefect/cli/work_pool.py:1072: error: Argument "work_pool_name" to "get_scheduled_flow_runs_for_work_pool" of "WorkPoolAsyncClient" has incompatible type "str | None"; expected "str"  [arg-type]
+ src/prefect/cli/work_pool.py:1063: error: Item "None" of "str | None" has no attribute "lower"  [union-attr]
+ src/prefect/cli/work_pool.py:1182: error: Item "None" of "str | None" has no attribute "lower"  [union-attr]
- src/prefect/cli/work_queue.py:584: error: Invalid index type "UUID | None" for "dict[UUID, str]"; expected type "UUID"  [index]
- src/prefect/cli/work_queue.py:637: error: Argument 1 to "append" of "list" has incompatible type "str | None"; expected "str"  [arg-type]
- src/prefect/cli/work_queue.py:740: error: Unsupported operand types for > ("datetime" and "None")  [operator]
- src/prefect/cli/work_queue.py:740: note: Left operand is of type "Any | None"
+ src/prefect/cli/work_queue.py:364: error: Item "None" of "str | None" has no attribute "lower"  [union-attr]
+ src/prefect/cli/work_queue.py:438: error: Item "None" of "str | None" has no attribute "lower"  [union-attr]

... (truncated 2 lines) ...

steam.py (https://github.com/Gobot1234/steam.py)
+ steam/event.py:315: error: "ClanT" has no attribute "is_ogg"  [attr-defined]

openlibrary (https://github.com/internetarchive/openlibrary)
+ openlibrary/setup.py: note: In function "setup_for_script":
+ openlibrary/setup.py:16: error: Argument 1 to "Path" has incompatible type "str | None"; expected "str | PathLike[str]"  [arg-type]
+ openlibrary/catalog/get_ia.py: note: In function "urlopen_keep_trying":
+ openlibrary/catalog/get_ia.py:25: error: Item "None" of "Response | None" has no attribute "status_code"  [union-attr]
+ openlibrary/catalog/get_ia.py: note: At top level:

setuptools (https://github.com/pypa/setuptools)
+ setuptools/warnings.py:50: error: Unsupported operand types for > ("date" and "None")  [operator]
+ setuptools/warnings.py:50: note: Left operand is of type "date | None"
+ setuptools/command/bdist_wheel.py:274: error: Value of type "str | None" is not indexable  [index]

strawberry (https://github.com/strawberry-graphql/strawberry)
+ strawberry/types/fields/resolver.py:279: error: Item "None" of "Parameter | None" has no attribute "name"  [union-attr]
+ strawberry/types/field.py:212: error: Item "StrawberryType" of "StrawberryType | type" has no attribute "__strawberry_definition__"  [union-attr]
+ strawberry/types/field.py:212: error: Item "type" of "StrawberryType | type" has no attribute "__strawberry_definition__"  [union-attr]

websockets (https://github.com/aaugustin/websockets)
+ src/websockets/extensions/permessage_deflate.py:344: error: Unsupported right operand type for in ("dict[str, Any] | None")  [operator]
+ src/websockets/extensions/permessage_deflate.py:544: error: Unsupported right operand type for in ("dict[str, Any] | None")  [operator]

operator (https://github.com/canonical/operator)
+ ops/charm.py:586: error: Item "None" of "Unit | None" has no attribute "app"  [union-attr]
+ ops/_private/harness.py:3610: error: Unsupported operand types for <= ("int" and "None")  [operator]
+ ops/_private/harness.py:3610: note: Right operand is of type "int | None"
+ ops/_private/harness.py:3610: error: Unsupported operand types for >= ("int" and "None")  [operator]
+ ops/_private/harness.py:3610: note: Left operand is of type "int | None"
+ ops/_private/harness.py:3690: error: Unsupported operand types for <= ("int" and "None")  [operator]
+ ops/_private/harness.py:3690: note: Right operand is of type "int | None"
+ ops/_private/harness.py:3690: error: Unsupported operand types for >= ("int" and "None")  [operator]
+ ops/_private/harness.py:3690: note: Left operand is of type "int | None"

isort (https://github.com/pycqa/isort)
+ isort/main.py:1153: error: Unused "type: ignore" comment  [unused-ignore]

aiohttp (https://github.com/aio-libs/aiohttp)
+ aiohttp/helpers.py:292:46: error: Argument 1 to "proxy_bypass" has incompatible type "str | None"; expected "str"  [arg-type]
+ aiohttp/streams.py:504:33: error: Item "None" of "Future[None] | None" has no attribute "done"  [union-attr]
+ aiohttp/streams.py:504:33: note: See https://mypy.rtfd.io/en/stable/_refs.html#code-union-attr for more info
+ aiohttp/multipart.py:286:40: error: Item "None" of "str | None" has no attribute "isascii"  [union-attr]
+ aiohttp/multipart.py:286:61: error: Item "None" of "str | None" has no attribute "isdigit"  [union-attr]
+ aiohttp/client.py:331:47: error: Item "None" of "URL | None" has no attribute "path"  [union-attr]
+ aiohttp/web_response.py:560:41: error: Unsupported right operand type for in ("str | None")  [operator]
+ aiohttp/web_response.py:560:41: note: See https://mypy.rtfd.io/en/stable/_refs.html#code-operator for more info
+ aiohttp/web.py:564:5: error: Statement is unreachable  [unreachable]
+ aiohttp/web.py:564:5: note: See https://mypy.rtfd.io/en/stable/_refs.html#code-unreachable for more info

CPython (Argument Clinic) (https://github.com/python/cpython)
+ Tools/clinic/libclinic/block_parser.py:185: error: Statement is unreachable  [unreachable]
+ Tools/clinic/libclinic/dsl_parser.py:567: error: Statement is unreachable  [unreachable]
+ Tools/clinic/libclinic/dsl_parser.py:591: error: Statement is unreachable  [unreachable]
+ Tools/clinic/libclinic/dsl_parser.py:957: error: Statement is unreachable  [unreachable]
+ Tools/clinic/libclinic/dsl_parser.py:1122: error: Statement is unreachable  [unreachable]
+ Tools/clinic/libclinic/clanguage.py:432: error: Statement is unreachable  [unreachable]
+ Tools/clinic/libclinic/cli.py:215: error: Statement is unreachable  [unreachable]

mypy (https://github.com/python/mypy)
+ mypyc/transform/spill.py:86: error: "Op" has no attribute "src"  [attr-defined]
+ mypy/plugins/dataclasses.py:360: error: Value of type "dict[str, Any] | None" is not indexable  [index]
+ mypy/plugins/dataclasses.py:360: note: See https://mypy.rtfd.io/en/stable/_refs.html#code-index for more info
+ mypy/plugins/dataclasses.py:365: error: Value of type "dict[str, Any] | None" is not indexable  [index]
+ mypy/checker.py:3640: error: Argument 1 to "is_proper_subtype" has incompatible type "Type | None"; expected "Type"  [arg-type]
+ mypy/checker.py:3640: error: Argument 2 to "is_proper_subtype" has incompatible type "Type | None"; expected "Type"  [arg-type]
+ mypy/checker.py:3642: error: Argument 1 to "is_subtype" has incompatible type "Type | None"; expected "Type"  [arg-type]
+ mypy/checker.py:3642: error: Argument 2 to "is_subtype" has incompatible type "Type | None"; expected "Type"  [arg-type]
+ mypy/stubgen.py:2023: error: Statement is unreachable  [unreachable]
+ mypy/stubgen.py:2023: note: See https://mypy.rtfd.io/en/stable/_refs.html#code-unreachable for more info
+ mypy/main.py:124: error: Statement is unreachable  [unreachable]
+ mypy/main.py:1443: error: Statement is unreachable  [unreachable]
+ mypy/main.py:1645: error: Need type annotation for "package_root" (hint: "package_root: list[<type>] = ...")  [var-annotated]
+ mypy/main.py:1645: note: See https://mypy.rtfd.io/en/stable/_refs.html#code-var-annotated for more info
+ mypy/main.py:1653: error: Statement is unreachable  [unreachable]
+ mypy/main.py:1680: error: Statement is unreachable  [unreachable]
+ mypy/test/testcmdline.py:48: error: Statement is unreachable  [unreachable]
+ mypy/test/testcheck.py:68: error: Statement is unreachable  [unreachable]

hydra-zen (https://github.com/mit-ll-responsible-ai/hydra-zen)
+ src/hydra_zen/structured_configs/_implementations.py:3194: error: Item "str" of "str | ZenField" has no attribute "name"  [union-attr]
+ src/hydra_zen/structured_configs/_implementations.py:3222: error: Item "type" of "str | type[NOTHING]" has no attribute "startswith"  [union-attr]

altair (https://github.com/vega/altair)
+ altair/utils/data.py:162: error: Unsupported operand types for > ("int" and "None")  [operator]
+ altair/utils/data.py:162: note: Right operand is of type "int | None"

zulip (https://github.com/zulip/zulip)
+ zerver/lib/user_groups.py:1258: error: Argument 1 to "are_both_group_setting_values_equal" has incompatible type "int | UserGroupMembersData | None"; expected "int | UserGroupMembersData"  [arg-type]
+ zerver/lib/export.py:661: error: Item "None" of "Config | None" has no attribute "table"  [union-attr]
+ zerver/lib/streams.py:152: error: Argument 1 to "channel_has_named_topics" has incompatible type "Stream | None"; expected "Stream"  [arg-type]
+ corporate/lib/stripe.py:4295: error: Item "None" of "CustomerPlan | None" has no attribute "is_a_paid_plan"  [union-attr]
+ zerver/actions/message_send.py:1924: error: Argument 2 to "stream_wildcard_mention_allowed" has incompatible type "Stream | None"; expected "Stream"  [arg-type]
+ zerver/actions/realm_settings.py:511: error: Item "None" of "Stream | None" has no attribute "is_public"  [union-attr]
+ zproject/backends.py:4371: error: Argument 1 to "is_valid_otp" has incompatible type "str | None"; expected "str"  [arg-type]
+ zerver/decorator.py:323: error: Item "None" of "str | None" has no attribute "lower"  [union-attr]
+ zerver/views/users.py:148: error: Item "None" of "Any | None" has no attribute "delete_public_channel_messages"  [union-attr]
+ zerver/views/users.py:149: error: Item "None" of "Any | None" has no attribute "delete_private_channel_messages"  [union-attr]
+ zerver/views/users.py:150: error: Item "None" of "Any | None" has no attribute "delete_direct_messages"  [union-attr]
+ zerver/tornado/event_queue.py:825: error: Unsupported operand types for < ("int" and "None")  [operator]
+ zerver/tornado/event_queue.py:825: note: Right operand is of type "int | None"
+ zerver/views/user_settings.py:237: error: Unsupported operand types for >= ("int" and "None")  [operator]
+ zerver/views/user_settings.py:237: note: Left operand is of type "int | None"
+ zerver/views/user_settings.py:238: error: Unsupported operand types for < ("int" and "None")  [operator]
+ zerver/views/user_settings.py:238: note: Left operand is of type "int | None"
+ analytics/views/stats.py:433: error: Unsupported operand types for < ("datetime" and "None")  [operator]
+ analytics/views/stats.py:433: note: Left operand is of type "datetime | None"
+ zerver/management/commands/delete_realm.py:45: error: Item "None" of "Customer | None" has no attribute "stripe_customer_id"  [union-attr]
+ corporate/management/commands/link_customer_to_stripe_id.py:61: error: Item "None" of "CustomerPlan | None" has no attribute "is_a_paid_plan"  [union-attr]

urllib3 (https://github.com/urllib3/urllib3)
+ src/urllib3/util/ssl_.py:422: error: Argument 1 to "_is_key_file_encrypted" has incompatible type "str | None"; expected "str"  [arg-type]

scrapy (https://github.com/scrapy/scrapy)
+ scrapy/core/downloader/handlers/_httpx.py:150: error: Item "None" of "str | None" has no attribute "startswith"  [union-attr]

aioredis (https://github.com/aio-libs/aioredis)
+ aioredis/connection.py:548: error: Value of type "bytes | memoryview[int] | str | int | float | list[bytes | memoryview[int] | str | int | float | ConnectionError]" is not indexable  [index]
+ aioredis/connection.py:550: error: Value of type "bytes | memoryview[int] | str | int | float | list[bytes | memoryview[int] | str | int | float | ConnectionError]" is not indexable  [index]

pip (https://github.com/pypa/pip)
+ src/pip/_internal/utils/logging.py:246: error: Argument 1 to "_is_broken_pipe_error" has incompatible type "type[BaseException] | None"; expected "type[BaseException]"  [arg-type]

discord.py (https://github.com/Rapptz/discord.py)
+ discord/app_commands/transformers.py:379: error: Unsupported operand types for < ("int" and "None")  [operator]
+ discord/app_commands/transformers.py:379: error: Unsupported operand types for < ("float" and "None")  [operator]
+ discord/app_commands/transformers.py:379: note: Both left and right operands are unions
+ discord/ext/tasks/__init__.py:177: error: Unsupported operand types for >= ("int" and "None")  [operator]
+ discord/ext/tasks/__init__.py:177: note: Left operand is of type "int | None"
+ discord/ext/tasks/__init__.py:407: error: Item "None" of "Task[None] | None" has no attribute "done"  [union-attr]

Tanjun (https://github.com/FasterSpeeding/Tanjun)
+ tanjun/conversion.py:1307: error: Argument 1 to "_range_check" has incompatible type "Snowflake | None"; expected "Snowflake"  [arg-type]

pandera (https://github.com/pandera-dev/pandera)
+ pandera/strategies/constraints.py:186: error: Argument 1 to "len" has incompatible type "frozenset[Any] | None"; expected "Sized"  [arg-type]
+ pandera/strategies/constraints.py:194: error: Unsupported right operand type for in ("frozenset[Any] | None")  [operator]
+ pandera/strategies/constraints.py:216: error: Unsupported operand types for > ("int" and "None")  [operator]
+ pandera/strategies/constraints.py:216: note: Right operand is of type "int | None"
+ pandera/strategies/constraints.py:225: error: Unsupported operand types for < ("int" and "None")  [operator]
+ pandera/strategies/constraints.py:225: note: Right operand is of type "int | None"
+ pandera/strategies/constraints.py:234: error: Unsupported operand types for < ("int" and "None")  [operator]
+ pandera/strategies/constraints.py:234: note: Left operand is of type "int | None"
+ pandera/engines/geopandas_engine.py:181: error: Item "None" of "Series[Any] | DataFrame | Any | Any | None" has no attribute "crs"  [union-attr]
+ pandera/api/pandas/components.py:103: error: Argument 1 to "is_valid_multiindex_key" has incompatible type "tuple[str, ...] | None"; expected "tuple[Any, ...]"  [arg-type]

dulwich (https://github.com/dulwich/dulwich)
+ dulwich/objects.py:1670: error: Argument 1 to "S_ISGITLINK" has incompatible type "int | None"; expected "int"  [arg-type]
+ dulwich/index.py:1447: error: Item "ConflictedIndexEntry" of "IndexEntry | ConflictedIndexEntry" has no attribute "sha"  [union-attr]
+ dulwich/index.py:1452: error: Argument 4 to "_expand_tree" of "Index" has incompatible type "IndexEntry | ConflictedIndexEntry"; expected "IndexEntry"  [arg-type]
+ dulwich/filters.py:209: error: Item "None" of "bytes | None" has no attribute "rstrip"  [union-attr]
+ dulwich/filters.py:211: error: Item "None" of "bytes | None" has no attribute "rstrip"  [union-attr]
+ dulwich/client.py:2218: error: Unsupported operand types for > ("int" and "None")  [operator]
+ dulwich/client.py:2218: note: Right operand is of type "int | None"
+ dulwich/client.py:2363: error: Unsupported operand types for > ("int" and "None")  [operator]
+ dulwich/client.py:2363: note: Right operand is of type "int | None"
+ dulwich/client.py:2452: error: Item "None" of "bytes | None" has no attribute "startswith"  [union-attr]
+ dulwich/client.py:4612: error: Unsupported operand types for > ("int" and "None")  [operator]
+ dulwich/client.py:4612: note: Right operand is of type "int | None"
+ dulwich/client.py:4640: error: Unsupported operand types for > ("int" and "None")  [operator]
+ dulwich/client.py:4640: note: Right operand is of type "int | None"
+ dulwich/server.py:733: error: Unsupported right operand type for in ("Iterable[bytes | None] | None")  [operator]

werkzeug (https://github.com/pallets/werkzeug)
+ src/werkzeug/sansio/multipart.py:132: error: Unsupported operand types for > ("int" and "None")  [operator]
+ src/werkzeug/sansio/multipart.py:132: note: Right operand is of type "int | None"
+ src/werkzeug/sansio/multipart.py:194: error: Unsupported operand types for > ("int" and "None")  [operator]
+ src/werkzeug/sansio/multipart.py:194: note: Right operand is of type "int | None"
+ src/werkzeug/formparser.py:299: error: Unsupported operand types for > ("int" and "None")  [operator]
+ src/werkzeug/formparser.py:299: note: Right operand is of type "int | None"

pydantic (https://github.com/pydantic/pydantic)
+ pydantic/v1/validators.py:190: error: Unsupported operand types for > ("int" and "None")  [operator]
+ pydantic/v1/validators.py:190: error: Unsupported operand types for > ("float" and "None")  [operator]
+ pydantic/v1/validators.py:190: error: Unsupported operand types for > ("Decimal" and "None")  [operator]
+ pydantic/v1/validators.py:190: note: Both left and right operands are unions
+ pydantic/v1/validators.py:192: error: Unsupported operand types for >= ("int" and "None")  [operator]
+ pydantic/v1/validators.py:192: error: Unsupported operand types for >= ("float" and "None")  [operator]
+ pydantic/v1/validators.py:192: error: Unsupported operand types for >= ("Decimal" and "None")  [operator]
+ pydantic/v1/validators.py:192: note: Both left and right operands are unions
+ pydantic/v1/validators.py:195: error: Unsupported operand types for < ("int" and "None")  [operator]
+ pydantic/v1/validators.py:195: error: Unsupported operand types for < ("float" and "None")  [operator]
+ pydantic/v1/validators.py:195: error: Unsupported operand types for < ("Decimal" and "None")  [operator]
+ pydantic/v1/validators.py:195: note: Both left and right operands are unions
+ pydantic/v1/validators.py:197: error: Unsupported operand types for <= ("int" and "None")  [operator]
+ pydantic/v1/validators.py:197: error: Unsupported operand types for <= ("float" and "None")  [operator]
+ pydantic/v1/validators.py:197: error: Unsupported operand types for <= ("Decimal" and "None")  [operator]
+ pydantic/v1/validators.py:197: note: Both left and right operands are unions
+ pydantic/v1/validators.py:224: error: Unsupported operand types for > ("int" and "None")  [operator]
+ pydantic/v1/validators.py:224: note: Right operand is of type "int | None"
+ pydantic/v1/validators.py:506: error: Unsupported operand types for > ("int" and "None")  [operator]
+ pydantic/v1/validators.py:506: note: Right operand is of type "Any | int | None"
+ pydantic/v1/types.py:511: error: Unsupported operand types for < ("int" and "None")  [operator]
+ pydantic/v1/types.py:511: note: Right operand is of type "int | None"
+ pydantic/v1/types.py:514: error: Unsupported operand types for > ("int" and "None")  [operator]
+ pydantic/v1/types.py:514: note: Right operand is of type "int | None"
+ pydantic/v1/types.py:553: error: Unsupported operand types for < ("int" and "None")  [operator]
+ pydantic/v1/types.py:553: note: Right operand is of type "int | None"
+ pydantic/v1/types.py:556: error: Unsupported operand types for > ("int" and "None")  [operator]
+ pydantic/v1/types.py:556: note: Right operand is of type "int | None"
+ pydantic/v1/types.py:603: error: Unsupported operand types for < ("int" and "None")  [operator]
+ pydantic/v1/types.py:603: note: Right operand is of type "int | None"
+ pydantic/v1/types.py:606: error: Unsupported operand types for > ("int" and "None")  [operator]
+ pydantic/v1/types.py:606: note: Right operand is of type "int | None"
+ pydantic/v1/types.py:721: error: Unsupported operand types for > ("int" and "None")  [operator]
+ pydantic/v1/types.py:721: note: Right operand is of type "int | None"
+ pydantic/v1/types.py:724: error: Unsupported operand types for > ("int" and "None")  [operator]
+ pydantic/v1/types.py:724: note: Right operand is of type "int | None"
+ pydantic/v1/networks.py:316: error: Argument 1 to "int" has incompatible type "str | None"; expected "str | Buffer | SupportsInt | SupportsIndex"  [arg-type]
+ pydantic/v1/networks.py:329: error: Unsupported right operand type for in ("Collection[str] | None")  [operator]
+ pydantic/v1/networks.py:330: error: Argument 1 to "set" has incompatible type "Collection[str] | None"; expected "Iterable[str]"  [arg-type]
+ pydantic/_internal/_generate_schema.py:2407: error: Cannot determine type of "unused_metadata_value"  [has-type]

scipy (https://github.com/scipy/scipy)
+ scipy/stats/_entropy.py:141: error: Unsupported operand types for >= ("int" and "None")  [operator]
+ scipy/stats/_entropy.py:141: note: Left operand is of type "float | None"
+ scipy/stats/_entropy.py:338: error: Unsupported operand types for >= ("int" and "None")  [operator]
+ scipy/stats/_entropy.py:338: note: Left operand is of type "float | None"

pyodide (https://github.com/pyodide/pyodide)
+ src/py/pyodide/http/_pyfetch.py:183: error: Item "None" of "AbortSignal | None" has no attribute "aborted"  [union-attr]

cwltool (https://github.com/common-workflow-language/cwltool)
+ cwltool/command_line_tool.py: note: In member "_initialworkdir" of class "CommandLineTool":
+ cwltool/command_line_tool.py:744:59: error: Argument 1 to "index" of "list" has incompatible type "str | None"; expected "str"  [arg-type]

rotki (https://github.com/rotki/rotki)
+ rotkehlchen/utils/rate_limiter.py:106: error: Unsupported operand types for >= ("int" and "None")  [operator]
+ rotkehlchen/utils/rate_limiter.py:106: note: Left operand is of type "float | None"
+ rotkehlchen/externalapis/blockscout.py:616: error: Unsupported operand types for > ("Timestamp" and "None")  [operator]
+ rotkehlchen/externalapis/blockscout.py:616: note: Left operand is of type "Timestamp | None"
+ rotkehlchen/exchanges/poloniex.py:302: error: No overload variant of "__getitem__" of "list" matches argument type "str"  [call-overload]
+ rotkehlchen/exchanges/poloniex.py:302: note: Possible overload variants:
+ rotkehlchen/exchanges/poloniex.py:302: note:     def __getitem__(self, SupportsIndex, /) -> Any
+ rotkehlchen/exchanges/poloniex.py:302: note:     def __getitem__(self, slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[Any]
+ rotkehlchen/api/v1/fields.py:421: error: Unsupported right operand type for in ("Sequence[SupportedBlockchain] | None")  [operator]
+ rotkehlchen/api/v1/fields.py:423: error: Unsupported right operand type for in ("Sequence[SupportedBlockchain] | None")  [operator]
+ rotkehlchen/api/v1/fields.py:468: error: Unsupported right operand type for in ("Sequence[Enum] | None")  [operator]
+ rotkehlchen/api/v1/fields.py:471: error: Unsupported right operand type for in ("Sequence[Enum] | None")  [operator]
+ rotkehlchen/api/v1/fields.py:542: error: Unsupported right operand type for in ("list[Literal[ChainID.ETHEREUM, ChainID.OPTIMISM, ChainID.POLYGON_POS, ChainID.ARBITRUM_ONE, ChainID.BASE, ChainID.HYPERLIQUID, ChainID.GNOSIS, ChainID.SCROLL, ChainID.BINANCE_SC, ChainID.MONAD]] | None")  [operator]
+ rotkehlchen/api/v1/fields.py:545: error: Item "None" of "list[Literal[ChainID.ETHEREUM, ChainID.OPTIMISM, ChainID.POLYGON_POS, ChainID.ARBITRUM_ONE, ChainID.BASE, ChainID.HYPERLIQUID, ChainID.GNOSIS, ChainID.SCROLL, ChainID.BINANCE_SC, ChainID.MONAD]] | None" has no attribute "__iter__" (not iterable)  [union-attr]
+ rotkehlchen/api/v1/fields.py:580: error: Unsupported right operand type for in ("list[SupportedBlockchain] | None")  [operator]
+ rotkehlchen/api/v1/fields.py:583: error: Item "None" of "list[SupportedBlockchain] | None" has no attribute "__iter__" (not iterable)  [union-attr]
+ rotkehlchen/api/v1/fields.py:871: error: Unsupported right operand type for in ("Sequence[AssetType] | None")  [operator]
+ rotkehlchen/api/v1/fields.py:905: error: Unsupported right operand type for in ("tuple[Location, ...] | None")  [operator]
+ rotkehlchen/api/v1/fields.py:908: error: Item "None" of "tuple[Location, ...] | None" has no attribute "__iter__" (not iterable)  [union-attr]
+ rotkehlchen/api/v1/fields.py:1030: error: Item "None" of "Sequence[str] | None" has no attribute "__iter__" (not iterable)  [union-attr]
+ rotkehlchen/api/v1/fields.py:1048: error: Item "None" of "Sequence[str] | None" has no attribute "__iter__" (not iterable)  [union-attr]
+ rotkehlchen/tests/exchanges/test_bybit.py:56: error: Unsupported right operand type for in ("dict[str, Any] | None")  [operator]
+ rotkehlchen/tests/exchanges/test_bybit.py:57: error: Value of type "dict[str, Any] | None" is not indexable  [index]
+ rotkehlchen/tests/exchanges/test_bybit.py:61: error: Value of type "dict[str, Any] | None" is not indexable  [index]
+ rotkehlchen/serialization/schemas.py:409: error: Unsupported right operand type for in ("list[AssetType] | None")  [operator]
+ rotkehlchen/api/v1/schemas.py:357: error: Item "None" of "SupportedBlockchain | None" has no attribute "is_evm_or_evmlike"  [union-attr]
+ rotkehlchen/api/v1/schemas.py:358: error: Item "None" of "SupportedBlockchain | None" has no attribute "is_substrate"  [union-attr]
+ rotkehlchen/api/v1/schemas.py:363: error: Argument "chain" to "is_valid_bitcoin_address" has incompatible type "SupportedBlockchain | None"; expected "SupportedBlockchain"  [arg-type]

ecosystem-analyzer (https://github.com/astral-sh/ecosystem-analyzer)
+ src/ecosystem_analyzer/main.py:337: error: Unsupported operand types for > ("int" and "None")  [operator]
+ src/ecosystem_analyzer/main.py:337: note: Left operand is of type "int | None"
+ src/ecosystem_analyzer/main.py:337: error: Unsupported operand types for <= ("int" and "None")  [operator]

beartype (https://github.com/beartype/beartype)
+ beartype/_check/error/_pep/errpep484604.py:178: error: Argument "types" to "join_delimited_disjunction_types" has incompatible type "set[type | None]"; expected "Iterable[type]"  [arg-type]

sympy (https://github.com/sympy/sympy)
+ sympy/ntheory/factor_.py:742: error: Unsupported operand types for >= ("int" and "None")  [operator]
+ sympy/ntheory/factor_.py:742: note: Left operand is of type "int | None"
+ sympy/polys/rings.py:300: error: "Domain[Er]" has no attribute "symbols"  [attr-defined]
+ sympy/matrices/sparsetools.py:275: error: Unsupported operand types for > ("int" and "None")  [operator]
+ sympy/matrices/sparsetools.py:275: note: Left operand is of type "int | None"
+ sympy/matrices/sparsetools.py:277: error: Unsupported operand types for > ("int" and "None")  [operator]
+ sympy/matrices/sparsetools.py:277: note: Left operand is of type "int | None"

pytest (https://github.com/pytest-dev/pytest)
+ src/_pytest/_io/pprint.py:88: error: Unsupported operand types for >= ("int" and "None")  [operator]
+ src/_pytest/_io/pprint.py:88: note: Left operand is of type "int | None"
+ src/_pytest/python_api.py:598: error: Unsupported operand types for > ("timedelta" and "None")  [operator]
+ src/_pytest/python_api.py:598: note: Left operand is of type "timedelta | None"
+ src/_pytest/runner.py:364: error: Argument 2 to "isinstance" has incompatible type "type[BaseException] | tuple[type[BaseException], ...] | None"; expected "_ClassInfo"  [arg-type]
+ src/_pytest/pytester.py:1545: error: Statement is unreachable  [unreachable]
+ src/_pytest/skipping.py:254: error: Item "None" of "Xfail | None" has no attribute "run"  [union-attr]
+ src/_pytest/skipping.py:264: error: Item "None" of "Xfail | None" has no attribute "run"  [union-attr]
+ src/_pytest/skipping.py:267: error: Statement is unreachable  [unreachable]

tornado (https://github.com/tornadoweb/tornado)
+ tornado/util.py:294: error: Argument 1 to "issubclass" has incompatible type "type[Configurable] | None"; expected "type"  [arg-type]
+ tornado/httputil.py:1024: error: Unsupported right operand type for in ("HTTPHeaders | None")  [operator]
+ tornado/httputil.py:1026: error: Value of type "HTTPHeaders | None" is not indexable  [index]
+ tornado/httputil.py:1037: error: Unsupported right operand type for in ("HTTPHeaders | None")  [operator]
+ tornado/httputil.py:1039: error: Value of type "HTTPHeaders | None" is not indexable  [index]
+ tornado/ioloop.py:172: error: Argument 1 to "issubclass" has incompatible type "str | type[Configurable] | None"; expected "type"  [arg-type]
+ tornado/iostream.py:521: error: Unsupported operand types for > ("int" and "None")  [operator]
+ tornado/iostream.py:521: note: Right operand is of type "int | None"
+ tornado/iostream.py:932: error: Unsupported operand types for > ("int" and "None")  [operator]
+ tornado/iostream.py:932: note: Right operand is of type "int | None"
+ tornado/web.py:699: error: Argument 2 to "search" has incompatible type "str | None"; expected "str"  [arg-type]

trio (https://github.com/python-trio/trio)
+ src/trio/_core/_run.py:1950: error: Item "None" of "Nursery | None" has no attribute "_closed"  [union-attr]
+ src/trio/testing/_raises_group.py:308: error: Argument 1 to "issubclass" has incompatible type "type[MatchE] | None"; expected "type"  [arg-type]
+ src/trio/_tests/test_exports.py:309: error: Unused "type: ignore[misc, explicit-any]" comment  [unused-ignore]
+ src/trio/_tests/test_exports.py:327: error: Unused "type: ignore" comment  [unused-ignore]

schemathesis (https://github.com/schemathesis/schemathesis)

... (truncated 278 lines) ...```

@piyush-003 piyush-003 closed this Jun 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

False positive redundant-expr, but only for if x and y:, not for if x: if y:

2 participants