Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TCH001 false positive in Ruff 0.0.281 #6233

Closed
flying-sheep opened this issue Aug 1, 2023 · 4 comments
Closed

TCH001 false positive in Ruff 0.0.281 #6233

flying-sheep opened this issue Aug 1, 2023 · 4 comments

Comments

@flying-sheep
Copy link
Contributor

flying-sheep commented Aug 1, 2023

When updating to Ruff 0.0.281, the following started falsely throwing TCH001:

playground 1 | playground 2

"""test."""

from __future__ import annotations

from typing import TYPE_CHECKING

from ._support import supported_r_matrix_classes

if TYPE_CHECKING:
    from scipy import sparse


__all__ = [
    "tocsr",
    "supported_r_matrix_classes",
]


def tocsr(obj: sparse.spmatrix) -> sparse.csr_matrix:
    """test."""
    return obj.to_csr()
    from ._support import supported_r_matrix_classes
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^
TCH001: Move application import `._support.supported_r_matrix_classes` into a type-checking block
@mkniewallner
Copy link
Contributor

mkniewallner commented Aug 1, 2023

Probably the same underlying issue as #6207, which should be fixed by #6208.

@flying-sheep
Copy link
Contributor Author

indeed, duplicate of #6207

@flying-sheep flying-sheep closed this as not planned Won't fix, can't repro, duplicate, stale Aug 1, 2023
@charliermarsh
Copy link
Member

This should be fixed in v0.0.282, which is out now.

@charliermarsh
Copy link
Member

I'm also going to add Poetry to our ecosystem CI checks, to prevent future regressions.

charliermarsh added a commit that referenced this issue Aug 1, 2023
Poetry in particular would be useful to avoid issues like
#6233.
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

No branches or pull requests

3 participants