-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tidy up
pytket.circuit
API docs (#1178)
* don't clutter pytket.circuit docs by expanding submodules * change caption * use bysource order for autodoc * start using automethod for Circuit methods * fix typo * use autodoc typehints * Expand TOC for all pages * add some circuit properties * delete unused config settings * add another chunk of automethod boilerplate * finish adding circuit methods * add some notes on Circuit.add_gate * submodules -> classes * scrub ._tket from pytket.circuit docs source * remove more _tket * don't use sphinx_autodoc_typehints for now * remove non-existent Reset method * use submodules rather than classes * don't show binary info in pytket.circuit doc * remove typehints extension entirely * remove duplicate CV method * remove more duplicate methods * submodules -> classes * reorder circuit properties * remove duplicate properties * remove :special-members: and use automethod for __init__ etc * remove __hash__ * minor spacing edit * Revert "minor spacing edit" This reverts commit abe76a4. * add missing methods found by python script * use autoproperty for created_qubits and discarded_qubits * add script to check circuit methods and properties * fix typo * remove comment * fix spaxing and heading * consistent headings * remove some dunder methods from API docs * add __rshift__ dunder method back into the docs * add explanatory comments * remove spaces
- Loading branch information
Showing
4 changed files
with
424 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import inspect | ||
import re | ||
|
||
from pytket._tket.circuit import Circuit | ||
|
||
# This script is used to check that no methods or properties of | ||
# the Circuit class are left out in the circuit_class.rst file. | ||
|
||
with open("circuit_class.rst", "r", encoding="utf-8") as file: | ||
rst = file.read() | ||
|
||
in_methods = {p[0] for p in inspect.getmembers(Circuit)} | ||
pattern = re.compile(r"(?:\bautomethod\b|\bautoproperty\b):: (\w+)\n") | ||
in_docs = set(pattern.findall(rst)) | ||
missing = in_methods - in_docs | ||
print([s for s in missing if not s.startswith("_")]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.