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

Switch to f-strings using flynt. #13732

Merged
merged 1 commit into from
Jan 23, 2021
Merged

Switch to f-strings using flynt. #13732

merged 1 commit into from
Jan 23, 2021

Conversation

jmcarp
Copy link
Contributor

@jmcarp jmcarp commented Jan 18, 2021

Switch string formatting to f-strings consistently with flynt. We can also add flynt to ci if it would be useful. This will probably accumulate merge conflicts, but they should be easy to resolve.

@boring-cyborg boring-cyborg bot added area:API Airflow's REST/HTTP API area:CLI provider:cncf-kubernetes Kubernetes provider related issues area:logging provider:amazon AWS/Amazon - related issues labels Jan 18, 2021
@github-actions
Copy link

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*.

Copy link
Member

@turbaszek turbaszek left a 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 👌

@potiuk
Copy link
Member

potiuk commented Jan 18, 2021

Nice! That would also help with cases like the failure above - where both flynt and black would cooperate via pre-commits :).

@potiuk
Copy link
Member

potiuk commented Jan 18, 2021

Something like that would do in .pre-commit-config.yaml:

- id: flynt
  name: Convert to f-strings with flynt
  entry: flynt
  language: python
  language_version: python3
  additional_dependencies: ['flynt']
  files: \.py$

Copy link
Member

@XD-DENG XD-DENG left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

two nits.

@@ -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)}")
Copy link
Member

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?

@@ -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}"
Copy link
Member

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.

@github-actions
Copy link

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*.

@jmcarp jmcarp force-pushed the jmcarp/flynt branch 3 times, most recently from 0fc9ed5 to 25fa093 Compare January 19, 2021 05:27
@github-actions
Copy link

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*.

@jmcarp jmcarp marked this pull request as ready for review January 19, 2021 22:12
@jmcarp
Copy link
Contributor Author

jmcarp commented Jan 19, 2021

Ok, I added flynt to pre-commit and fixed nits from @XD-DENG.

Copy link
Member

@potiuk potiuk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fantastic! Thanks @jmcarp !

@jmcarp
Copy link
Contributor Author

jmcarp commented Jan 21, 2021

Thanks, should be good to merge with an approval from @XD-DENG!

Copy link
Member

@XD-DENG XD-DENG left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy to approve😉

@github-actions github-actions bot added the full tests needed We need to run full set of tests for this PR to merge label Jan 21, 2021
@github-actions
Copy link

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.

@github-actions
Copy link

The Workflow run is cancelling this PR. Building images for the PR has failed. Follow the the workflow link to check the reason.

@github-actions
Copy link

The Workflow run is cancelling this PR. Building images for the PR has failed. Follow the the workflow link to check the reason.

@github-actions
Copy link

The Workflow run is cancelling this PR. Building images for the PR has failed. Follow the the workflow link to check the reason.

@jmcarp
Copy link
Contributor Author

jmcarp commented Jan 23, 2021

Not sure what the ci failure is about. Is this safe to merge?

@potiuk
Copy link
Member

potiuk commented Jan 23, 2021

Looks unrelated (and likely random GitHub failure). Merging!

@potiuk potiuk merged commit a9ac2b0 into apache:master Jan 23, 2021
potiuk pushed a commit that referenced this pull request Mar 3, 2021
potiuk added a commit that referenced this pull request Mar 3, 2021
potiuk pushed a commit that referenced this pull request Mar 3, 2021
potiuk added a commit that referenced this pull request Mar 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:API Airflow's REST/HTTP API area:CLI area:logging full tests needed We need to run full set of tests for this PR to merge provider:amazon AWS/Amazon - related issues provider:cncf-kubernetes Kubernetes provider related issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants