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

Method get

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

Source from the content-addressed store, hash-verified

575 return [(k, self[k]) for k in self.keys(dotted=True)]
576
577 def get(self, key, default=NO_DEFAULT):
578 if key not in self:
579 if default is NO_DEFAULT:
580 if self._box_config["default_box"] and self._box_config["default_box_none_transform"]:
581 return self.__get_default(key)
582 else:
583 return None
584 if isinstance(default, dict) and not isinstance(default, Box):
585 return self._box_config["box_class"](default, **self.__box_config(extra_namespace=key))
586 if isinstance(default, list) and not isinstance(default, box.BoxList):
587 return box.BoxList(default, **self.__box_config(extra_namespace=key))
588 return default
589 return self[key]
590
591 def __copy_internals(self, new, deep=False, memo=None):
592 """Carry instance-only attributes listed in `_box_internal_attrs`, and comments, over to `new`."""

Calls 2

__get_defaultMethod · 0.95
__box_configMethod · 0.95