__call__(self,
*subpath,
**kargs)
(Call operator)
| source code
|
Readout the value of a node, or an attribute. The name binding
of the path is provided as a tuple of path items.
- Args:
- subpath:
The list of keys constituting a branch of a data tree.
The subpath is treated as a branch of one of the nodes
of a provided searchpath - which is by default the top node.
The supported values are:
subpath := <list-of-node-ids>
<list-of-node-ids> := <node-id> [',' <list-of-node-ids>]
node-id := (
str # string: dict
| int # integer: lists, tuple, dict
)
The value of the node within data:
nodeid := (
<single-nodeid>
| <list-of-nodeids>
| <tuple-of-nodeids>
)
single-nodeid := <nodeid>
list-of-nodeids := '[' <nodeidlists> ']'
tuple-of-nodeids := '(' <nodeidlists> ')'
nodeidlists := <nodeid> [',' <nodeidlists>]
nodeid := (
ItemKey
| ListIndex
)
ItemKey := "valid dict-key"
ListIndex := "valid list-index"
The derived syntax classes may impose specific constraints.
Thus it is recommended to use integers and strings only
for maximum compatibility, and the ease of using mixed syntaxes:
ItemKey := str # string: dict
ListIndex := int # integer: lists, tuple, dict
- kargs:
- searchpath:
Optional search path for the match of the provided
address subpath. The provided subpath is applied
to each node of the searchpath in accordance to the
direction option. This provides the search and
enumeration of side branches:
searchpath := <path-item-list>
path-item-list := <path-item> [, <path-item-list>]
path-item := (
str # item name
| int # item index
)
default := <top-node>
The search path entries has to be actually present by default.
These could be either created by loading a complete tree
structure, or by using the Capabilities.create() member.
See also parameter 'strict'.
- direction:
The search direction of the subpath within the
searchpath. In case of multiple superpositioned
attributes the first traversed match.
The provided values are:
direction := (
up | 0 | False # search from right-to-left
| down | 1 | True # search from left-to-right
)
default:= up
- match:
Sets the match criteria for the search operation.
Interferes with direction:
match := (
M_FIRST | 'first' # use first matching node
| M_LAST | 'last' # use last matching node
| M_ALL | 'all' # use all - iterate all matches
)
default := M_FIRST
- partial:
Enables the return of partial sub paths in case the requested
path is not completely present.
partial := (
True # when not completely present, the longest
# existing part is returned, the completeness
# is provided by the result attribute <partial>
| False # when not completely present an exception
# is raised
)
- strict:
Controls the required consistency. This comprises:
the presence of the search path entries
the presence of the requested subpath within the set
of search paths
- pysyn:
Activates full Python syntax. This in particular enables all
container types of intermediate nodes for arbitrary paths.
Includes tuple, set, frozenset, etc.
pysyn := (
True # allows all python types as container nodes
| False # allows list and dict only as container nodes
)
default := False
- Returns:
In case of a match returns the tuple:
return := (<attr-value-path>, <attr-value>, <partial>)
attr-value-path := (
"the list of keys of the top-down path"
| "empty list when no item exists" # see <complete>
)
attr-value := "value of the targeted node/attribute"
partial := (
False # the complete requested path
| True # the actually present part of the path
)
Else raises YapyDataDataTreeOidError.
- Raises:
YapyDataDataTreeOidError
pass-through
- Decorators:
|