condensed-class
The condensed-class directive renders a class’ public interface as a code block: the class line, its
class variables, its methods and its properties, each with the signature it is declared with, and ... for
a body.
The source is parsed, not imported. Annotations appear as they are written - Nullable[str], not the
Optional[str] an import resolves it to - members appear in the order of the file, and the file becomes a
dependency of the page, so editing the class rebuilds the page.
Left out is what the surrounding text is for: bodies, doc-strings, private members (one leading underscore), and the annotated fields of a slotted class.
.. condensed-class:: pyTooling.GenericPath.URL.Host
This is how the example renders - a class derived from a mixin, with its initializer, two read-only properties, a
method and __str__():
@export
class Host(RootMixin):
def __init__(self, hostname: str, port: Nullable[int] = None) -> None:
...
@readonly
def Hostname(self) -> str:
...
@readonly
def Port(self) -> Nullable[int]:
...
def __str__(self) -> str:
...
def Copy(self) -> Host:
...
- .. condensed-class:: <dotted name of a class>
Renders the interface of the class the argument names. The longest prefix of the name that is a module is the module; the rest is the class, and may name a class nested in a class.
- :members: <kinds>
The kinds of member to render, separated by commas, in any case:
ClassVariables,Dunders,Methods,PropertiesorAll. Default:All.A property is a method decorated with
@property,@readonly,@cached_propertyor as a setter or deleter; a dunder is a method named__<name>__.
- :exclude-members: <names>
Names of methods not to render, separated by commas.
- :indent: <columns>
Width of one indentation level. Default: 2.
- :width: <columns>
Column a signature is wrapped at, one parameter per line. Default: 100.
- :caption: <text>
A caption for the code block.