Create a node.
(self, node: Node, key: str | None = None)
| 405 | self.registry[key] = node |
| 406 | |
| 407 | def cache_node(self, node: Node, key: str | None = None) -> None: |
| 408 | """Create a node.""" |
| 409 | if key is None: |
| 410 | key = node._v_pathname |
| 411 | |
| 412 | self.register_node(node, key) |
| 413 | if key in self.cache: |
| 414 | oldnode = self.cache.pop(key) |
| 415 | if oldnode is not node and oldnode._v_isopen: |
| 416 | raise RuntimeError( |
| 417 | "trying to cache a node with an " |
| 418 | "existing key: ``%s``" % key |
| 419 | ) |
| 420 | |
| 421 | self.cache[key] = node |
| 422 | |
| 423 | def get_node(self, key: str) -> Node: |
| 424 | """Return a node matching the input key.""" |
no test coverage detected