(self, nslots: int = 64, node_factory=None)
| 370 | """Node manager.""" |
| 371 | |
| 372 | def __init__(self, nslots: int = 64, node_factory=None) -> None: |
| 373 | super().__init__() |
| 374 | |
| 375 | self.registry = weakref.WeakValueDictionary() |
| 376 | |
| 377 | if nslots > 0: |
| 378 | cache = lrucacheextension.NodeCache(nslots) |
| 379 | elif nslots == 0: |
| 380 | cache = _NoCache() |
| 381 | else: |
| 382 | # nslots < 0 |
| 383 | cache = _DictCache(-nslots) |
| 384 | |
| 385 | self.cache = cache |
| 386 | |
| 387 | # node_factory(node_path) |
| 388 | self.node_factory = node_factory |
| 389 | |
| 390 | def register_node(self, node: Node, key: str | None) -> None: |
| 391 | """Register a node.""" |
nothing calls this directly
no test coverage detected