Skip to content

Conversation

@rawwar
Copy link
Contributor

@rawwar rawwar commented Oct 13, 2024

pre-commit run --all-files on main results in following error for "Run mypy for airflow"

task_sdk/tests/conftest.py:26: error: Incompatible types in assignment
(expression has type "tuple[()]", target has type "Union[str, list[str]]") 
[assignment]
        config.inicfg["airflow_deprecations_ignore"] = ()
                                                       ^~

I noticed, in other places, assignment for config.inicfg has the ignore comment -

config.inicfg["airflow_deprecations_ignore"] = (

@potiuk
Copy link
Member

potiuk commented Oct 14, 2024

Actually the error you get is CAUSED by using "". It should be []

The error is caused by this line:

        if isinstance(deprecations_ignore, (str, os.PathLike)):
            self.deprecations_ignore = [deprecations_ignore]

Which turns the "" into a single-element array with empty string.

Co-authored-by: Jarek Potiuk <jarek@potiuk.com>
@potiuk potiuk merged commit baa87b6 into apache:main Oct 14, 2024
@potiuk
Copy link
Member

potiuk commented Oct 14, 2024

Solved :)

@rawwar rawwar deleted the kalyan/refactor/fix_mypy_conftest branch October 14, 2024 09:24
@kaxil
Copy link
Member

kaxil commented Oct 14, 2024

Nice

R7L208 pushed a commit to R7L208/airflow that referenced this pull request Oct 17, 2024
* fix mypy error

* Apply suggestions from code review

* Update conftest.py

Co-authored-by: Jarek Potiuk <jarek@potiuk.com>

---------

Co-authored-by: Kaxil Naik <kaxilnaik@gmail.com>
Co-authored-by: Jarek Potiuk <jarek@potiuk.com>
harjeevanmaan pushed a commit to harjeevanmaan/airflow that referenced this pull request Oct 23, 2024
* fix mypy error

* Apply suggestions from code review

* Update conftest.py

Co-authored-by: Jarek Potiuk <jarek@potiuk.com>

---------

Co-authored-by: Kaxil Naik <kaxilnaik@gmail.com>
Co-authored-by: Jarek Potiuk <jarek@potiuk.com>
PaulKobow7536 pushed a commit to PaulKobow7536/airflow that referenced this pull request Oct 24, 2024
* fix mypy error

* Apply suggestions from code review

* Update conftest.py

Co-authored-by: Jarek Potiuk <jarek@potiuk.com>

---------

Co-authored-by: Kaxil Naik <kaxilnaik@gmail.com>
Co-authored-by: Jarek Potiuk <jarek@potiuk.com>
ellisms pushed a commit to ellisms/airflow that referenced this pull request Nov 13, 2024
* fix mypy error

* Apply suggestions from code review

* Update conftest.py

Co-authored-by: Jarek Potiuk <jarek@potiuk.com>

---------

Co-authored-by: Kaxil Naik <kaxilnaik@gmail.com>
Co-authored-by: Jarek Potiuk <jarek@potiuk.com>
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.

3 participants