[Python] How to ignore "unused expression" warning from Pylance when using bit-shift operator...

Discussão em 'Python' iniciado por Stack, Agosto 5, 2025.

  1. Stack

    Stack Membro Participativo

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

    • Mypy version: 1.8.0
    • Python version: 3.11.9
    • VSCode version: 1.92.2
    • Pylance version: v2024.8.2

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

    [​IMG]

    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:

    [​IMG]

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

    Continue reading...

Compartilhe esta Página