Walk tree and call func on every node starting from the bottom-most nodes. Parameters ---------- func : callable Callable accepting :class:`BaseNode` as the first param and optional positional and keyword arguments args :
(self, func, args=(), kwargs=None, decompose=True)
| 383 | subnode.walk(func, args, kwargs, decompose) |
| 384 | |
| 385 | def walk_depth(self, func, args=(), kwargs=None, decompose=True): |
| 386 | """ |
| 387 | Walk tree and call func on every node starting from the bottom-most |
| 388 | nodes. |
| 389 | |
| 390 | Parameters |
| 391 | ---------- |
| 392 | func : callable |
| 393 | Callable accepting :class:`BaseNode` as the first param and |
| 394 | optional positional and keyword arguments |
| 395 | args : |
| 396 | func params |
| 397 | kwargs : |
| 398 | func keyword params |
| 399 | decompose : bool, optional |
| 400 | (default: False) |
| 401 | """ |
| 402 | if kwargs is None: |
| 403 | kwargs = {} |
| 404 | if self.level < self.maxlevel: |
| 405 | for part in self.PARTS: |
| 406 | subnode = self.get_subnode(part, decompose) |
| 407 | if subnode is not None: |
| 408 | subnode.walk_depth(func, args, kwargs, decompose) |
| 409 | func(self, *args, **kwargs) |
| 410 | |
| 411 | def __str__(self): |
| 412 | return self.path + ": " + str(self.data) |
nothing calls this directly
no test coverage detected