MCPcopy Create free account
hub / github.com/cdgriffith/Box / keys

Method keys

box/box.py:545–566  ·  view source on GitHub ↗
(self, dotted: bool = False)

Source from the content-addressed store, hash-verified

543 return False
544
545 def keys(self, dotted: bool = False):
546 if not dotted:
547 return super().keys()
548
549 if not self._box_config["box_dots"]:
550 raise BoxError("Cannot return dotted keys as this Box does not have `box_dots` enabled")
551
552 keys = set()
553 for key, value in self.items():
554 added = False
555 if isinstance(key, str):
556 if isinstance(value, Box):
557 for sub_key in value.keys(dotted=True):
558 keys.add(f"{key}.{sub_key}")
559 added = True
560 elif isinstance(value, box.BoxList):
561 for pos in value._dotted_helper():
562 keys.add(f"{key}{pos}")
563 added = True
564 if not added:
565 keys.add(key)
566 return sorted(keys, key=lambda x: str(x))
567
568 def items(self, dotted: bool = False):
569 if not dotted:

Calls 3

itemsMethod · 0.95
BoxErrorClass · 0.90
_dotted_helperMethod · 0.80