Skip to content

Conversation

@yunchipang
Copy link
Contributor

related: #53395

warning:

providers/common/compat/src/airflow/providers/common/compat/openlineage/check.py:56: error:
Right operand of "and" is never evaluated  [unreachable]
        if callable(provider_min_version) and client_min_version is None:

problematic condition:

if callable(provider_min_version) and client_min_version is None:

this is because in original function signature:

def require_openlineage_version(
    provider_min_version: str | None = None, 
    client_min_version: str | None = None
):

this tells mypy that provider_min_version could only be a string or None (never a callable), which in the problematic condition, makes callable(provider_min_version) always false, which makes right side of the and operand, i.e. client_min_version is None, unreachable.

fix: update the type annotation to allow provider_min_version to be a string, None, or any other type (including callables).


^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in airflow-core/newsfragments.

@yunchipang yunchipang force-pushed the 53395-fix-mypy-unreachable-warnings-in-common-compat branch from 0d21704 to bc62d56 Compare July 20, 2025 19:58
@potiuk potiuk merged commit eee0c62 into apache:main Jul 20, 2025
75 checks passed
@yunchipang yunchipang deleted the 53395-fix-mypy-unreachable-warnings-in-common-compat branch July 20, 2025 21:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants