-
Notifications
You must be signed in to change notification settings - Fork 14.6k
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
Switch to f-strings using flynt. #13732
Conversation
The Workflow run is cancelling this PR. It has some failed jobs matching ^Pylint$,^Static checks,^Build docs$,^Spell check docs$,^Backport packages$,^Provider packages,^Checks: Helm tests$,^Test OpenAPI*. |
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.
Looks good to me. I think it would be resonable to have something on CI that would help us avoid regression 👌
Nice! That would also help with cases like the failure above - where both flynt and black would cooperate via pre-commits :). |
Something like that would do in
|
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.
two nits.
airflow/cli/commands/dag_command.py
Outdated
@@ -166,7 +166,7 @@ def set_is_paused(is_paused, args): | |||
is_paused=is_paused, | |||
) | |||
|
|||
print("Dag: {}, paused: {}".format(args.dag_id, str(is_paused))) | |||
print(f"Dag: {args.dag_id}, paused: {str(is_paused)}") |
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.
nit: the str()
can be removed?
airflow/models/dag.py
Outdated
@@ -1538,7 +1538,7 @@ def pickle_info(self): | |||
dttm = timezone.utcnow() | |||
pickled = pickle.dumps(self) | |||
d['pickle_len'] = len(pickled) | |||
d['pickling_duration'] = "{}".format(timezone.utcnow() - dttm) | |||
d['pickling_duration'] = f"{timezone.utcnow() - dttm}" |
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.
Here using str(timezone.utcnow() - dttm})
may make more sense than f"{timezone.utcnow() - dttm}" IMO, given it's purely a type conversion rather than formating.
The Workflow run is cancelling this PR. It has some failed jobs matching ^Pylint$,^Static checks,^Build docs$,^Spell check docs$,^Backport packages$,^Provider packages,^Checks: Helm tests$,^Test OpenAPI*. |
0fc9ed5
to
25fa093
Compare
The Workflow run is cancelling this PR. It has some failed jobs matching ^Pylint$,^Static checks,^Build docs$,^Spell check docs$,^Backport packages$,^Provider packages,^Checks: Helm tests$,^Test OpenAPI*. |
Ok, I added flynt to pre-commit and fixed nits from @XD-DENG. |
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.
Fantastic! Thanks @jmcarp !
Thanks, should be good to merge with an approval from @XD-DENG! |
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.
Happy to approve😉
The PR most likely needs to run full matrix of tests because it modifies parts of the core of Airflow. However, committers might decide to merge it quickly and take the risk. If they don't merge it quickly - please rebase it to the latest master at your convenience, or amend the last commit of the PR, and push it with --force-with-lease. |
The Workflow run is cancelling this PR. Building images for the PR has failed. Follow the the workflow link to check the reason. |
The Workflow run is cancelling this PR. Building images for the PR has failed. Follow the the workflow link to check the reason. |
The Workflow run is cancelling this PR. Building images for the PR has failed. Follow the the workflow link to check the reason. |
Not sure what the ci failure is about. Is this safe to merge? |
Looks unrelated (and likely random GitHub failure). Merging! |
(cherry picked from commit a9ac2b0)
(cherry picked from commit a9ac2b0)
Switch string formatting to f-strings consistently with
flynt
. We can also addflynt
to ci if it would be useful. This will probably accumulate merge conflicts, but they should be easy to resolve.