-
Notifications
You must be signed in to change notification settings - Fork 61
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
Fix documentation of models.circuit.Circuit
#1544
Conversation
src/qibo/models/circuit.py
Outdated
Example: | ||
.. testcode:: | ||
.. code-block:: python |
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.
Just to understand: was there any issue with the testcode
directive?
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.
testcode
does not display the code in the compiled documentation, leaving the example blank in the doc https://qibo.science/qibo/stable/api-reference/qibo.html#qibo.models.circuit.Circuit + all these different initializations are being tested in the regular tests anyway.
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.
Ok. I'm not sure why it is happening, since in principle even testcode
blocks should be shown, according to Sphinx
https://www.sphinx-doc.org/en/master/usage/extensions/doctest.html#directive-testcode
By default it is shown as a highlighted code block.
(there is an explicit attribute :hide:
to avoid showing it).
I wonder why... but a workaround is still better than an empty block. Thanks for the fix!
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1544 +/- ##
=======================================
Coverage 99.68% 99.68%
=======================================
Files 80 80
Lines 11607 11607
=======================================
Hits 11571 11571
Misses 36 36
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
src/qibo/models/circuit.py
Outdated
Example: | ||
.. testcode:: | ||
.. code-block:: python |
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.
In principle, you could replace this with:
Example::
The double colon is a short-cut in Sphinx for a code block, with the default syntax (which in our case, the default, it's just Python).
https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html#literal-blocks
Checklist: