Step#

Qualified name: rsm.nodes.Step

class rsm.nodes.Step(title='', **kwargs)[source]#

Bases: Paragraph

Methods

Attributes

autonumber

Whether to automatically assign a number to this node during transform step.

possible_parents

Allowed types of parent Nodes.

autonumber: ClassVar[bool] = True[source]#

Whether to automatically assign a number to this node during transform step.

Examples

>>> msc, thm1, thm2 = nodes.Manuscript(), nodes.Theorem(), nodes.Theorem()
>>> (thm1.number, thm2.number) == (None, None)
True
>>> tform = rsm.transformer.Transformer()
>>> tform.transform(msc.append([thm1, thm2]))  
>>> thm1.number, thm2.number
(1, 2)
possible_parents: ClassVar[set[Type[rsm.nodes.NodeWithChildren]]] = {<class 'rsm.nodes.Subproof'>, <class 'rsm.nodes.Proof'>, <class 'rsm.nodes.Step'>}[source]#

Allowed types of parent Nodes.

When setting the parent of a Node, this attribute is checked to see whether the intended parent has an admissible type.

Examples

This is a class variable

>>> nodes.Item.possible_parents == {nodes.Itemize, nodes.Enumerate, nodes.Contents}
True

This variable is checked when setting the parent directly.

>>> it = nodes.Item()
>>> it.parent = nodes.Paragraph()
Traceback (most recent call last):
rsm.nodes.RSMNodeError: Node of type <class 'rsm.nodes.Item'> cannot have parent of type <class 'rsm.nodes.Paragraph'>

This is also used when setting the parent in some other indirect way, for example when calling append() on the desired parent.

>>> nodes.Paragraph().append(it)
Traceback (most recent call last):
rsm.nodes.RSMNodeError: Node of type <class 'rsm.nodes.Item'> cannot have parent of type <class 'rsm.nodes.Paragraph'>

Allowed parents proceed without raising.

>>> nodes.Itemize().append(it)
Itemize(parent=None, [Item])