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

Method get

box/box.py:568–580  ·  view source on GitHub ↗
(self, key, default=NO_DEFAULT)

Source from the content-addressed store, hash-verified

566 return [(k, self[k]) for k in self.keys(dotted=True)]
567
568 def get(self, key, default=NO_DEFAULT):
569 if key not in self:
570 if default is NO_DEFAULT:
571 if self._box_config["default_box"] and self._box_config["default_box_none_transform"]:
572 return self.__get_default(key)
573 else:
574 return None
575 if isinstance(default, dict) and not isinstance(default, Box):
576 return Box(default)
577 if isinstance(default, list) and not isinstance(default, box.BoxList):
578 return box.BoxList(default)
579 return default
580 return self[key]
581
582 def __copy_internals(self, new, deep=False, memo=None):
583 """Carry instance-only attributes listed in `_box_internal_attrs`, and comments, over to `new`."""

Calls 2

__get_defaultMethod · 0.95
BoxClass · 0.85