MCPcopy Create free account
hub / github.com/MotrixLab/AiOS / new

Method new

detrsmpl/data/data_structures/human_data.py:178–200  ·  view source on GitHub ↗

Construct a HumanData instance from a dict. Args: source_dict (dict, optional): A dict with items in HumanData fashion. Defaults to None. key_strict (bool, optional): Whether to raise error when setting unsupported keys

(cls,
            source_dict: dict = None,
            key_strict: bool = False)

Source from the content-addressed store, hash-verified

176
177 @classmethod
178 def new(cls,
179 source_dict: dict = None,
180 key_strict: bool = False) -> _HumanData:
181 """Construct a HumanData instance from a dict.
182
183 Args:
184 source_dict (dict, optional):
185 A dict with items in HumanData fashion.
186 Defaults to None.
187 key_strict (bool, optional):
188 Whether to raise error when setting unsupported keys.
189 Defaults to False.
190
191 Returns:
192 HumanData:
193 A HumanData instance.
194 """
195 if source_dict is None:
196 ret_human_data = cls()
197 else:
198 ret_human_data = cls(source_dict)
199 ret_human_data.set_key_strict(key_strict)
200 return ret_human_data
201
202 def get_key_strict(self) -> bool:
203 """Get value of attribute key_strict.

Callers 4

get_sliceMethod · 0.80
get_itemMethod · 0.80
get_sliceMethod · 0.80
concatenateMethod · 0.80

Calls 1

set_key_strictMethod · 0.80

Tested by

no test coverage detected