2024-03-31 22:38:38 +02:00
<!DOCTYPE html>
2024-04-07 17:00:29 +02:00
< html class = "writer-html5" lang = "en" data-content_root = "../" >
< head >
< meta charset = "utf-8" / >
< meta name = "viewport" content = "width=device-width, initial-scale=1.0" / >
< title > pynodes — pynodes 0.1 documentation< / title >
< link rel = "stylesheet" type = "text/css" href = "../_static/pygments.css?v=80d5e7a1" / >
< link rel = "stylesheet" type = "text/css" href = "../_static/css/theme.css?v=19f00094" / >
2024-03-31 22:38:38 +02:00
2024-04-07 17:00:29 +02:00
<!-- [if lt IE 9]>
< script src = "../_static/js/html5shiv.min.js" > < / script >
<![endif]-->
2024-03-31 22:38:38 +02:00
2024-04-07 17:00:29 +02:00
< script src = "../_static/documentation_options.js?v=2709fde1" > < / script >
< script src = "../_static/doctools.js?v=888ff710" > < / script >
< script src = "../_static/sphinx_highlight.js?v=dc90522c" > < / script >
< script src = "../_static/js/theme.js" > < / script >
< link rel = "index" title = "Index" href = "../genindex.html" / >
< link rel = "search" title = "Search" href = "../search.html" / >
< / head >
2024-03-31 22:38:38 +02:00
2024-04-07 17:00:29 +02:00
< body class = "wy-body-for-nav" >
< div class = "wy-grid-for-nav" >
< nav data-toggle = "wy-nav-shift" class = "wy-nav-side" >
< div class = "wy-side-scroll" >
< div class = "wy-side-nav-search" >
2024-03-31 22:38:38 +02:00
2024-04-07 17:00:29 +02:00
< a href = "../index.html" class = "icon icon-home" >
pynodes
< / a >
< div role = "search" >
< form id = "rtd-search-form" class = "wy-form" action = "../search.html" method = "get" >
< input type = "text" name = "q" placeholder = "Search docs" aria-label = "Search docs" / >
< input type = "hidden" name = "check_keywords" value = "yes" / >
< input type = "hidden" name = "area" value = "default" / >
< / form >
< / div >
< / div > < div class = "wy-menu wy-menu-vertical" data-spy = "affix" role = "navigation" aria-label = "Navigation menu" >
< ul >
< li class = "toctree-l1" > < a class = "reference internal" href = "../api.html" > API< / a > < / li >
< / ul >
2024-03-31 22:38:38 +02:00
2024-04-07 17:00:29 +02:00
< / div >
< / div >
< / nav >
< section data-toggle = "wy-nav-shift" class = "wy-nav-content-wrap" > < nav class = "wy-nav-top" aria-label = "Mobile navigation menu" >
< i data-toggle = "wy-nav-top" class = "fa fa-bars" > < / i >
< a href = "../index.html" > pynodes< / a >
< / nav >
< div class = "wy-nav-content" >
< div class = "rst-content" >
< div role = "navigation" aria-label = "Page navigation" >
< ul class = "wy-breadcrumbs" >
< li > < a href = "../index.html" class = "icon icon-home" aria-label = "Home" > < / a > < / li >
< li class = "breadcrumb-item" > < a href = "index.html" > Module code< / a > < / li >
< li class = "breadcrumb-item active" > pynodes< / li >
< li class = "wy-breadcrumbs-aside" >
< / li >
< / ul >
< hr / >
< / div >
< div role = "main" class = "document" itemscope = "itemscope" itemtype = "http://schema.org/Article" >
< div itemprop = "articleBody" >
2024-03-31 22:38:38 +02:00
< h1 > Source code for pynodes< / h1 > < div class = "highlight" > < pre >
< span > < / span > < span class = "kn" > from< / span > < span class = "nn" > __future__< / span > < span class = "kn" > import< / span > < span class = "n" > annotations< / span > < span class = "c1" > # for Class forward reference< / span >
< span class = "kn" > import< / span > < span class = "nn" > random< / span >
2024-04-07 17:00:29 +02:00
< span class = "kn" > import< / span > < span class = "nn" > uuid< / span >
2024-03-31 22:38:38 +02:00
< span class = "kn" > from< / span > < span class = "nn" > typing< / span > < span class = "kn" > import< / span > < span class = "n" > ClassVar< / span >
< div class = "viewcode-block" id = "Node" >
2024-04-07 17:00:29 +02:00
< a class = "viewcode-back" href = "../api.html#pynodes.Node" > [docs]< / a >
2024-03-31 22:38:38 +02:00
< span class = "k" > class< / span > < span class = "nc" > Node< / span > < span class = "p" > :< / span >
< span class = "w" > < / span > < span class = "sd" > " " " < / span >
< span class = "sd" > Should be subclassed only< / span >
< span class = "sd" > " " " < / span >
< span class = "c1" > # Class Var for statistics< / span >
< span class = "n" > deepest_level< / span > < span class = "p" > :< / span > < span class = "n" > ClassVar< / span > < span class = "p" > [< / span > < span class = "nb" > int< / span > < span class = "p" > ]< / span > < span class = "o" > =< / span > < span class = "mi" > 0< / span >
< span class = "n" > largest_sibling_number< / span > < span class = "p" > :< / span > < span class = "n" > ClassVar< / span > < span class = "p" > [< / span > < span class = "nb" > int< / span > < span class = "p" > ]< / span > < span class = "o" > =< / span > < span class = "mi" > 0< / span >
< span class = "n" > all_nodes< / span > < span class = "p" > :< / span > < span class = "n" > ClassVar< / span > < span class = "p" > [< / span > < span class = "nb" > list< / span > < span class = "p" > [< / span > < span class = "n" > Node< / span > < span class = "p" > ]]< / span > < span class = "o" > =< / span > < span class = "p" > []< / span >
< span class = "k" > def< / span > < span class = "nf" > __init_subclass__< / span > < span class = "p" > (< / span > < span class = "bp" > cls< / span > < span class = "p" > ):< / span >
< span class = "w" > < / span > < span class = "sd" > " " " each subclass must define its own ClassVar " " " < / span >
< span class = "c1" > # TODO to be renamed for clarity< / span >
< span class = "nb" > super< / span > < span class = "p" > ()< / span > < span class = "o" > .< / span > < span class = "n" > __init_subclass__< / span > < span class = "p" > ()< / span >
< span class = "bp" > cls< / span > < span class = "o" > .< / span > < span class = "n" > deepest_level< / span > < span class = "p" > :< / span > < span class = "n" > ClassVar< / span > < span class = "p" > [< / span > < span class = "nb" > int< / span > < span class = "p" > ]< / span > < span class = "o" > =< / span > < span class = "mi" > 0< / span >
< span class = "bp" > cls< / span > < span class = "o" > .< / span > < span class = "n" > largest_sibling_number< / span > < span class = "p" > :< / span > < span class = "n" > ClassVar< / span > < span class = "p" > [< / span > < span class = "nb" > int< / span > < span class = "p" > ]< / span > < span class = "o" > =< / span > < span class = "mi" > 0< / span >
< span class = "bp" > cls< / span > < span class = "o" > .< / span > < span class = "n" > all_nodes< / span > < span class = "p" > :< / span > < span class = "n" > ClassVar< / span > < span class = "p" > [< / span > < span class = "nb" > list< / span > < span class = "p" > [< / span > < span class = "n" > Node< / span > < span class = "p" > ]]< / span > < span class = "o" > =< / span > < span class = "p" > []< / span >
< span class = "k" > return< / span > < span class = "bp" > cls< / span >
< span class = "k" > def< / span > < span class = "fm" > __new__< / span > < span class = "p" > (< / span > < span class = "bp" > cls< / span > < span class = "p" > ,< / span > < span class = "n" > name< / span > < span class = "p" > :< / span > < span class = "nb" > str< / span > < span class = "p" > ,< / span > < span class = "n" > parent< / span > < span class = "p" > :< / span > < span class = "n" > Node< / span > < span class = "o" > |< / span > < span class = "kc" > None< / span > < span class = "o" > =< / span > < span class = "kc" > None< / span > < span class = "p" > )< / span > < span class = "o" > -> < / span > < span class = "kc" > None< / span > < span class = "p" > :< / span >
2024-04-07 17:00:29 +02:00
< span class = "w" > < / span > < span class = "sd" > " " " < / span >
< span class = "sd" > prevent the user to set the same name for 2 nodes< / span >
< span class = "sd" > ??? better to do it with uuid?< / span >
< span class = "sd" > " " " < / span >
2024-03-31 22:38:38 +02:00
< span class = "k" > for< / span > < span class = "n" > n< / span > < span class = "ow" > in< / span > < span class = "bp" > cls< / span > < span class = "o" > .< / span > < span class = "n" > all_nodes< / span > < span class = "p" > :< / span >
< span class = "k" > if< / span > < span class = "n" > name< / span > < span class = "o" > ==< / span > < span class = "n" > n< / span > < span class = "o" > .< / span > < span class = "n" > name< / span > < span class = "p" > :< / span >
2024-04-01 21:26:38 +02:00
< span class = "k" > raise< / span > < span class = "ne" > AttributeError< / span > < span class = "p" > (< / span > < span class = "s1" > ' Node with this name already exists' < / span > < span class = "p" > )< / span >
2024-03-31 22:38:38 +02:00
< span class = "k" > else< / span > < span class = "p" > :< / span >
< span class = "k" > return< / span > < span class = "nb" > super< / span > < span class = "p" > ()< / span > < span class = "o" > .< / span > < span class = "fm" > __new__< / span > < span class = "p" > (< / span > < span class = "bp" > cls< / span > < span class = "p" > )< / span >
< span class = "k" > def< / span > < span class = "fm" > __init__< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "p" > ,< / span > < span class = "n" > name< / span > < span class = "p" > :< / span > < span class = "nb" > str< / span > < span class = "p" > ,< / span > < span class = "n" > parent< / span > < span class = "p" > :< / span > < span class = "n" > Node< / span > < span class = "o" > |< / span > < span class = "kc" > None< / span > < span class = "o" > =< / span > < span class = "kc" > None< / span > < span class = "p" > )< / span > < span class = "o" > -> < / span > < span class = "kc" > None< / span > < span class = "p" > :< / span >
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > name< / span > < span class = "o" > =< / span > < span class = "n" > name< / span >
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > parent< / span > < span class = "o" > =< / span > < span class = "n" > parent< / span > < span class = "c1" > # is set with add_child< / span >
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > children< / span > < span class = "p" > :< / span > < span class = "nb" > list< / span > < span class = "p" > [< / span > < span class = "n" > Node< / span > < span class = "p" > ]< / span > < span class = "o" > =< / span > < span class = "p" > []< / span >
2024-04-07 17:00:29 +02:00
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > id< / span > < span class = "o" > =< / span > < span class = "n" > uuid< / span > < span class = "o" > .< / span > < span class = "n" > uuid4< / span > < span class = "p" > ()< / span >
2024-03-31 22:38:38 +02:00
< span class = "nb" > type< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "p" > )< / span > < span class = "o" > .< / span > < span class = "n" > all_nodes< / span > < span class = "o" > .< / span > < span class = "n" > append< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "p" > )< / span >
2024-04-01 21:26:38 +02:00
< div class = "viewcode-block" id = "Node.add_child" >
2024-04-07 17:00:29 +02:00
< a class = "viewcode-back" href = "../api.html#pynodes.Node.add_child" > [docs]< / a >
2024-04-01 21:26:38 +02:00
< span class = "k" > def< / span > < span class = "nf" > add_child< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "p" > ,< / span > < span class = "n" > child< / span > < span class = "p" > :< / span > < span class = "n" > Node< / span > < span class = "p" > )< / span > < span class = "o" > -> < / span > < span class = "kc" > None< / span > < span class = "p" > :< / span >
2024-04-09 21:03:48 +02:00
< span class = "w" > < / span > < span class = "sd" > " " " < / span >
< span class = "sd" > Add new child node to current instance< / span >
2024-04-07 17:00:29 +02:00
< span class = "sd" > :param child: Node object< / span >
< span class = "sd" > " " " < / span >
2024-04-01 21:26:38 +02:00
< span class = "n" > child< / span > < span class = "o" > .< / span > < span class = "n" > parent< / span > < span class = "o" > =< / span > < span class = "bp" > self< / span >
< span class = "k" > if< / span > < span class = "n" > child< / span > < span class = "o" > .< / span > < span class = "n" > name< / span > < span class = "ow" > not< / span > < span class = "ow" > in< / span > < span class = "p" > [< / span > < span class = "n" > c< / span > < span class = "o" > .< / span > < span class = "n" > name< / span > < span class = "k" > for< / span > < span class = "n" > c< / span > < span class = "ow" > in< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > children< / span > < span class = "p" > ]:< / span >
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > children< / span > < span class = "o" > .< / span > < span class = "n" > append< / span > < span class = "p" > (< / span > < span class = "n" > child< / span > < span class = "p" > )< / span >
< span class = "k" > if< / span > < span class = "n" > child< / span > < span class = "o" > .< / span > < span class = "n" > level< / span > < span class = "o" > > < / span > < span class = "nb" > type< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "p" > )< / span > < span class = "o" > .< / span > < span class = "n" > deepest_level< / span > < span class = "p" > :< / span >
< span class = "nb" > type< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "p" > )< / span > < span class = "o" > .< / span > < span class = "n" > deepest_level< / span > < span class = "o" > =< / span > < span class = "n" > child< / span > < span class = "o" > .< / span > < span class = "n" > level< / span >
< span class = "k" > if< / span > < span class = "nb" > len< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > children< / span > < span class = "p" > )< / span > < span class = "o" > > < / span > < span class = "nb" > type< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "p" > )< / span > < span class = "o" > .< / span > < span class = "n" > largest_sibling_number< / span > < span class = "p" > :< / span >
< span class = "nb" > type< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "p" > )< / span > < span class = "o" > .< / span > < span class = "n" > largest_sibling_number< / span > < span class = "o" > =< / span > < span class = "nb" > len< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > children< / span > < span class = "p" > )< / span >
< span class = "k" > else< / span > < span class = "p" > :< / span >
< span class = "k" > raise< / span > < span class = "ne" > Exception< / span > < span class = "p" > (< / span > < span class = "s1" > ' Child with same name already exists' < / span > < span class = "p" > )< / span > < / div >
2024-03-31 22:38:38 +02:00
< span class = "nd" > @property< / span >
< span class = "k" > def< / span > < span class = "nf" > siblings< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "p" > )< / span > < span class = "o" > -> < / span > < span class = "nb" > list< / span > < span class = "p" > [< / span > < span class = "n" > Node< / span > < span class = "p" > ]:< / span >
2024-04-09 21:03:48 +02:00
< span class = "w" > < / span > < span class = "sd" > " " " < / span >
< span class = "sd" > Returns all the siblings of the Node object< / span >
< span class = "sd" > " " " < / span >
2024-03-31 22:38:38 +02:00
< span class = "k" > if< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > has_siblings< / span > < span class = "p" > ():< / span >
< span class = "k" > return< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > parent< / span > < span class = "o" > .< / span > < span class = "n" > children< / span >
< span class = "nd" > @property< / span >
< span class = "k" > def< / span > < span class = "nf" > parents< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "p" > )< / span > < span class = "o" > -> < / span > < span class = "nb" > list< / span > < span class = "p" > [< / span > < span class = "n" > Node< / span > < span class = "p" > ]:< / span >
2024-04-09 21:03:48 +02:00
< span class = "w" > < / span > < span class = "sd" > " " " < / span >
< span class = "sd" > Returns all the ancestors of the Node object< / span >
< span class = "sd" > " " " < / span >
2024-03-31 22:38:38 +02:00
< span class = "n" > parents< / span > < span class = "o" > =< / span > < span class = "p" > []< / span >
< span class = "n" > p< / span > < span class = "o" > =< / span > < span class = "bp" > self< / span >
< span class = "k" > while< / span > < span class = "n" > p< / span > < span class = "o" > .< / span > < span class = "n" > has_parent< / span > < span class = "p" > ():< / span >
< span class = "n" > p< / span > < span class = "o" > =< / span > < span class = "n" > p< / span > < span class = "o" > .< / span > < span class = "n" > parent< / span >
< span class = "n" > parents< / span > < span class = "o" > .< / span > < span class = "n" > append< / span > < span class = "p" > (< / span > < span class = "n" > p< / span > < span class = "p" > )< / span >
< span class = "k" > return< / span > < span class = "n" > parents< / span >
< span class = "nd" > @property< / span >
< span class = "k" > def< / span > < span class = "nf" > level< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "p" > )< / span > < span class = "o" > -> < / span > < span class = "nb" > int< / span > < span class = "p" > :< / span >
2024-04-09 21:03:48 +02:00
< span class = "w" > < / span > < span class = "sd" > " " " < / span >
< span class = "sd" > Returns the level of the Node object< / span >
< span class = "sd" > " " " < / span >
2024-03-31 22:38:38 +02:00
< span class = "n" > level< / span > < span class = "o" > =< / span > < span class = "mi" > 0< / span >
< span class = "n" > p< / span > < span class = "o" > =< / span > < span class = "bp" > self< / span >
< span class = "k" > while< / span > < span class = "n" > p< / span > < span class = "o" > .< / span > < span class = "n" > has_parent< / span > < span class = "p" > ():< / span >
< span class = "n" > level< / span > < span class = "o" > +=< / span > < span class = "mi" > 1< / span >
< span class = "n" > p< / span > < span class = "o" > =< / span > < span class = "n" > p< / span > < span class = "o" > .< / span > < span class = "n" > parent< / span >
< span class = "k" > return< / span > < span class = "n" > level< / span >
< span class = "nd" > @property< / span >
< span class = "k" > def< / span > < span class = "nf" > path< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "p" > )< / span > < span class = "o" > -> < / span > < span class = "nb" > str< / span > < span class = "p" > :< / span >
< span class = "w" > < / span > < span class = "sd" > " " " < / span >
2024-04-09 21:03:48 +02:00
< span class = "sd" > Returns a representation of the ancestor lineage of self< / span >
2024-03-31 22:38:38 +02:00
< span class = "sd" > " " " < / span >
< span class = "n" > path< / span > < span class = "o" > =< / span > < span class = "s1" > ' ' < / span >
< span class = "k" > for< / span > < span class = "n" > p< / span > < span class = "ow" > in< / span > < span class = "nb" > reversed< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > parents< / span > < span class = "p" > ):< / span >
< span class = "n" > path< / span > < span class = "o" > +=< / span > < span class = "n" > p< / span > < span class = "o" > .< / span > < span class = "n" > name< / span > < span class = "o" > +< / span > < span class = "s1" > ' .' < / span >
< span class = "n" > path< / span > < span class = "o" > +=< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > name< / span >
< span class = "k" > return< / span > < span class = "n" > path< / span >
2024-04-01 21:26:38 +02:00
< div class = "viewcode-block" id = "Node.is_sibling" >
2024-04-07 17:00:29 +02:00
< a class = "viewcode-back" href = "../api.html#pynodes.Node.is_sibling" > [docs]< / a >
2024-03-31 22:38:38 +02:00
< span class = "k" > def< / span > < span class = "nf" > is_sibling< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "p" > ,< / span > < span class = "n" > other< / span > < span class = "p" > :< / span > < span class = "nb" > str< / span > < span class = "p" > )< / span > < span class = "o" > -> < / span > < span class = "nb" > bool< / span > < span class = "p" > :< / span >
2024-04-07 17:00:29 +02:00
< span class = "w" > < / span > < span class = "sd" > " " " < / span >
< span class = "sd" > Check if Node object is a sibling of the other Node object< / span >
< span class = "sd" > :param other: Other Node object to be compared with< / span >
< span class = "sd" > " " " < / span >
2024-03-31 22:38:38 +02:00
< span class = "k" > if< / span > < span class = "n" > other< / span > < span class = "ow" > in< / span > < span class = "p" > [< / span > < span class = "n" > s< / span > < span class = "o" > .< / span > < span class = "n" > name< / span > < span class = "k" > for< / span > < span class = "n" > s< / span > < span class = "ow" > in< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > siblings< / span > < span class = "p" > ]:< / span >
< span class = "k" > return< / span > < span class = "kc" > True< / span >
< span class = "k" > else< / span > < span class = "p" > :< / span >
2024-04-01 21:26:38 +02:00
< span class = "k" > return< / span > < span class = "kc" > False< / span > < / div >
2024-03-31 22:38:38 +02:00
2024-04-01 21:26:38 +02:00
< div class = "viewcode-block" id = "Node.is_child" >
2024-04-07 17:00:29 +02:00
< a class = "viewcode-back" href = "../api.html#pynodes.Node.is_child" > [docs]< / a >
2024-03-31 22:38:38 +02:00
< span class = "k" > def< / span > < span class = "nf" > is_child< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "p" > ,< / span > < span class = "n" > other< / span > < span class = "p" > :< / span > < span class = "nb" > str< / span > < span class = "p" > )< / span > < span class = "o" > -> < / span > < span class = "nb" > bool< / span > < span class = "p" > :< / span >
2024-04-09 21:03:48 +02:00
< span class = "w" > < / span > < span class = "sd" > " " " < / span >
< span class = "sd" > Check if Node object is a child of the other Node object< / span >
< span class = "sd" > " " " < / span >
2024-03-31 22:38:38 +02:00
< span class = "k" > if< / span > < span class = "n" > other< / span > < span class = "ow" > in< / span > < span class = "p" > [< / span > < span class = "n" > s< / span > < span class = "o" > .< / span > < span class = "n" > name< / span > < span class = "k" > for< / span > < span class = "n" > s< / span > < span class = "ow" > in< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > children< / span > < span class = "p" > ]:< / span >
< span class = "k" > return< / span > < span class = "kc" > True< / span >
< span class = "k" > else< / span > < span class = "p" > :< / span >
2024-04-01 21:26:38 +02:00
< span class = "k" > return< / span > < span class = "kc" > False< / span > < / div >
2024-03-31 22:38:38 +02:00
< div class = "viewcode-block" id = "Node.pretty_print" >
2024-04-07 17:00:29 +02:00
< a class = "viewcode-back" href = "../api.html#pynodes.Node.pretty_print" > [docs]< / a >
< span class = "k" > def< / span > < span class = "nf" > pretty_print< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "p" > ,< / span > < span class = "n" > option< / span > < span class = "p" > :< / span > < span class = "nb" > str< / span > < span class = "o" > =< / span > < span class = "s1" > ' default' < / span > < span class = "p" > )< / span > < span class = "o" > -> < / span > < span class = "kc" > None< / span > < span class = "p" > :< / span >
2024-04-09 21:03:48 +02:00
< span class = "w" > < / span > < span class = "sd" > " " " < / span >
< span class = "sd" > Print children tree from current instance< / span >
< span class = "sd" > " " " < / span >
2024-03-31 22:38:38 +02:00
< span class = "n" > dashes< / span > < span class = "o" > =< / span > < span class = "s1" > ' ' < / span > < span class = "o" > *< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > level< / span > < span class = "o" > +< / span > < span class = "s1" > ' |' < / span > < span class = "o" > +< / span > < span class = "s1" > ' --' < / span > < span class = "o" > *< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > level< / span > < span class = "o" > +< / span > < span class = "s1" > ' ' < / span >
2024-04-07 17:00:29 +02:00
< span class = "k" > if< / span > < span class = "n" > option< / span > < span class = "o" > ==< / span > < span class = "s1" > ' id' < / span > < span class = "p" > :< / span >
< span class = "n" > dashes< / span > < span class = "o" > +=< / span > < span class = "sa" > f< / span > < span class = "s1" > ' [< / span > < span class = "si" > {< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > id< / span > < span class = "si" > }< / span > < span class = "s1" > ] ' < / span >
2024-03-31 22:38:38 +02:00
< span class = "nb" > print< / span > < span class = "p" > (< / span > < span class = "sa" > f< / span > < span class = "s1" > ' < / span > < span class = "si" > {< / span > < span class = "n" > dashes< / span > < span class = "si" > }{< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > name< / span > < span class = "si" > }< / span > < span class = "s1" > ' < / span > < span class = "p" > )< / span >
< span class = "k" > for< / span > < span class = "n" > c< / span > < span class = "ow" > in< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > children< / span > < span class = "p" > :< / span >
2024-04-07 17:00:29 +02:00
< span class = "n" > c< / span > < span class = "o" > .< / span > < span class = "n" > pretty_print< / span > < span class = "p" > (< / span > < span class = "n" > option< / span > < span class = "p" > )< / span > < / div >
2024-03-31 22:38:38 +02:00
2024-04-01 21:26:38 +02:00
< div class = "viewcode-block" id = "Node.has_parent" >
2024-04-07 17:00:29 +02:00
< a class = "viewcode-back" href = "../api.html#pynodes.Node.has_parent" > [docs]< / a >
2024-03-31 22:38:38 +02:00
< span class = "k" > def< / span > < span class = "nf" > has_parent< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "p" > )< / span > < span class = "o" > -> < / span > < span class = "nb" > bool< / span > < span class = "p" > :< / span >
2024-04-01 21:26:38 +02:00
< span class = "w" > < / span > < span class = "sd" > " " " check if Node object has a parent or not " " " < / span >
2024-03-31 22:38:38 +02:00
< span class = "k" > if< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > parent< / span > < span class = "ow" > is< / span > < span class = "ow" > not< / span > < span class = "kc" > None< / span > < span class = "p" > :< / span >
< span class = "k" > return< / span > < span class = "kc" > True< / span >
2024-04-01 21:26:38 +02:00
< span class = "k" > return< / span > < span class = "kc" > False< / span > < / div >
2024-03-31 22:38:38 +02:00
2024-04-01 21:26:38 +02:00
< div class = "viewcode-block" id = "Node.has_children" >
2024-04-07 17:00:29 +02:00
< a class = "viewcode-back" href = "../api.html#pynodes.Node.has_children" > [docs]< / a >
2024-03-31 22:38:38 +02:00
< span class = "k" > def< / span > < span class = "nf" > has_children< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "p" > )< / span > < span class = "o" > -> < / span > < span class = "nb" > bool< / span > < span class = "p" > :< / span >
2024-04-01 21:26:38 +02:00
< span class = "w" > < / span > < span class = "sd" > " " " check if Node object has one child at least " " " < / span >
2024-03-31 22:38:38 +02:00
< span class = "k" > if< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > children< / span > < span class = "ow" > is< / span > < span class = "ow" > not< / span > < span class = "kc" > None< / span > < span class = "p" > :< / span >
< span class = "k" > return< / span > < span class = "kc" > True< / span >
2024-04-01 21:26:38 +02:00
< span class = "k" > return< / span > < span class = "kc" > False< / span > < / div >
2024-03-31 22:38:38 +02:00
2024-04-01 21:26:38 +02:00
< div class = "viewcode-block" id = "Node.has_siblings" >
2024-04-07 17:00:29 +02:00
< a class = "viewcode-back" href = "../api.html#pynodes.Node.has_siblings" > [docs]< / a >
2024-03-31 22:38:38 +02:00
< span class = "k" > def< / span > < span class = "nf" > has_siblings< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "p" > )< / span > < span class = "o" > -> < / span > < span class = "nb" > bool< / span > < span class = "p" > :< / span >
2024-04-01 21:26:38 +02:00
< span class = "w" > < / span > < span class = "sd" > " " " check if Node object has one sibling at least " " " < / span >
2024-03-31 22:38:38 +02:00
< span class = "k" > if< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > has_parent< / span > < span class = "p" > ()< / span > < span class = "ow" > and< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > parent< / span > < span class = "o" > .< / span > < span class = "n" > has_children< / span > < span class = "p" > ()< / span > \
< span class = "ow" > and< / span > < span class = "nb" > len< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > parent< / span > < span class = "o" > .< / span > < span class = "n" > children< / span > < span class = "p" > )< / span > < span class = "o" > > < / span > < span class = "mi" > 0< / span > < span class = "p" > :< / span >
< span class = "k" > return< / span > < span class = "kc" > True< / span >
2024-04-01 21:26:38 +02:00
< span class = "k" > return< / span > < span class = "kc" > False< / span > < / div >
2024-03-31 22:38:38 +02:00
2024-04-01 21:26:38 +02:00
< div class = "viewcode-block" id = "Node.get_child" >
2024-04-07 17:00:29 +02:00
< a class = "viewcode-back" href = "../api.html#pynodes.Node.get_child" > [docs]< / a >
2024-03-31 22:38:38 +02:00
< span class = "k" > def< / span > < span class = "nf" > get_child< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "p" > ,< / span > < span class = "n" > name< / span > < span class = "p" > :< / span > < span class = "nb" > str< / span > < span class = "p" > )< / span > < span class = "o" > -> < / span > < span class = "n" > Node< / span > < span class = "o" > |< / span > < span class = "kc" > None< / span > < span class = "p" > :< / span >
2024-04-01 21:26:38 +02:00
< span class = "w" > < / span > < span class = "sd" > " " " find and returns a child with specified name. None if nothing found " " " < / span >
2024-03-31 22:38:38 +02:00
< span class = "k" > for< / span > < span class = "n" > c< / span > < span class = "ow" > in< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > children< / span > < span class = "p" > :< / span >
< span class = "k" > if< / span > < span class = "n" > c< / span > < span class = "o" > .< / span > < span class = "n" > name< / span > < span class = "o" > ==< / span > < span class = "n" > name< / span > < span class = "p" > :< / span >
< span class = "k" > return< / span > < span class = "n" > c< / span >
2024-04-01 21:26:38 +02:00
< span class = "k" > return< / span > < span class = "kc" > None< / span > < / div >
2024-03-31 22:38:38 +02:00
2024-04-01 21:26:38 +02:00
< div class = "viewcode-block" id = "Node.get_sibling" >
2024-04-07 17:00:29 +02:00
< a class = "viewcode-back" href = "../api.html#pynodes.Node.get_sibling" > [docs]< / a >
2024-03-31 22:38:38 +02:00
< span class = "k" > def< / span > < span class = "nf" > get_sibling< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "p" > ,< / span > < span class = "n" > name< / span > < span class = "p" > :< / span > < span class = "nb" > str< / span > < span class = "p" > )< / span > < span class = "o" > -> < / span > < span class = "n" > Node< / span > < span class = "o" > |< / span > < span class = "kc" > None< / span > < span class = "p" > :< / span >
2024-04-01 21:26:38 +02:00
< span class = "w" > < / span > < span class = "sd" > " " " find and returns a sibling with specified name. None if nothing< / span >
< span class = "sd" > found " " " < / span >
2024-03-31 22:38:38 +02:00
< span class = "k" > for< / span > < span class = "n" > c< / span > < span class = "ow" > in< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > siblings< / span > < span class = "p" > :< / span >
< span class = "k" > if< / span > < span class = "n" > c< / span > < span class = "o" > .< / span > < span class = "n" > name< / span > < span class = "o" > ==< / span > < span class = "n" > name< / span > < span class = "p" > :< / span >
< span class = "k" > return< / span > < span class = "n" > c< / span >
2024-04-01 21:26:38 +02:00
< span class = "k" > return< / span > < span class = "kc" > None< / span > < / div >
2024-03-31 22:38:38 +02:00
< span class = "k" > def< / span > < span class = "nf" > get_children< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "p" > ,< / span > < span class = "n" > name< / span > < span class = "p" > :< / span > < span class = "nb" > str< / span > < span class = "p" > )< / span > < span class = "o" > -> < / span > < span class = "nb" > list< / span > < span class = "p" > [< / span > < span class = "n" > Node< / span > < span class = "p" > ]:< / span >
< span class = "c1" > # refactoring, recursion is not good< / span >
< span class = "n" > results< / span > < span class = "o" > =< / span > < span class = "p" > []< / span >
< span class = "k" > if< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > name< / span > < span class = "o" > ==< / span > < span class = "n" > name< / span > < span class = "p" > :< / span >
< span class = "n" > results< / span > < span class = "o" > .< / span > < span class = "n" > append< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "p" > )< / span >
< span class = "k" > for< / span > < span class = "n" > c< / span > < span class = "ow" > in< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > children< / span > < span class = "p" > :< / span >
< span class = "n" > results< / span > < span class = "o" > +=< / span > < span class = "n" > c< / span > < span class = "o" > .< / span > < span class = "n" > get_children< / span > < span class = "p" > (< / span > < span class = "n" > name< / span > < span class = "p" > )< / span >
< span class = "k" > return< / span > < span class = "n" > results< / span >
< div class = "viewcode-block" id = "Node.check_lineage" >
2024-04-07 17:00:29 +02:00
< a class = "viewcode-back" href = "../api.html#pynodes.Node.check_lineage" > [docs]< / a >
2024-03-31 22:38:38 +02:00
< span class = "nd" > @staticmethod< / span >
< span class = "k" > def< / span > < span class = "nf" > check_lineage< / span > < span class = "p" > (< / span > < span class = "n" > nodes< / span > < span class = "p" > :< / span > < span class = "nb" > list< / span > < span class = "p" > [< / span > < span class = "n" > Node< / span > < span class = "p" > ])< / span > < span class = "o" > -> < / span > < span class = "nb" > bool< / span > < span class = "p" > :< / span >
< span class = "w" > < / span > < span class = "sd" > " " " < / span >
< span class = "sd" > check if the list of nodes is a straight lineage:< / span >
< span class = "sd" > node 1 (ancestor) -> node 2 -> node 3 -> ... -> node n (grand< / span >
< span class = "sd" > children)< / span >
< span class = "sd" > " " " < / span >
< span class = "k" > for< / span > < span class = "n" > i< / span > < span class = "ow" > in< / span > < span class = "nb" > range< / span > < span class = "p" > (< / span > < span class = "mi" > 1< / span > < span class = "p" > ,< / span > < span class = "nb" > len< / span > < span class = "p" > (< / span > < span class = "n" > nodes< / span > < span class = "p" > )):< / span >
< span class = "k" > if< / span > < span class = "n" > nodes< / span > < span class = "p" > [< / span > < span class = "n" > i< / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > parent< / span > < span class = "o" > !=< / span > < span class = "n" > nodes< / span > < span class = "p" > [< / span > < span class = "n" > i< / span > < span class = "o" > -< / span > < span class = "mi" > 1< / span > < span class = "p" > ]:< / span >
< span class = "k" > return< / span > < span class = "kc" > False< / span >
< span class = "k" > return< / span > < span class = "kc" > True< / span > < / div >
< div class = "viewcode-block" id = "Node.reset_stats" >
2024-04-07 17:00:29 +02:00
< a class = "viewcode-back" href = "../api.html#pynodes.Node.reset_stats" > [docs]< / a >
2024-03-31 22:38:38 +02:00
< span class = "nd" > @classmethod< / span >
< span class = "k" > def< / span > < span class = "nf" > reset_stats< / span > < span class = "p" > (< / span > < span class = "bp" > cls< / span > < span class = "p" > )< / span > < span class = "o" > -> < / span > < span class = "kc" > None< / span > < span class = "p" > :< / span >
< span class = "w" > < / span > < span class = "sd" > " " " < / span >
< span class = "sd" > reset all the ClassVar members< / span >
< span class = "sd" > " " " < / span >
< span class = "bp" > cls< / span > < span class = "o" > .< / span > < span class = "n" > deepest_level< / span > < span class = "o" > =< / span > < span class = "mi" > 0< / span >
< span class = "bp" > cls< / span > < span class = "o" > .< / span > < span class = "n" > largest_sibling_number< / span > < span class = "o" > =< / span > < span class = "mi" > 0< / span >
< span class = "bp" > cls< / span > < span class = "o" > .< / span > < span class = "n" > all_nodes< / span > < span class = "o" > =< / span > < span class = "p" > []< / span > < / div >
< div class = "viewcode-block" id = "Node.create_random_nodes" >
2024-04-07 17:00:29 +02:00
< a class = "viewcode-back" href = "../api.html#pynodes.Node.create_random_nodes" > [docs]< / a >
2024-03-31 22:38:38 +02:00
< span class = "nd" > @classmethod< / span >
< span class = "k" > def< / span > < span class = "nf" > create_random_nodes< / span > < span class = "p" > (< / span > < span class = "bp" > cls< / span > < span class = "p" > ,< / span > < span class = "n" > type_< / span > < span class = "p" > :< / span > < span class = "nb" > str< / span > < span class = "o" > =< / span > < span class = "s1" > ' cmd' < / span > < span class = "p" > ,< / span > < span class = "n" > depth< / span > < span class = "p" > :< / span > < span class = "nb" > int< / span > < span class = "o" > =< / span > < span class = "mi" > 0< / span > < span class = "p" > )< / span > < span class = "o" > -> < / span > < span class = "n" > Node< / span > < span class = "p" > :< / span >
< span class = "w" > < / span > < span class = "sd" > " " " < / span >
< span class = "sd" > Creates random tree of nodes for testing purpose< / span >
< span class = "sd" > " " " < / span >
< span class = "k" > def< / span > < span class = "nf" > create_node< / span > < span class = "p" > (< / span > < span class = "n" > level< / span > < span class = "p" > ,< / span > < span class = "n" > i< / span > < span class = "p" > ):< / span >
2024-04-01 21:26:38 +02:00
< span class = "n" > id_< / span > < span class = "o" > =< / span > < span class = "nb" > len< / span > < span class = "p" > (< / span > < span class = "bp" > cls< / span > < span class = "o" > .< / span > < span class = "n" > all_nodes< / span > < span class = "p" > )< / span > < span class = "o" > +< / span > < span class = "mi" > 1< / span >
2024-03-31 22:38:38 +02:00
< span class = "k" > return< / span > < span class = "bp" > cls< / span > < span class = "p" > (< / span > < span class = "sa" > f< / span > < span class = "s1" > ' < / span > < span class = "si" > {< / span > < span class = "n" > type_< / span > < span class = "si" > }< / span > < span class = "s1" > _' < / span > < span class = "o" > +< / span > < span class = "nb" > str< / span > < span class = "p" > (< / span > < span class = "n" > id_< / span > < span class = "p" > ))< / span >
< span class = "k" > def< / span > < span class = "nf" > create_node_list< / span > < span class = "p" > (< / span > < span class = "n" > level< / span > < span class = "p" > :< / span > < span class = "nb" > int< / span > < span class = "p" > ,< / span > < span class = "n" > width< / span > < span class = "p" > :< / span > < span class = "nb" > int< / span > < span class = "o" > =< / span > < span class = "mi" > 5< / span > < span class = "p" > ):< / span >
< span class = "k" > return< / span > < span class = "p" > [< / span > < span class = "n" > create_node< / span > < span class = "p" > (< / span > < span class = "n" > level< / span > < span class = "p" > ,< / span > < span class = "n" > i< / span > < span class = "p" > )< / span >
< span class = "k" > for< / span > < span class = "n" > i< / span > < span class = "ow" > in< / span > < span class = "nb" > range< / span > < span class = "p" > (< / span > < span class = "n" > random< / span > < span class = "o" > .< / span > < span class = "n" > randint< / span > < span class = "p" > (< / span > < span class = "mi" > 1< / span > < span class = "p" > ,< / span > < span class = "n" > width< / span > < span class = "p" > ))]< / span >
< span class = "k" > def< / span > < span class = "nf" > create_arg_tree< / span > < span class = "p" > (< / span > < span class = "n" > arg< / span > < span class = "p" > :< / span > < span class = "bp" > cls< / span > < span class = "p" > ):< / span >
< span class = "k" > if< / span > < span class = "n" > arg< / span > < span class = "o" > .< / span > < span class = "n" > level< / span > < span class = "o" > < < / span > < span class = "n" > depth< / span > < span class = "p" > :< / span >
< span class = "k" > for< / span > < span class = "n" > a< / span > < span class = "ow" > in< / span > < span class = "n" > create_node_list< / span > < span class = "p" > (< / span > < span class = "n" > arg< / span > < span class = "o" > .< / span > < span class = "n" > level< / span > < span class = "p" > ):< / span >
< span class = "n" > arg< / span > < span class = "o" > .< / span > < span class = "n" > add_child< / span > < span class = "p" > (< / span > < span class = "n" > a< / span > < span class = "p" > )< / span >
< span class = "n" > create_arg_tree< / span > < span class = "p" > (< / span > < span class = "n" > a< / span > < span class = "p" > )< / span >
< span class = "k" > return< / span > < span class = "n" > arg< / span >
< span class = "n" > arg< / span > < span class = "o" > =< / span > < span class = "bp" > cls< / span > < span class = "p" > (< / span > < span class = "s1" > ' parser' < / span > < span class = "p" > )< / span >
< span class = "k" > return< / span > < span class = "n" > create_arg_tree< / span > < span class = "p" > (< / span > < span class = "n" > arg< / span > < span class = "p" > )< / span > < / div >
< span class = "k" > def< / span > < span class = "fm" > __lt__< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "p" > ,< / span > < span class = "n" > other< / span > < span class = "p" > ):< / span >
< span class = "k" > return< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > level< / span > < span class = "o" > < < / span > < span class = "n" > other< / span > < span class = "o" > .< / span > < span class = "n" > level< / span >
< span class = "k" > def< / span > < span class = "fm" > __gt__< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "p" > ,< / span > < span class = "n" > other< / span > < span class = "p" > ):< / span >
< span class = "k" > return< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > level< / span > < span class = "o" > > < / span > < span class = "n" > other< / span > < span class = "o" > .< / span > < span class = "n" > level< / span >
< span class = "k" > def< / span > < span class = "fm" > __le__< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "p" > ,< / span > < span class = "n" > other< / span > < span class = "p" > ):< / span >
< span class = "k" > return< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > level< / span > < span class = "o" > < =< / span > < span class = "n" > other< / span > < span class = "o" > .< / span > < span class = "n" > level< / span >
< span class = "k" > def< / span > < span class = "fm" > __ge__< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "p" > ,< / span > < span class = "n" > other< / span > < span class = "p" > ):< / span >
< span class = "k" > return< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > level< / span > < span class = "o" > > =< / span > < span class = "n" > other< / span > < span class = "o" > .< / span > < span class = "n" > level< / span >
< span class = "k" > def< / span > < span class = "fm" > __str__< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "p" > )< / span > < span class = "o" > -> < / span > < span class = "nb" > str< / span > < span class = "p" > :< / span >
< span class = "k" > return< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > name< / span > < / div >
< span class = "k" > if< / span > < span class = "vm" > __name__< / span > < span class = "o" > ==< / span > < span class = "s2" > " __main__" < / span > < span class = "p" > :< / span >
< span class = "c1" > # while True:< / span >
< span class = "c1" > # master_node = Node.create_random_nodes(depth=3, type_=' cmd' )< / span >
< span class = "c1" > # node_list = [master_node, master_node.children[0],< / span >
< span class = "c1" > # master_node.children[0].children[0]]< / span >
< span class = "c1" > # random.shuffle(node_list)< / span >
< span class = "c1" > # print([n.name for n in node_list])< / span >
< span class = "c1" > # print(Node.check_lineage(node_list))< / span >
< span class = "c1" > # input(' pause' )< / span >
2024-04-07 17:00:29 +02:00
< span class = "k" > class< / span > < span class = "nc" > Person< / span > < span class = "p" > (< / span > < span class = "n" > Node< / span > < span class = "p" > ):< / span >
< span class = "k" > pass< / span >
2024-03-31 22:38:38 +02:00
2024-04-07 17:00:29 +02:00
< span class = "n" > bob< / span > < span class = "o" > =< / span > < span class = "n" > Person< / span > < span class = "p" > (< / span > < span class = "s1" > ' Bob' < / span > < span class = "p" > )< / span >
< span class = "n" > eve< / span > < span class = "o" > =< / span > < span class = "n" > Person< / span > < span class = "p" > (< / span > < span class = "s1" > ' Eve' < / span > < span class = "p" > )< / span >
< span class = "n" > alice< / span > < span class = "o" > =< / span > < span class = "n" > Person< / span > < span class = "p" > (< / span > < span class = "s1" > ' Alice' < / span > < span class = "p" > )< / span >
2024-03-31 22:38:38 +02:00
2024-04-07 17:00:29 +02:00
< span class = "c1" > # Alice is parent of bob and eve< / span >
< span class = "n" > alice< / span > < span class = "o" > .< / span > < span class = "n" > add_child< / span > < span class = "p" > (< / span > < span class = "n" > bob< / span > < span class = "p" > )< / span >
< span class = "n" > alice< / span > < span class = "o" > .< / span > < span class = "n" > add_child< / span > < span class = "p" > (< / span > < span class = "n" > eve< / span > < span class = "p" > )< / span >
2024-03-31 22:38:38 +02:00
2024-04-07 17:00:29 +02:00
< span class = "n" > alice< / span > < span class = "o" > .< / span > < span class = "n" > pretty_print< / span > < span class = "p" > (< / span > < span class = "n" > option< / span > < span class = "o" > =< / span > < span class = "s1" > ' id' < / span > < span class = "p" > )< / span >
2024-03-31 22:38:38 +02:00
2024-04-07 17:00:29 +02:00
< span class = "nb" > print< / span > < span class = "p" > (< / span > < span class = "n" > alice< / span > < span class = "o" > .< / span > < span class = "n" > id< / span > < span class = "p" > )< / span >
< / pre > < / div >
2024-03-31 22:38:38 +02:00
2024-04-07 17:00:29 +02:00
< / div >
< / div >
< footer >
2024-03-31 22:38:38 +02:00
2024-04-07 17:00:29 +02:00
< hr / >
2024-03-31 22:38:38 +02:00
2024-04-07 17:00:29 +02:00
< div role = "contentinfo" >
< p > © Copyright 2024, fabthegreat.< / p >
< / div >
2024-03-31 22:38:38 +02:00
2024-04-07 17:00:29 +02:00
Built with < a href = "https://www.sphinx-doc.org/" > Sphinx< / a > using a
< a href = "https://github.com/readthedocs/sphinx_rtd_theme" > theme< / a >
provided by < a href = "https://readthedocs.org" > Read the Docs< / a > .
2024-03-31 22:38:38 +02:00
2024-04-07 17:00:29 +02:00
< / footer >
2024-03-31 22:38:38 +02:00
< / div >
< / div >
2024-04-07 17:00:29 +02:00
< / section >
< / div >
< script >
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
< / script >
< / body >
2024-03-31 22:38:38 +02:00
< / html >