pythonvisual-studio-codeairflow

How to ignore "unused expression" warning from Pylance when using bit-shift operator to compose relationships in airflow


I am currently developing Airflow DAGs using Python. I am using:

When I use the bit-shift operator to compose the relationships between different Operators, I have this warning in VSCode: Expression value is unused

Expression value is unused

I would like to keep type checking enabled in VSCode, but I don't want to see this warning for valid use cases like composing Airflow DAGs.

Is there a way to configure Pylance to suppress this specific warning for the bit-shift operator?

I tried to set a mypy.ini in my settings with the code below, it doesnt do anything.

[mypy]
warn_unused_ignores = False

The VSCode mypy extension settings look like:

Mypy extension settings

Can anyone help me figure out how to resolve this issue without disabling type checking entirely?


Solution

  • Try this in vs code settings.json:

    "python.analysis.diagnosticSeverityOverrides": {
            "reportUnusedExpression": "none"
    }