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

Add docstyle rule to the linter and subsequent refactor. #4311

Merged
merged 2 commits into from
Jul 14, 2021

Conversation

thanacles
Copy link

@thanacles thanacles commented Jul 10, 2021

Associated to: #3388

Added the docstyle linter and refactored trivial pydocs. If the refactor wasn't trivial I just disable the rule for the pydoc.

We'll need to add the docparams plugin in a later PR.

@thanacles thanacles requested a review from tanujkhattar July 10, 2021 19:31
@google-cla google-cla bot added the cla: yes Makes googlebot stop complaining. label Jul 10, 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.

Awesome!

I added places where the summary line doesn't follow the style guide (I wish the linter would catch that!):

https://google.github.io/styleguide/pyguide.html#381-docstrings - "...A docstring should be organized as a summary line (one physical line not exceeding 80 characters) terminated by a period, question mark, or exclamation point..."

examples/qubit_characterizations_example.py Outdated Show resolved Hide resolved
examples/quantum_fourier_transform.py Outdated Show resolved Hide resolved
examples/hhl.py Outdated Show resolved Hide resolved
examples/hhl.py Outdated Show resolved Hide resolved
examples/hhl.py Outdated Show resolved Hide resolved
@@ -190,8 +184,7 @@ def validate_operation(self, operation: ops.Operation):
raise ValueError("Bad number of XY gates in parallel")

def validate_moment(self, moment: ops.Moment):
"""
Raises an error if the given moment is invalid on this device
"""Raises an error if the given moment is invalid on this device
Copy link
Contributor

Choose a reason for hiding this comment

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

fix summary line, add Raises: instead

Copy link
Author

Choose a reason for hiding this comment

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

ditto

cirq-core/cirq/contrib/acquaintance/strategies/complete.py Outdated Show resolved Hide resolved
cirq-core/cirq/contrib/acquaintance/mutation_utils.py Outdated Show resolved Hide resolved
@balopat balopat self-assigned this Jul 13, 2021
@thanacles
Copy link
Author

Thanks @balopat . Since this is such a big change, I'm trying to keep all my changes trivial. For the non-trivial cases, what do you think about me adding a TODO to update the docstring with a summary line?

@balopat
Copy link
Contributor

balopat commented Jul 13, 2021

Thanks @balopat . Since this is such a big change, I'm trying to keep all my changes trivial. For the non-trivial cases, what do you think about me adding a TODO to update the docstring with a summary line?

Sounds good to me. A TODO + disabling pylint is better than a bad update.

@thanacles thanacles force-pushed the issue3388_2 branch 3 times, most recently from 3797b35 to 683e2be Compare July 13, 2021 19:31
@thanacles
Copy link
Author

thanacles commented Jul 13, 2021

@balopat Thanks again for bearing with me. I think this lint rule will be nice once it's running. I've taken care of your suggestions, take a look.

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 removed the cla: yes Makes googlebot stop complaining. label Jul 14, 2021
@google-cla google-cla bot added the cla: yes Makes googlebot stop complaining. label Jul 14, 2021
@balopat balopat added the automerge Tells CirqBot to sync and merge this PR. (If it's running.) label Jul 14, 2021
@CirqBot CirqBot added the front_of_queue_automerge CirqBot uses this label to indicate (and remember) what's being merged next. label Jul 14, 2021
@CirqBot CirqBot merged commit d624a55 into quantumlib:master Jul 14, 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 Jul 14, 2021
rht pushed a commit to rht/Cirq that referenced this pull request May 1, 2023
…4311)

Associated to: quantumlib#3388

Added the docstyle linter and refactored trivial pydocs.  If the refactor wasn't trivial I just disable the rule for the pydoc.

We'll need to add the docparams plugin in a later PR.
harry-phasecraft pushed a commit to PhaseCraft/Cirq that referenced this pull request Oct 31, 2024
…4311)

Associated to: quantumlib#3388

Added the docstyle linter and refactored trivial pydocs.  If the refactor wasn't trivial I just disable the rule for the pydoc.

We'll need to add the docparams plugin in a later PR.
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.

3 participants