Get all output keys of all layers This will in most cases _not_ materialize any layers, which makes it a relative cheap operation. Returns ------- keys: set A set of all external keys
(self)
| 578 | return self.to_dict().keys() |
| 579 | |
| 580 | def get_all_external_keys(self) -> set[Key]: |
| 581 | """Get all output keys of all layers |
| 582 | |
| 583 | This will in most cases _not_ materialize any layers, which makes |
| 584 | it a relative cheap operation. |
| 585 | |
| 586 | Returns |
| 587 | ------- |
| 588 | keys: set |
| 589 | A set of all external keys |
| 590 | """ |
| 591 | try: |
| 592 | return self._all_external_keys |
| 593 | except AttributeError: |
| 594 | keys: set = set() |
| 595 | for layer in self.layers.values(): |
| 596 | # Note: don't use `keys |= ...`, because the RHS is a |
| 597 | # collections.abc.Set rather than a real set, and this will |
| 598 | # cause a whole new set to be constructed. |
| 599 | keys.update(layer.get_output_keys()) |
| 600 | self._all_external_keys = keys |
| 601 | return keys |
| 602 | |
| 603 | def items(self) -> ItemsView[Key, Any]: |
| 604 | return self.to_dict().items() |
no test coverage detected