-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
UP035 vs. flake8-pep585 #3388
Comments
Yeah we seem to be missing some of these. Let me audit the list... |
Okay so...
This we're missing, I'm adding them (same with
We're missing these, I think because they're not "straight" replacements (you have to change the usages too, e.g., from
I think we actually do catch this one, at least in my testing.
These are covered by a different rule ( |
Thanks for the quick heads up! It makes sense that the ones with different names will be harder to fix. Also makes perfect sense that the
I saw it was listed in Ruff's code, but it does not seem to work if it's imported along others: $ echo 'from typing import Callable' >| test.py
$ ruff --isolated --select UP --target-version py39 test.py
$ echo 'from typing import Callable, Container' >| test.py
$ ruff --isolated --select UP --target-version py39 test.py
test.py:1:1: UP035 [*] Import from `collections.abc` instead: `Container`
Found 1 error.
[*] 1 potentially fixable with the --fix option. |
Oh interesting, lemme look into that... |
Ruff has that noted as a Python 3.10+ thing. |
Ahh right, it's because that change was made in Python 3.9.2 (https://stackoverflow.com/questions/65858528/is-collections-abc-callable-bugged-in-python-3-9-1), so |
(Will add those remaining deprecation rules tomorrow, I have a PR in progress.) |
See #2690 |
I'm a few days delayed on this (clearly) but still plan on adding these. |
Hi. Thanks a lot for working on this.
I see you even worked on these to be part of UP035! ☝️ 🎉 I double checked the test.py file with ruff 0.0.255 and I found a couple still not reported compared to flake8-pep585:
As far as I checked, these are present on Python 3.9.0. |
Oof, let me take one more look, thank you. |
This time I actually looked through the list at https://peps.python.org/pep-0585/#implementation. |
Cool! Thank you for the patience over this. |
Hi! 👋
First thank you for such amazing project, caching up so fast with almost all that has been done for Python linting so far.
I use flake8 with flake8-pep585 and noticed that Ruff's UP035 implementation yields incomplete results comparing to that. I'm using py39 as the target version in both flake8 and Ruff. I didn't compare it with pyupgrade, which I know is the reference implementation.
test.py
Minimal code snipped that reproduces the bug:
Ruff output
The command I've invoked:
ruff --isolated --select UP --target-version py39 test.py
ruff --version
flake8-pep585 output
Besides failing with the same as Ruff's UP035 above, flake8-pep585 also reports:
These are all mentioned under https://peps.python.org/pep-0585/#implementation and here's the flake8-pep585 implementation: https://github.com/decorator-factory/flake8-pep585/blob/master/flake8_pep585/rules.py
The text was updated successfully, but these errors were encountered: