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

Format automatically covered lines with flynt #3786

Merged
merged 65 commits into from
Mar 10, 2021
Merged

Conversation

vtomole
Copy link
Collaborator

@vtomole vtomole commented Feb 11, 2021

Flynt: A tool to automatically convert old string literal formatting to f-strings

What I did was

$ pip install flynt
$ flynt .

This is the first half to #3804

@google-cla google-cla bot added the cla: yes Makes googlebot stop complaining. label Feb 11, 2021
@balopat
Copy link
Contributor

balopat commented Feb 11, 2021

Nice! I'm pro this change! The coverage misses are probably genuinely uncovered areas. I think we should write tests for them :)

@balopat
Copy link
Contributor

balopat commented Feb 11, 2021

So close:

************* cirq/ops/pauli_string.py (1 uncovered)
Line  990 is new or changed but not covered:          return False

Found 1 uncovered touched lines.

:)

@vtomole
Copy link
Collaborator Author

vtomole commented Feb 11, 2021

@balopat ahhh!!!

@vtomole
Copy link
Collaborator Author

vtomole commented Feb 11, 2021

@balopat That line might be unreachable and trying to refactor it so that it passes mypy is a time sink for me at the moment. We can merge this and i can look into that line later.

@vtomole
Copy link
Collaborator Author

vtomole commented Feb 12, 2021

@balopat Ping for your thoughts.

@dabacon
Copy link
Collaborator

dabacon commented Feb 13, 2021

This is f-ing awesome.

@balopat
Copy link
Contributor

balopat commented Feb 13, 2021

This is f-ing awesome.

lol.

regarding my thoughts: I think we can just retry the flynt, and revert the problematic files with no coverage. Then we can open an issue to finalize the flynt conversion on those files as well and fix the coverage.

@vtomole vtomole changed the title [TESTING]: Formatting with flynt Format automatically covered lines with flynt Feb 13, 2021
Copy link
Contributor

@balopat balopat left a comment

Choose a reason for hiding this comment

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

LGTM

@balopat balopat added the automerge Tells CirqBot to sync and merge this PR. (If it's running.) label Mar 10, 2021
@CirqBot CirqBot added the front_of_queue_automerge CirqBot uses this label to indicate (and remember) what's being merged next. label Mar 10, 2021
@CirqBot
Copy link
Collaborator

CirqBot commented Mar 10, 2021

Automerge cancelled: A required status check is not present.

Missing statuses: ['cla/google']

@CirqBot CirqBot removed automerge Tells CirqBot to sync and merge this PR. (If it's running.) front_of_queue_automerge CirqBot uses this label to indicate (and remember) what's being merged next. labels Mar 10, 2021
@balopat balopat added the automerge Tells CirqBot to sync and merge this PR. (If it's running.) label Mar 10, 2021
@CirqBot CirqBot added the front_of_queue_automerge CirqBot uses this label to indicate (and remember) what's being merged next. label Mar 10, 2021
@CirqBot
Copy link
Collaborator

CirqBot commented Mar 10, 2021

Automerge cancelled: A required status check is not present.

Missing statuses: ['cla/google']

1 similar comment
@CirqBot
Copy link
Collaborator

CirqBot commented Mar 10, 2021

Automerge cancelled: A required status check is not present.

Missing statuses: ['cla/google']

@CirqBot CirqBot removed automerge Tells CirqBot to sync and merge this PR. (If it's running.) front_of_queue_automerge CirqBot uses this label to indicate (and remember) what's being merged next. labels Mar 10, 2021
@balopat balopat added cla: yes Makes googlebot stop complaining. automerge Tells CirqBot to sync and merge this PR. (If it's running.) and removed cla: yes Makes googlebot stop complaining. labels Mar 10, 2021
@CirqBot CirqBot added the front_of_queue_automerge CirqBot uses this label to indicate (and remember) what's being merged next. label Mar 10, 2021
@CirqBot CirqBot merged commit 7a335e3 into quantumlib:master Mar 10, 2021
@CirqBot CirqBot removed automerge Tells CirqBot to sync and merge this PR. (If it's running.) front_of_queue_automerge CirqBot uses this label to indicate (and remember) what's being merged next. labels Mar 10, 2021
@95-martin-orion
Copy link
Collaborator

Should we broadcast this change to cirq-dev? I imagine the new CI behavior will cause more than a few PRs to fail checks.

@balopat
Copy link
Contributor

balopat commented Mar 10, 2021

Should we broadcast this change to cirq-dev? I imagine the new CI behavior will cause more than a few PRs to fail checks.

Yeah, that's a good idea - I sent out a note!

@mpharrigan
Copy link
Collaborator

check/format-incremental now takes ~8 seconds instead of ~1 second

It also puts a little promotional message each time

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
Please run your tests before committing. Did flynt get a perfect conversion? give it a star at:
~ https://github.com/ikamensh/flynt ~
Thank you for using flynt. Upgrade more projects and recommend it to your colleagues!

@balopat
Copy link
Contributor

balopat commented Mar 10, 2021

Can you open an issue please @mpharrigan? These are valid points and probably could be worked out.

@mpharrigan
Copy link
Collaborator

opened #3901

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Makes googlebot stop complaining.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants