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

Method __setattr__

box/strict_box.py:89–102  ·  view source on GitHub ↗
(self, key, value)

Source from the content-addressed store, hash-verified

87 """
88
89 def __setattr__(self, key, value):
90 if key == "_box_config" or key in self._box_internal_attrs:
91 return super().__setattr__(key, value)
92
93 config = self._box_config
94 if config["__created"] and not config["frozen_box"] and key not in self._protected_keys:
95 resolved = config["__safe_keys"].get(self._safe_attr(key), key)
96 if _get_property_func(self, resolved)[1] is None:
97 if not _existing_destination(self, resolved):
98 raise BoxKeyError(
99 f'Cannot create field "{key}" through attribute assignment; use item assignment instead'
100 )
101
102 return super().__setattr__(key, value)

Callers

nothing calls this directly

Calls 5

_get_property_funcFunction · 0.90
BoxKeyErrorClass · 0.90
_existing_destinationFunction · 0.85
getMethod · 0.80
_safe_attrMethod · 0.80

Tested by

no test coverage detected