syn.tree.b package

Submodules

syn.tree.b.node module

class syn.tree.b.node.Node(**kwargs)

Bases: syn.base.b.wrapper.ListWrapper

Keyword-Only Arguments:

_id [Optional]: int
Integer id of the node
_list: list
Child nodes
_name [Optional]: basestring
Name of the node (for display purposes)
_node_count: int
The number of nodes in the subtreerooted by this node.
_parent [Optional]: Node
Parent of this node

Class Options:

  • args: ()
  • autodoc: True
  • coerce_args: False
  • descendant_exclude: ()
  • id_equality: False
  • init_validate: False
  • make_hashable: False
  • make_type_object: True
  • max_len: None
  • min_len: None
  • must_be_root: False
  • optional_none: True
  • register_subclasses: False
  • repr_template:
  • coerce_hooks: ()
  • create_hooks: ()
  • init_hooks: ()
  • init_order: ()
  • metaclass_lookup: (‘coerce_hooks’, ‘init_hooks’, ‘create_hooks’, ‘setstate_hooks’)
  • setstate_hooks: ()

Aliases:

  • _list: _children

Groups:

  • _all: _id, _list, _name, _node_count, _parent
  • copy_copy: _list
  • hash_exclude: _parent
  • generate_exclude: _node_count, _parent
  • _internal: _id, _list, _name, _node_count, _parent
  • repr_exclude: _list, _parent
  • eq_exclude: _parent
  • getstate_exclude: _parent
  • str_exclude: _id, _list, _name, _node_count, _parent
add_child(node, index=None)
ancestors(include_self=False)
attributes()
children(reverse=False)
collect_by_type(typ)

A more efficient way to collect nodes of a specified type than collect_nodes.

collect_nodes(attr=None, val=None, key=None)
collect_rootward(nodes=None)
depth_first(func=<function <lambda>>, filt=<function <lambda>>, reverse=False, include_toplevel=True, top_level=True, depth=0, yield_depth=False)
descendants(include_self=False)
find_type(typ, children_only=False)
following()
id()
name()
node_count()
parent()
preceding()
remove_child(node)
root()
rootward(func=<function <lambda>>, filt=<function <lambda>>, include_toplevel=True, top_level=True)
set_child_parents(parent=None, recurse=False, override=False)
siblings(preceding=False, following=False, axis=False)
validate()
exception syn.tree.b.node.TreeError

Bases: exceptions.Exception

syn.tree.b.query module

class syn.tree.b.query.Ancestor(**kwargs)

Bases: syn.tree.b.query.Axis

Keyword-Only Arguments:

_id [Optional]: int
Integer id of the node
_list: list
Child nodes
_name [Optional]: basestring
Name of the node (for display purposes)
_node_count: int
The number of nodes in the subtreerooted by this node.
_parent [Optional]: Node
Parent of this node

include_self (default = False): bool

Class Options:

  • args: ()
  • autodoc: True
  • coerce_args: False
  • descendant_exclude: ()
  • id_equality: False
  • init_validate: False
  • make_hashable: False
  • make_type_object: True
  • max_len: 1
  • min_len: None
  • must_be_root: False
  • optional_none: True
  • register_subclasses: False
  • repr_template:
  • coerce_hooks: ()
  • create_hooks: ()
  • init_hooks: ()
  • init_order: ()
  • metaclass_lookup: (‘coerce_hooks’, ‘init_hooks’, ‘create_hooks’, ‘setstate_hooks’)
  • setstate_hooks: ()

Aliases:

  • _list: _children

Groups:

  • _all: _id, _list, _name, _node_count, _parent, include_self
  • copy_copy: _list
  • hash_exclude: _parent
  • generate_exclude: _node_count, _parent
  • _internal: _id, _list, _name, _node_count, _parent
  • repr_exclude: _list, _parent
  • eq_exclude: _parent
  • getstate_exclude: _parent
  • str_exclude: _id, _list, _name, _node_count, _parent
iterate(node, **kwargs)
class syn.tree.b.query.Any(**kwargs)

Bases: syn.tree.b.query.Predicate

Keyword-Only Arguments:

_id [Optional]: int
Integer id of the node
_list: list
Child nodes
_name [Optional]: basestring
Name of the node (for display purposes)
_node_count: int
The number of nodes in the subtreerooted by this node.
_parent [Optional]: Node
Parent of this node

Class Options:

  • args: ()
  • autodoc: True
  • coerce_args: False
  • descendant_exclude: ()
  • id_equality: False
  • init_validate: False
  • make_hashable: False
  • make_type_object: True
  • max_len: 0
  • min_len: None
  • must_be_root: False
  • optional_none: True
  • register_subclasses: False
  • repr_template:
  • coerce_hooks: ()
  • create_hooks: ()
  • init_hooks: ()
  • init_order: ()
  • metaclass_lookup: (‘coerce_hooks’, ‘init_hooks’, ‘create_hooks’, ‘setstate_hooks’)
  • setstate_hooks: ()

Aliases:

  • _list: _children

Groups:

  • _all: _id, _list, _name, _node_count, _parent
  • copy_copy: _list
  • hash_exclude: _parent
  • generate_exclude: _node_count, _parent
  • _internal: _id, _list, _name, _node_count, _parent
  • repr_exclude: _list, _parent
  • eq_exclude: _parent
  • getstate_exclude: _parent
  • str_exclude: _id, _list, _name, _node_count, _parent
eval(node, **kwargs)
class syn.tree.b.query.Attribute(**kwargs)

Bases: syn.tree.b.query.Axis

Keyword-Only Arguments:

_id [Optional]: int
Integer id of the node
_list: list
Child nodes
_name [Optional]: basestring
Name of the node (for display purposes)
_node_count: int
The number of nodes in the subtreerooted by this node.
_parent [Optional]: Node
Parent of this node

Class Options:

  • args: ()
  • autodoc: True
  • coerce_args: False
  • descendant_exclude: ()
  • id_equality: False
  • init_validate: False
  • make_hashable: False
  • make_type_object: True
  • max_len: 1
  • min_len: None
  • must_be_root: False
  • optional_none: True
  • register_subclasses: False
  • repr_template:
  • coerce_hooks: ()
  • create_hooks: ()
  • init_hooks: ()
  • init_order: ()
  • metaclass_lookup: (‘coerce_hooks’, ‘init_hooks’, ‘create_hooks’, ‘setstate_hooks’)
  • setstate_hooks: ()

Aliases:

  • _list: _children

Groups:

  • _all: _id, _list, _name, _node_count, _parent
  • copy_copy: _list
  • hash_exclude: _parent
  • generate_exclude: _node_count, _parent
  • _internal: _id, _list, _name, _node_count, _parent
  • repr_exclude: _list, _parent
  • eq_exclude: _parent
  • getstate_exclude: _parent
  • str_exclude: _id, _list, _name, _node_count, _parent
iterate(node, **kwargs)
class syn.tree.b.query.Axis(**kwargs)

Bases: syn.tree.b.query.Query

Keyword-Only Arguments:

_id [Optional]: int
Integer id of the node
_list: list
Child nodes
_name [Optional]: basestring
Name of the node (for display purposes)
_node_count: int
The number of nodes in the subtreerooted by this node.
_parent [Optional]: Node
Parent of this node

Class Options:

  • args: ()
  • autodoc: True
  • coerce_args: False
  • descendant_exclude: ()
  • id_equality: False
  • init_validate: False
  • make_hashable: False
  • make_type_object: True
  • max_len: 1
  • min_len: None
  • must_be_root: False
  • optional_none: True
  • register_subclasses: False
  • repr_template:
  • coerce_hooks: ()
  • create_hooks: ()
  • init_hooks: ()
  • init_order: ()
  • metaclass_lookup: (‘coerce_hooks’, ‘init_hooks’, ‘create_hooks’, ‘setstate_hooks’)
  • setstate_hooks: ()

Aliases:

  • _list: _children

Groups:

  • _all: _id, _list, _name, _node_count, _parent
  • copy_copy: _list
  • hash_exclude: _parent
  • generate_exclude: _node_count, _parent
  • _internal: _id, _list, _name, _node_count, _parent
  • repr_exclude: _list, _parent
  • eq_exclude: _parent
  • getstate_exclude: _parent
  • str_exclude: _id, _list, _name, _node_count, _parent
class syn.tree.b.query.Child(**kwargs)

Bases: syn.tree.b.query.Axis

Keyword-Only Arguments:

_id [Optional]: int
Integer id of the node
_list: list
Child nodes
_name [Optional]: basestring
Name of the node (for display purposes)
_node_count: int
The number of nodes in the subtreerooted by this node.
_parent [Optional]: Node
Parent of this node

Class Options:

  • args: ()
  • autodoc: True
  • coerce_args: False
  • descendant_exclude: ()
  • id_equality: False
  • init_validate: False
  • make_hashable: False
  • make_type_object: True
  • max_len: 1
  • min_len: None
  • must_be_root: False
  • optional_none: True
  • register_subclasses: False
  • repr_template:
  • coerce_hooks: ()
  • create_hooks: ()
  • init_hooks: ()
  • init_order: ()
  • metaclass_lookup: (‘coerce_hooks’, ‘init_hooks’, ‘create_hooks’, ‘setstate_hooks’)
  • setstate_hooks: ()

Aliases:

  • _list: _children

Groups:

  • _all: _id, _list, _name, _node_count, _parent
  • copy_copy: _list
  • hash_exclude: _parent
  • generate_exclude: _node_count, _parent
  • _internal: _id, _list, _name, _node_count, _parent
  • repr_exclude: _list, _parent
  • eq_exclude: _parent
  • getstate_exclude: _parent
  • str_exclude: _id, _list, _name, _node_count, _parent
iterate(node, **kwargs)
class syn.tree.b.query.Comparison(**kwargs)

Bases: syn.tree.b.query.Function

Keyword-Only Arguments:

_id [Optional]: int
Integer id of the node
_list: list
Child nodes
_name [Optional]: basestring
Name of the node (for display purposes)
_node_count: int
The number of nodes in the subtreerooted by this node.
_parent [Optional]: Node
Parent of this node

Class Options:

  • args: ()
  • autodoc: True
  • coerce_args: False
  • descendant_exclude: ()
  • id_equality: False
  • init_validate: False
  • make_hashable: False
  • make_type_object: True
  • max_len: 1
  • min_len: None
  • must_be_root: False
  • optional_none: True
  • register_subclasses: False
  • repr_template:
  • coerce_hooks: ()
  • create_hooks: ()
  • init_hooks: ()
  • init_order: ()
  • metaclass_lookup: (‘coerce_hooks’, ‘init_hooks’, ‘create_hooks’, ‘setstate_hooks’)
  • setstate_hooks: ()

Aliases:

  • _list: _children

Groups:

  • _all: _id, _list, _name, _node_count, _parent
  • copy_copy: _list
  • hash_exclude: _parent
  • generate_exclude: _node_count, _parent
  • _internal: _id, _list, _name, _node_count, _parent
  • repr_exclude: _list, _parent
  • eq_exclude: _parent
  • getstate_exclude: _parent
  • str_exclude: _id, _list, _name, _node_count, _parent
arity = 2
class syn.tree.b.query.Descendant(**kwargs)

Bases: syn.tree.b.query.Axis

Keyword-Only Arguments:

_id [Optional]: int
Integer id of the node
_list: list
Child nodes
_name [Optional]: basestring
Name of the node (for display purposes)
_node_count: int
The number of nodes in the subtreerooted by this node.
_parent [Optional]: Node
Parent of this node

include_self (default = False): bool

Class Options:

  • args: ()
  • autodoc: True
  • coerce_args: False
  • descendant_exclude: ()
  • id_equality: False
  • init_validate: False
  • make_hashable: False
  • make_type_object: True
  • max_len: 1
  • min_len: None
  • must_be_root: False
  • optional_none: True
  • register_subclasses: False
  • repr_template:
  • coerce_hooks: ()
  • create_hooks: ()
  • init_hooks: ()
  • init_order: ()
  • metaclass_lookup: (‘coerce_hooks’, ‘init_hooks’, ‘create_hooks’, ‘setstate_hooks’)
  • setstate_hooks: ()

Aliases:

  • _list: _children

Groups:

  • _all: _id, _list, _name, _node_count, _parent, include_self
  • copy_copy: _list
  • hash_exclude: _parent
  • generate_exclude: _node_count, _parent
  • _internal: _id, _list, _name, _node_count, _parent
  • repr_exclude: _list, _parent
  • eq_exclude: _parent
  • getstate_exclude: _parent
  • str_exclude: _id, _list, _name, _node_count, _parent
iterate(node, **kwargs)
class syn.tree.b.query.Eq(**kwargs)

Bases: syn.tree.b.query.Comparison

Keyword-Only Arguments:

_id [Optional]: int
Integer id of the node
_list: list
Child nodes
_name [Optional]: basestring
Name of the node (for display purposes)
_node_count: int
The number of nodes in the subtreerooted by this node.
_parent [Optional]: Node
Parent of this node

Class Options:

  • args: ()
  • autodoc: True
  • coerce_args: False
  • descendant_exclude: ()
  • id_equality: False
  • init_validate: False
  • make_hashable: False
  • make_type_object: True
  • max_len: 2
  • min_len: 2
  • must_be_root: False
  • optional_none: True
  • register_subclasses: False
  • repr_template:
  • coerce_hooks: ()
  • create_hooks: ()
  • init_hooks: ()
  • init_order: ()
  • metaclass_lookup: (‘coerce_hooks’, ‘init_hooks’, ‘create_hooks’, ‘setstate_hooks’)
  • setstate_hooks: ()

Aliases:

  • _list: _children

Groups:

  • _all: _id, _list, _name, _node_count, _parent
  • copy_copy: _list
  • hash_exclude: _parent
  • generate_exclude: _node_count, _parent
  • _internal: _id, _list, _name, _node_count, _parent
  • repr_exclude: _list, _parent
  • eq_exclude: _parent
  • getstate_exclude: _parent
  • str_exclude: _id, _list, _name, _node_count, _parent
func()

eq(a, b) – Same as a==b.

class syn.tree.b.query.Following(**kwargs)

Bases: syn.tree.b.query.Axis

Keyword-Only Arguments:

_id [Optional]: int
Integer id of the node
_list: list
Child nodes
_name [Optional]: basestring
Name of the node (for display purposes)
_node_count: int
The number of nodes in the subtreerooted by this node.
_parent [Optional]: Node
Parent of this node

include_self (default = False): bool

Class Options:

  • args: ()
  • autodoc: True
  • coerce_args: False
  • descendant_exclude: ()
  • id_equality: False
  • init_validate: False
  • make_hashable: False
  • make_type_object: True
  • max_len: 1
  • min_len: None
  • must_be_root: False
  • optional_none: True
  • register_subclasses: False
  • repr_template:
  • coerce_hooks: ()
  • create_hooks: ()
  • init_hooks: ()
  • init_order: ()
  • metaclass_lookup: (‘coerce_hooks’, ‘init_hooks’, ‘create_hooks’, ‘setstate_hooks’)
  • setstate_hooks: ()

Aliases:

  • _list: _children

Groups:

  • _all: _id, _list, _name, _node_count, _parent, include_self
  • copy_copy: _list
  • hash_exclude: _parent
  • generate_exclude: _node_count, _parent
  • _internal: _id, _list, _name, _node_count, _parent
  • repr_exclude: _list, _parent
  • eq_exclude: _parent
  • getstate_exclude: _parent
  • str_exclude: _id, _list, _name, _node_count, _parent
iterate(node, **kwargs)
class syn.tree.b.query.Function(**kwargs)

Bases: syn.tree.b.query.Query

Keyword-Only Arguments:

_id [Optional]: int
Integer id of the node
_list: list
Child nodes
_name [Optional]: basestring
Name of the node (for display purposes)
_node_count: int
The number of nodes in the subtreerooted by this node.
_parent [Optional]: Node
Parent of this node

Class Options:

  • args: ()
  • autodoc: True
  • coerce_args: False
  • descendant_exclude: ()
  • id_equality: False
  • init_validate: False
  • make_hashable: False
  • make_type_object: True
  • max_len: 1
  • min_len: None
  • must_be_root: False
  • optional_none: True
  • register_subclasses: False
  • repr_template:
  • coerce_hooks: ()
  • create_hooks: ()
  • init_hooks: ()
  • init_order: ()
  • metaclass_lookup: (‘coerce_hooks’, ‘init_hooks’, ‘create_hooks’, ‘setstate_hooks’)
  • setstate_hooks: ()

Aliases:

  • _list: _children

Groups:

  • _all: _id, _list, _name, _node_count, _parent
  • copy_copy: _list
  • hash_exclude: _parent
  • generate_exclude: _node_count, _parent
  • _internal: _id, _list, _name, _node_count, _parent
  • repr_exclude: _list, _parent
  • eq_exclude: _parent
  • getstate_exclude: _parent
  • str_exclude: _id, _list, _name, _node_count, _parent
arity = None
eval(values, **kwargs)
func = None
class syn.tree.b.query.Ge(**kwargs)

Bases: syn.tree.b.query.Comparison

Keyword-Only Arguments:

_id [Optional]: int
Integer id of the node
_list: list
Child nodes
_name [Optional]: basestring
Name of the node (for display purposes)
_node_count: int
The number of nodes in the subtreerooted by this node.
_parent [Optional]: Node
Parent of this node

Class Options:

  • args: ()
  • autodoc: True
  • coerce_args: False
  • descendant_exclude: ()
  • id_equality: False
  • init_validate: False
  • make_hashable: False
  • make_type_object: True
  • max_len: 2
  • min_len: 2
  • must_be_root: False
  • optional_none: True
  • register_subclasses: False
  • repr_template:
  • coerce_hooks: ()
  • create_hooks: ()
  • init_hooks: ()
  • init_order: ()
  • metaclass_lookup: (‘coerce_hooks’, ‘init_hooks’, ‘create_hooks’, ‘setstate_hooks’)
  • setstate_hooks: ()

Aliases:

  • _list: _children

Groups:

  • _all: _id, _list, _name, _node_count, _parent
  • copy_copy: _list
  • hash_exclude: _parent
  • generate_exclude: _node_count, _parent
  • _internal: _id, _list, _name, _node_count, _parent
  • repr_exclude: _list, _parent
  • eq_exclude: _parent
  • getstate_exclude: _parent
  • str_exclude: _id, _list, _name, _node_count, _parent
func()

ge(a, b) – Same as a>=b.

class syn.tree.b.query.Gt(**kwargs)

Bases: syn.tree.b.query.Comparison

Keyword-Only Arguments:

_id [Optional]: int
Integer id of the node
_list: list
Child nodes
_name [Optional]: basestring
Name of the node (for display purposes)
_node_count: int
The number of nodes in the subtreerooted by this node.
_parent [Optional]: Node
Parent of this node

Class Options:

  • args: ()
  • autodoc: True
  • coerce_args: False
  • descendant_exclude: ()
  • id_equality: False
  • init_validate: False
  • make_hashable: False
  • make_type_object: True
  • max_len: 2
  • min_len: 2
  • must_be_root: False
  • optional_none: True
  • register_subclasses: False
  • repr_template:
  • coerce_hooks: ()
  • create_hooks: ()
  • init_hooks: ()
  • init_order: ()
  • metaclass_lookup: (‘coerce_hooks’, ‘init_hooks’, ‘create_hooks’, ‘setstate_hooks’)
  • setstate_hooks: ()

Aliases:

  • _list: _children

Groups:

  • _all: _id, _list, _name, _node_count, _parent
  • copy_copy: _list
  • hash_exclude: _parent
  • generate_exclude: _node_count, _parent
  • _internal: _id, _list, _name, _node_count, _parent
  • repr_exclude: _list, _parent
  • eq_exclude: _parent
  • getstate_exclude: _parent
  • str_exclude: _id, _list, _name, _node_count, _parent
func()

gt(a, b) – Same as a>b.

class syn.tree.b.query.Identity(**kwargs)

Bases: syn.tree.b.query.Function

Keyword-Only Arguments:

_id [Optional]: int
Integer id of the node
_list: list
Child nodes
_name [Optional]: basestring
Name of the node (for display purposes)
_node_count: int
The number of nodes in the subtreerooted by this node.
_parent [Optional]: Node
Parent of this node

Class Options:

  • args: ()
  • autodoc: True
  • coerce_args: False
  • descendant_exclude: ()
  • id_equality: False
  • init_validate: False
  • make_hashable: False
  • make_type_object: True
  • max_len: 1
  • min_len: None
  • must_be_root: False
  • optional_none: True
  • register_subclasses: False
  • repr_template:
  • coerce_hooks: ()
  • create_hooks: ()
  • init_hooks: ()
  • init_order: ()
  • metaclass_lookup: (‘coerce_hooks’, ‘init_hooks’, ‘create_hooks’, ‘setstate_hooks’)
  • setstate_hooks: ()

Aliases:

  • _list: _children

Groups:

  • _all: _id, _list, _name, _node_count, _parent
  • copy_copy: _list
  • hash_exclude: _parent
  • generate_exclude: _node_count, _parent
  • _internal: _id, _list, _name, _node_count, _parent
  • repr_exclude: _list, _parent
  • eq_exclude: _parent
  • getstate_exclude: _parent
  • str_exclude: _id, _list, _name, _node_count, _parent
arity = 1
func(x)
class syn.tree.b.query.Le(**kwargs)

Bases: syn.tree.b.query.Comparison

Keyword-Only Arguments:

_id [Optional]: int
Integer id of the node
_list: list
Child nodes
_name [Optional]: basestring
Name of the node (for display purposes)
_node_count: int
The number of nodes in the subtreerooted by this node.
_parent [Optional]: Node
Parent of this node

Class Options:

  • args: ()
  • autodoc: True
  • coerce_args: False
  • descendant_exclude: ()
  • id_equality: False
  • init_validate: False
  • make_hashable: False
  • make_type_object: True
  • max_len: 2
  • min_len: 2
  • must_be_root: False
  • optional_none: True
  • register_subclasses: False
  • repr_template:
  • coerce_hooks: ()
  • create_hooks: ()
  • init_hooks: ()
  • init_order: ()
  • metaclass_lookup: (‘coerce_hooks’, ‘init_hooks’, ‘create_hooks’, ‘setstate_hooks’)
  • setstate_hooks: ()

Aliases:

  • _list: _children

Groups:

  • _all: _id, _list, _name, _node_count, _parent
  • copy_copy: _list
  • hash_exclude: _parent
  • generate_exclude: _node_count, _parent
  • _internal: _id, _list, _name, _node_count, _parent
  • repr_exclude: _list, _parent
  • eq_exclude: _parent
  • getstate_exclude: _parent
  • str_exclude: _id, _list, _name, _node_count, _parent
func()

le(a, b) – Same as a<=b.

class syn.tree.b.query.Lt(**kwargs)

Bases: syn.tree.b.query.Comparison

Keyword-Only Arguments:

_id [Optional]: int
Integer id of the node
_list: list
Child nodes
_name [Optional]: basestring
Name of the node (for display purposes)
_node_count: int
The number of nodes in the subtreerooted by this node.
_parent [Optional]: Node
Parent of this node

Class Options:

  • args: ()
  • autodoc: True
  • coerce_args: False
  • descendant_exclude: ()
  • id_equality: False
  • init_validate: False
  • make_hashable: False
  • make_type_object: True
  • max_len: 2
  • min_len: 2
  • must_be_root: False
  • optional_none: True
  • register_subclasses: False
  • repr_template:
  • coerce_hooks: ()
  • create_hooks: ()
  • init_hooks: ()
  • init_order: ()
  • metaclass_lookup: (‘coerce_hooks’, ‘init_hooks’, ‘create_hooks’, ‘setstate_hooks’)
  • setstate_hooks: ()

Aliases:

  • _list: _children

Groups:

  • _all: _id, _list, _name, _node_count, _parent
  • copy_copy: _list
  • hash_exclude: _parent
  • generate_exclude: _node_count, _parent
  • _internal: _id, _list, _name, _node_count, _parent
  • repr_exclude: _list, _parent
  • eq_exclude: _parent
  • getstate_exclude: _parent
  • str_exclude: _id, _list, _name, _node_count, _parent
func()

lt(a, b) – Same as a<b.

class syn.tree.b.query.Name(name, **kwargs)

Bases: syn.tree.b.query.Predicate

Positional Arguments:

name: basestring

Keyword-Only Arguments:

_id [Optional]: int
Integer id of the node
_list: list
Child nodes
_name [Optional]: basestring
Name of the node (for display purposes)
_node_count: int
The number of nodes in the subtreerooted by this node.
_parent [Optional]: Node
Parent of this node

name_attr (default = _name): basestring

Class Options:

  • args: (‘name’,)
  • autodoc: True
  • coerce_args: False
  • descendant_exclude: ()
  • id_equality: False
  • init_validate: False
  • make_hashable: False
  • make_type_object: True
  • max_len: 0
  • min_len: None
  • must_be_root: False
  • optional_none: True
  • register_subclasses: False
  • repr_template:
  • coerce_hooks: ()
  • create_hooks: ()
  • init_hooks: ()
  • init_order: ()
  • metaclass_lookup: (‘coerce_hooks’, ‘init_hooks’, ‘create_hooks’, ‘setstate_hooks’)
  • setstate_hooks: ()

Aliases:

  • _list: _children

Groups:

  • _all: _id, _list, _name, _node_count, _parent, name, name_attr
  • copy_copy: _list
  • hash_exclude: _parent
  • generate_exclude: _node_count, _parent
  • _internal: _id, _list, _name, _node_count, _parent
  • repr_exclude: _list, _parent
  • eq_exclude: _parent
  • getstate_exclude: _parent
  • str_exclude: _id, _list, _name, _node_count, _parent
eval(node, **kwargs)
class syn.tree.b.query.Ne(**kwargs)

Bases: syn.tree.b.query.Comparison

Keyword-Only Arguments:

_id [Optional]: int
Integer id of the node
_list: list
Child nodes
_name [Optional]: basestring
Name of the node (for display purposes)
_node_count: int
The number of nodes in the subtreerooted by this node.
_parent [Optional]: Node
Parent of this node

Class Options:

  • args: ()
  • autodoc: True
  • coerce_args: False
  • descendant_exclude: ()
  • id_equality: False
  • init_validate: False
  • make_hashable: False
  • make_type_object: True
  • max_len: 2
  • min_len: 2
  • must_be_root: False
  • optional_none: True
  • register_subclasses: False
  • repr_template:
  • coerce_hooks: ()
  • create_hooks: ()
  • init_hooks: ()
  • init_order: ()
  • metaclass_lookup: (‘coerce_hooks’, ‘init_hooks’, ‘create_hooks’, ‘setstate_hooks’)
  • setstate_hooks: ()

Aliases:

  • _list: _children

Groups:

  • _all: _id, _list, _name, _node_count, _parent
  • copy_copy: _list
  • hash_exclude: _parent
  • generate_exclude: _node_count, _parent
  • _internal: _id, _list, _name, _node_count, _parent
  • repr_exclude: _list, _parent
  • eq_exclude: _parent
  • getstate_exclude: _parent
  • str_exclude: _id, _list, _name, _node_count, _parent
func()

ne(a, b) – Same as a!=b.

class syn.tree.b.query.Parent(**kwargs)

Bases: syn.tree.b.query.Axis

Keyword-Only Arguments:

_id [Optional]: int
Integer id of the node
_list: list
Child nodes
_name [Optional]: basestring
Name of the node (for display purposes)
_node_count: int
The number of nodes in the subtreerooted by this node.
_parent [Optional]: Node
Parent of this node

Class Options:

  • args: ()
  • autodoc: True
  • coerce_args: False
  • descendant_exclude: ()
  • id_equality: False
  • init_validate: False
  • make_hashable: False
  • make_type_object: True
  • max_len: 1
  • min_len: None
  • must_be_root: False
  • optional_none: True
  • register_subclasses: False
  • repr_template:
  • coerce_hooks: ()
  • create_hooks: ()
  • init_hooks: ()
  • init_order: ()
  • metaclass_lookup: (‘coerce_hooks’, ‘init_hooks’, ‘create_hooks’, ‘setstate_hooks’)
  • setstate_hooks: ()

Aliases:

  • _list: _children

Groups:

  • _all: _id, _list, _name, _node_count, _parent
  • copy_copy: _list
  • hash_exclude: _parent
  • generate_exclude: _node_count, _parent
  • _internal: _id, _list, _name, _node_count, _parent
  • repr_exclude: _list, _parent
  • eq_exclude: _parent
  • getstate_exclude: _parent
  • str_exclude: _id, _list, _name, _node_count, _parent
iterate(node, **kwargs)
class syn.tree.b.query.Position(pos, **kwargs)

Bases: syn.tree.b.query.Predicate

Positional Arguments:

pos: int

Keyword-Only Arguments:

_id [Optional]: int
Integer id of the node
_list: list
Child nodes
_name [Optional]: basestring
Name of the node (for display purposes)
_node_count: int
The number of nodes in the subtreerooted by this node.
_parent [Optional]: Node
Parent of this node

pos_attr (default = _nodeset_position): basestring start_offset (default = 0): int

Class Options:

  • args: (‘pos’,)
  • autodoc: True
  • coerce_args: False
  • descendant_exclude: ()
  • id_equality: False
  • init_validate: False
  • make_hashable: False
  • make_type_object: True
  • max_len: 0
  • min_len: None
  • must_be_root: False
  • optional_none: True
  • register_subclasses: False
  • repr_template:
  • coerce_hooks: ()
  • create_hooks: ()
  • init_hooks: ()
  • init_order: ()
  • metaclass_lookup: (‘coerce_hooks’, ‘init_hooks’, ‘create_hooks’, ‘setstate_hooks’)
  • setstate_hooks: ()

Aliases:

  • _list: _children

Groups:

  • _all: _id, _list, _name, _node_count, _parent, pos, pos_attr, start_offset
  • copy_copy: _list
  • hash_exclude: _parent
  • generate_exclude: _node_count, _parent
  • _internal: _id, _list, _name, _node_count, _parent
  • repr_exclude: _list, _parent
  • eq_exclude: _parent
  • getstate_exclude: _parent
  • str_exclude: _id, _list, _name, _node_count, _parent
eval(node, **kwargs)
class syn.tree.b.query.Preceding(**kwargs)

Bases: syn.tree.b.query.Axis

Keyword-Only Arguments:

_id [Optional]: int
Integer id of the node
_list: list
Child nodes
_name [Optional]: basestring
Name of the node (for display purposes)
_node_count: int
The number of nodes in the subtreerooted by this node.
_parent [Optional]: Node
Parent of this node

include_self (default = False): bool

Class Options:

  • args: ()
  • autodoc: True
  • coerce_args: False
  • descendant_exclude: ()
  • id_equality: False
  • init_validate: False
  • make_hashable: False
  • make_type_object: True
  • max_len: 1
  • min_len: None
  • must_be_root: False
  • optional_none: True
  • register_subclasses: False
  • repr_template:
  • coerce_hooks: ()
  • create_hooks: ()
  • init_hooks: ()
  • init_order: ()
  • metaclass_lookup: (‘coerce_hooks’, ‘init_hooks’, ‘create_hooks’, ‘setstate_hooks’)
  • setstate_hooks: ()

Aliases:

  • _list: _children

Groups:

  • _all: _id, _list, _name, _node_count, _parent, include_self
  • copy_copy: _list
  • hash_exclude: _parent
  • generate_exclude: _node_count, _parent
  • _internal: _id, _list, _name, _node_count, _parent
  • repr_exclude: _list, _parent
  • eq_exclude: _parent
  • getstate_exclude: _parent
  • str_exclude: _id, _list, _name, _node_count, _parent
iterate(node, **kwargs)
class syn.tree.b.query.Predicate(**kwargs)

Bases: syn.tree.b.query.Query

Keyword-Only Arguments:

_id [Optional]: int
Integer id of the node
_list: list
Child nodes
_name [Optional]: basestring
Name of the node (for display purposes)
_node_count: int
The number of nodes in the subtreerooted by this node.
_parent [Optional]: Node
Parent of this node

Class Options:

  • args: ()
  • autodoc: True
  • coerce_args: False
  • descendant_exclude: ()
  • id_equality: False
  • init_validate: False
  • make_hashable: False
  • make_type_object: True
  • max_len: 0
  • min_len: None
  • must_be_root: False
  • optional_none: True
  • register_subclasses: False
  • repr_template:
  • coerce_hooks: ()
  • create_hooks: ()
  • init_hooks: ()
  • init_order: ()
  • metaclass_lookup: (‘coerce_hooks’, ‘init_hooks’, ‘create_hooks’, ‘setstate_hooks’)
  • setstate_hooks: ()

Aliases:

  • _list: _children

Groups:

  • _all: _id, _list, _name, _node_count, _parent
  • copy_copy: _list
  • hash_exclude: _parent
  • generate_exclude: _node_count, _parent
  • _internal: _id, _list, _name, _node_count, _parent
  • repr_exclude: _list, _parent
  • eq_exclude: _parent
  • getstate_exclude: _parent
  • str_exclude: _id, _list, _name, _node_count, _parent
eval(node, **kwargs)
class syn.tree.b.query.Query(**kwargs)

Bases: syn.tree.b.node.Node

Keyword-Only Arguments:

_id [Optional]: int
Integer id of the node
_list: list
Child nodes
_name [Optional]: basestring
Name of the node (for display purposes)
_node_count: int
The number of nodes in the subtreerooted by this node.
_parent [Optional]: Node
Parent of this node

Class Options:

  • args: ()
  • autodoc: True
  • coerce_args: False
  • descendant_exclude: ()
  • id_equality: False
  • init_validate: False
  • make_hashable: False
  • make_type_object: True
  • max_len: 1
  • min_len: None
  • must_be_root: False
  • optional_none: True
  • register_subclasses: False
  • repr_template:
  • coerce_hooks: ()
  • create_hooks: ()
  • init_hooks: ()
  • init_order: ()
  • metaclass_lookup: (‘coerce_hooks’, ‘init_hooks’, ‘create_hooks’, ‘setstate_hooks’)
  • setstate_hooks: ()

Aliases:

  • _list: _children

Groups:

  • _all: _id, _list, _name, _node_count, _parent
  • copy_copy: _list
  • hash_exclude: _parent
  • generate_exclude: _node_count, _parent
  • _internal: _id, _list, _name, _node_count, _parent
  • repr_exclude: _list, _parent
  • eq_exclude: _parent
  • getstate_exclude: _parent
  • str_exclude: _id, _list, _name, _node_count, _parent
iterate(node, **kwargs)
class syn.tree.b.query.Root(**kwargs)

Bases: syn.tree.b.query.Axis

Keyword-Only Arguments:

_id [Optional]: int
Integer id of the node
_list: list
Child nodes
_name [Optional]: basestring
Name of the node (for display purposes)
_node_count: int
The number of nodes in the subtreerooted by this node.
_parent [Optional]: Node
Parent of this node

Class Options:

  • args: ()
  • autodoc: True
  • coerce_args: False
  • descendant_exclude: ()
  • id_equality: False
  • init_validate: False
  • make_hashable: False
  • make_type_object: True
  • max_len: 1
  • min_len: None
  • must_be_root: False
  • optional_none: True
  • register_subclasses: False
  • repr_template:
  • coerce_hooks: ()
  • create_hooks: ()
  • init_hooks: ()
  • init_order: ()
  • metaclass_lookup: (‘coerce_hooks’, ‘init_hooks’, ‘create_hooks’, ‘setstate_hooks’)
  • setstate_hooks: ()

Aliases:

  • _list: _children

Groups:

  • _all: _id, _list, _name, _node_count, _parent
  • copy_copy: _list
  • hash_exclude: _parent
  • generate_exclude: _node_count, _parent
  • _internal: _id, _list, _name, _node_count, _parent
  • repr_exclude: _list, _parent
  • eq_exclude: _parent
  • getstate_exclude: _parent
  • str_exclude: _id, _list, _name, _node_count, _parent
iterate(node, **kwargs)
class syn.tree.b.query.Self(**kwargs)

Bases: syn.tree.b.query.Axis

Keyword-Only Arguments:

_id [Optional]: int
Integer id of the node
_list: list
Child nodes
_name [Optional]: basestring
Name of the node (for display purposes)
_node_count: int
The number of nodes in the subtreerooted by this node.
_parent [Optional]: Node
Parent of this node

Class Options:

  • args: ()
  • autodoc: True
  • coerce_args: False
  • descendant_exclude: ()
  • id_equality: False
  • init_validate: False
  • make_hashable: False
  • make_type_object: True
  • max_len: 1
  • min_len: None
  • must_be_root: False
  • optional_none: True
  • register_subclasses: False
  • repr_template:
  • coerce_hooks: ()
  • create_hooks: ()
  • init_hooks: ()
  • init_order: ()
  • metaclass_lookup: (‘coerce_hooks’, ‘init_hooks’, ‘create_hooks’, ‘setstate_hooks’)
  • setstate_hooks: ()

Aliases:

  • _list: _children

Groups:

  • _all: _id, _list, _name, _node_count, _parent
  • copy_copy: _list
  • hash_exclude: _parent
  • generate_exclude: _node_count, _parent
  • _internal: _id, _list, _name, _node_count, _parent
  • repr_exclude: _list, _parent
  • eq_exclude: _parent
  • getstate_exclude: _parent
  • str_exclude: _id, _list, _name, _node_count, _parent
iterate(node, **kwargs)
class syn.tree.b.query.Sibling(**kwargs)

Bases: syn.tree.b.query.Axis

Keyword-Only Arguments:

_id [Optional]: int
Integer id of the node
_list: list
Child nodes
_name [Optional]: basestring
Name of the node (for display purposes)
_node_count: int
The number of nodes in the subtreerooted by this node.
_parent [Optional]: Node
Parent of this node

following (default = False): bool preceding (default = False): bool

Class Options:

  • args: ()
  • autodoc: True
  • coerce_args: False
  • descendant_exclude: ()
  • id_equality: False
  • init_validate: False
  • make_hashable: False
  • make_type_object: True
  • max_len: 1
  • min_len: None
  • must_be_root: False
  • one_true: [(‘following’, ‘preceding’)]
  • optional_none: True
  • register_subclasses: False
  • repr_template:
  • coerce_hooks: ()
  • create_hooks: ()
  • init_hooks: ()
  • init_order: ()
  • metaclass_lookup: (‘coerce_hooks’, ‘init_hooks’, ‘create_hooks’, ‘setstate_hooks’)
  • setstate_hooks: ()

Aliases:

  • _list: _children

Groups:

  • _all: _id, _list, _name, _node_count, _parent, following, preceding
  • copy_copy: _list
  • hash_exclude: _parent
  • generate_exclude: _node_count, _parent
  • _internal: _id, _list, _name, _node_count, _parent
  • repr_exclude: _list, _parent
  • eq_exclude: _parent
  • getstate_exclude: _parent
  • str_exclude: _id, _list, _name, _node_count, _parent
iterate(node, **kwargs)
class syn.tree.b.query.Type(type=<syn.type.a.type.AnyType object at 0x7ff9cfd0ec50>, **kwargs)

Bases: syn.tree.b.query.Query

Positional Arguments:

type (default = <syn.type.a.type.AnyType object at 0x7ff9cfd0ec50>): Type

Keyword-Only Arguments:

_id [Optional]: int
Integer id of the node
_list: list
Child nodes
_name [Optional]: basestring
Name of the node (for display purposes)
_node_count: int
The number of nodes in the subtreerooted by this node.
_parent [Optional]: Node
Parent of this node

Class Options:

  • args: (‘type’,)
  • autodoc: True
  • coerce_args: False
  • descendant_exclude: ()
  • id_equality: False
  • init_validate: False
  • make_hashable: False
  • make_type_object: True
  • max_len: 1
  • min_len: None
  • must_be_root: False
  • optional_none: True
  • register_subclasses: False
  • repr_template:
  • coerce_hooks: ()
  • create_hooks: ()
  • init_hooks: ()
  • init_order: ()
  • metaclass_lookup: (‘coerce_hooks’, ‘init_hooks’, ‘create_hooks’, ‘setstate_hooks’)
  • setstate_hooks: ()

Aliases:

  • _list: _children

Groups:

  • _all: _id, _list, _name, _node_count, _parent, type
  • copy_copy: _list
  • hash_exclude: _parent
  • generate_exclude: _node_count, _parent
  • _internal: _id, _list, _name, _node_count, _parent
  • repr_exclude: _list, _parent
  • eq_exclude: _parent
  • getstate_exclude: _parent
  • str_exclude: _id, _list, _name, _node_count, _parent
iterate(node, **kwargs)
class syn.tree.b.query.Value(value, **kwargs)

Bases: syn.tree.b.query.Query

Positional Arguments:

value: any

Keyword-Only Arguments:

_id [Optional]: int
Integer id of the node
_list: list
Child nodes
_name [Optional]: basestring
Name of the node (for display purposes)
_node_count: int
The number of nodes in the subtreerooted by this node.
_parent [Optional]: Node
Parent of this node

Class Options:

  • args: (‘value’,)
  • autodoc: True
  • coerce_args: False
  • descendant_exclude: ()
  • id_equality: False
  • init_validate: False
  • make_hashable: False
  • make_type_object: True
  • max_len: 0
  • min_len: None
  • must_be_root: False
  • optional_none: True
  • register_subclasses: False
  • repr_template:
  • coerce_hooks: ()
  • create_hooks: ()
  • init_hooks: ()
  • init_order: ()
  • metaclass_lookup: (‘coerce_hooks’, ‘init_hooks’, ‘create_hooks’, ‘setstate_hooks’)
  • setstate_hooks: ()

Aliases:

  • _list: _children

Groups:

  • _all: _id, _list, _name, _node_count, _parent, value
  • copy_copy: _list
  • hash_exclude: _parent
  • generate_exclude: _node_count, _parent
  • _internal: _id, _list, _name, _node_count, _parent
  • repr_exclude: _list, _parent
  • eq_exclude: _parent
  • getstate_exclude: _parent
  • str_exclude: _id, _list, _name, _node_count, _parent
class syn.tree.b.query.Where(**kwargs)

Bases: syn.tree.b.query.Query

Keyword-Only Arguments:

_id [Optional]: int
Integer id of the node
_list: list
Child nodes
_name [Optional]: basestring
Name of the node (for display purposes)
_node_count: int
The number of nodes in the subtreerooted by this node.
_parent [Optional]: Node
Parent of this node

Class Options:

  • args: ()
  • autodoc: True
  • coerce_args: False
  • descendant_exclude: ()
  • id_equality: False
  • init_validate: False
  • make_hashable: False
  • make_type_object: True
  • max_len: 2
  • min_len: 2
  • must_be_root: False
  • optional_none: True
  • register_subclasses: False
  • repr_template:
  • coerce_hooks: ()
  • create_hooks: ()
  • init_hooks: ()
  • init_order: ()
  • metaclass_lookup: (‘coerce_hooks’, ‘init_hooks’, ‘create_hooks’, ‘setstate_hooks’)
  • setstate_hooks: ()

Aliases:

  • _list: _children

Groups:

  • _all: _id, _list, _name, _node_count, _parent
  • copy_copy: _list
  • hash_exclude: _parent
  • generate_exclude: _node_count, _parent
  • _internal: _id, _list, _name, _node_count, _parent
  • repr_exclude: _list, _parent
  • eq_exclude: _parent
  • getstate_exclude: _parent
  • str_exclude: _id, _list, _name, _node_count, _parent
cond

itemgetter(item, ...) –> itemgetter object

Return a callable object that fetches the given item(s) from its operand. After f = itemgetter(2), the call f(r) returns r[2]. After g = itemgetter(2, 5, 3), the call g(r) returns (r[2], r[5], r[3])

node

itemgetter(item, ...) –> itemgetter object

Return a callable object that fetches the given item(s) from its operand. After f = itemgetter(2), the call f(r) returns r[2]. After g = itemgetter(2, 5, 3), the call g(r) returns (r[2], r[5], r[3])

syn.tree.b.tree module

class syn.tree.b.tree.Tree(root, **kwargs)

Bases: syn.base.b.base.Base

Positional Arguments:

root: Node
The root node of the tree

Keyword-Only Arguments:

id_dict: dict (any => Node)
Mapping of ids to nodes
node_counter: Counter
Node id counter
node_types: list (basestring)
List of all tree node types
nodes: list (Node)
List of all tree nodes
type_dict: dict (any => list (Node))
Mapping of type names to node lists

Class Options:

  • args: (‘root’,)
  • autodoc: True
  • coerce_args: False
  • id_equality: False
  • init_validate: True
  • make_hashable: False
  • make_type_object: True
  • optional_none: False
  • register_subclasses: False
  • repr_template:
  • coerce_hooks: ()
  • create_hooks: ()
  • init_hooks: ()
  • init_order: ()
  • metaclass_lookup: (‘coerce_hooks’, ‘init_hooks’, ‘create_hooks’, ‘setstate_hooks’)
  • setstate_hooks: ()

Groups:

  • _all: id_dict, node_counter, node_types, nodes, root, type_dict
  • generate_exclude: id_dict, node_counter, node_types, nodes, type_dict
  • eq_exclude: node_counter
  • str_exclude: id_dict, node_counter, node_types, nodes, type_dict
add_node(node, **kwargs)
depth_first(node=<function do_nothing>, stop_test=<function do_nothing>, _return=<function identity>, current_node='root', **kwargs)
find_one(*args, **kwargs)
get_node_by_id(node_id)
query(q, context=None)
rebuild(**kwargs)

Repopulate the node-tracking data structures. Shouldn’t really ever be needed.

remove_node(node, **kwargs)
replace_node(source, dest, **kwargs)
search_rootward(node=<function do_nothing>, stop_test=<function do_nothing>, _return=<function identity>, current_node='root', **kwargs)
validate()
syn.tree.b.tree.do_nothing(*args, **kwargs)
syn.tree.b.tree.identity(x)

Module contents