-
Notifications
You must be signed in to change notification settings - Fork 118
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
Class docs #801
base: main
Are you sure you want to change the base?
Class docs #801
Conversation
…on-braket-sdk-python into feature/gate_docstrings
Co-authored-by: Ryan Shaffer <[email protected]>
This reverts commit 759f745.
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## feature/gate_docstrings #801 +/- ##
===========================================================
- Coverage 100.00% 99.98% -0.02%
===========================================================
Files 129 129
Lines 8372 8406 +34
Branches 1865 1901 +36
===========================================================
+ Hits 8372 8405 +33
- Partials 0 1 +1 ☔ View full report in Codecov by Sentry. |
@@ -49,13 +49,25 @@ | |||
""" | |||
To add a new gate: | |||
1. Implement the class and extend `Gate` | |||
2. Add a method with the `@circuit.subroutine(register=True)` decorator. Method name | |||
2. Add a method with the `@circuit.subroutine(register=True) | |||
@_prepend_docstring(__doc__)` decorator. Method name |
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.
Whoops this was an artifact of "select all", will fix
doc_string = source | ||
if arg_loc := source.find("\n Args:"): | ||
doc_string = source[:arg_loc] | ||
func.__doc__ = "\n".join([doc_string, func.__doc__]) |
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.
Will this allow the docstring to appear correctly in IDEs like VS Code?
Issue #, if available:
Description of changes:
Add class docstring to circuit subroutines
Testing done:
docs inspection
Merge Checklist
Put an
x
in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your pull request.General
Tests
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.