Utility Functions
Documentation coming soon.
-
init.
debug_dump
(filename)
Dumps doctext for all cells in the circuit
-
init.
debug_viz
(filename)
Creates a dot file. To visualize a dot file you can use a free utility like
dot
which comes with the Graphviz package.
Dot
is invoked from your system’s command line like so:
$ dot -Tpng filename.dot -o outfile.png
For additional options, type: dot --help
-
init.
help_docs
()
Opens jupyter notebook documentation
-
init.
run_unit_test
(filename)
A special function for PyCell plugin. It is a shortcut to run PyCell
defined unit tests.
To run all:
>>> run_unit_test('test_all')
-
traceback_formatter.
pprint_tb
(etype, value, tb)
Pretty-prints tracebacks.
Example usage:
>>> pprint_tb(*sys.exc_info())
Profiler UI Elements
Coming Soon.
-
class
profiler.
ProfilerAssembler
(circuit)
Assembles a profiler window.
Variables: | circuit – The circuit to profile. |
Jupyter Notebooks
Coming Soon.
Docstring Provider
Property decorator for the __doc__
attribute. Useful for when you want
a custom docstring for class instances while still showing a generic docstring
for the class itself.
Source: http://bfroehle.com/2012/11/08/property-for-doc-attribute/
Usage:
>>> class A(object):
... '''Main docstring'''
... def __init__(self, x):
... self.x = x
... @docstring_property(__doc__)
... def __doc__(self):
... return "My value of x is %s." % self.x
>>> A.__doc__
'Main docstring'
>>> a = A(10)
>>> a.__doc__
'My value of x is 10.'
-
class
docstring_property.
DocstringProperty
(class_doc, fget)
Property for the __doc__
attribute.
Different than property
in the following two ways:
- When the attribute is accessed from the main class, it returns the value
of
class_doc
, not the property itself. This is necessary so
Sphinx and other documentation tools can access the class docstring.
- Only supports getting the attribute; setting and deleting raise an
AttributeError
.