pandagg.tree.mapping module¶
-
class
pandagg.tree.mapping.
Mapping
(from_=None, identifier=None, properties=None, dynamic=False)[source]¶ Bases:
pandagg.tree._tree.Tree
-
node_class
¶ alias of
pandagg.node.mapping.abstract.Field
-
show
(data_property='pretty', **kwargs)[source]¶ Print the tree structure in hierarchy style.
You have three ways to output your tree data, i.e., stdout with
show()
, plain text file withsave2file()
, and json string withto_json()
. The former two use the same backend to generate a string of tree structure in a text graph.- Version >= 1.2.7a*: you can also specify the
line_type
parameter, such as ‘ascii’ (default), ‘ascii-ex’, ‘ascii-exr’, ‘ascii-em’, ‘ascii-emv’, ‘ascii-emh’) to the change graphical form.
Parameters: - nid – the reference node to start expanding.
- level – the node level in the tree (root as level 0).
- idhidden – whether hiding the node ID when printing.
- filter – the function of one variable to act on the
Node
object. When this parameter is specified, the traversing will not continue to following children of node whose condition does not pass the filter. - key – the
key
param for sortingNode
objects in the same level. - reverse – the
reverse
param for sortingNode
objects in the same level. - line_type –
- data_property – the property on the node data object to be printed.
Returns: None
- Version >= 1.2.7a*: you can also specify the
-
validate_agg_node
(agg_node, exc=True)[source]¶ Ensure if node has field or path that it exists in mapping, and that required aggregation type if allowed on this kind of field. :param agg_node: AggNode you want to validate on this mapping :param exc: boolean, if set to True raise exception if invalid :rtype: boolean
-