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

Method __recast

box/box.py:563–573  ·  view source on GitHub ↗
(self, item, value)

Source from the content-addressed store, hash-verified

561 return out
562
563 def __recast(self, item, value):
564 if self._box_config["box_recast"] and item in self._box_config["box_recast"]:
565 recast = self._box_config["box_recast"][item]
566 try:
567 if isinstance(recast, type) and issubclass(recast, (Box, box.BoxList)):
568 return recast(value, **self.__box_config())
569 else:
570 return recast(value)
571 except ValueError as err:
572 raise BoxValueError(f"Cannot convert {value} to {recast}") from _exception_cause(err)
573 return value
574
575 def __convert_and_store(self, item, value):
576 if self._box_config["conversion_box"]:

Callers 1

__setitem__Method · 0.95

Calls 3

__box_configMethod · 0.95
BoxValueErrorClass · 0.90
_exception_causeFunction · 0.85

Tested by

no test coverage detected