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

Class docs #801

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open

Class docs #801

wants to merge 14 commits into from

Conversation

ajberdy
Copy link
Contributor

@ajberdy ajberdy commented Nov 15, 2023

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

  • I have added tests that prove my fix is effective or that my feature works (if appropriate)
  • I have checked that my tests are not configured for a specific region or account (if appropriate)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@ajberdy ajberdy requested a review from a team as a code owner November 15, 2023 00:11
Copy link

codecov bot commented Nov 15, 2023

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (759f745) 100.00% compared to head (1539c8f) 99.98%.

Files Patch % Lines
src/braket/circuits/gates.py 97.87% 0 Missing and 1 partial ⚠️
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.
📢 Have feedback on the report? Share it here.

@@ -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
Copy link
Contributor Author

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__])
Copy link
Contributor

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?

Base automatically changed from feature/gate_docstrings to main November 16, 2023 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants