-
Notifications
You must be signed in to change notification settings - Fork 631
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
Add UP
and FA
rules to ruff
#3155
base: main
Are you sure you want to change the base?
Conversation
"UP", # https://docs.astral.sh/ruff/rules/#pyupgrade-up | ||
"FA" # https://docs.astral.sh/ruff/rules/#flake8-future-annotations-fa |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those two are the additions from this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assuming otel does not make use of any types at runtime, this should be ok
@@ -34,8 +36,8 @@ class AiopgIntegration(DatabaseApiIntegration): | |||
async def wrapped_connection( | |||
self, | |||
connect_method: typing.Callable[..., typing.Any], | |||
args: typing.Tuple[typing.Any, typing.Any], | |||
kwargs: typing.Dict[typing.Any, typing.Any], | |||
args: tuple[typing.Any, typing.Any], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe next step would be to standardize typing imports (e.g. import typing; var: typing.Any
vs from typing import Any; var: Any
), and also how typing_extensions
should be used. I usually see two patterns:
- Unconditionally import from
typing_extensions
if it is introduced in a newer Python version. We need to make sure these imports are updated whenever a Python version is dropped. - Define a typing compat module, where new typing constructs are conditionally imported from
typing
ortyping_extensions
. Easier to update when a Python version is dropped.
If people give me their thumbs up, I'm happy to rebase this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I love this
If any changelog is needed, please let me know. :) |
78526e4
to
be8ab2f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can start using .git-blame-ignore-revs for ruff changes that touches several files
be8ab2f
to
4a06c4d
Compare
To avoid misunderstandings like #3118, we can enforce the
from __future__ import annotations
.This PR only adds the rules and apply changes to pass the pipeline.