MCPcopy Create free account
hub / github.com/InternRobotics/EmbodiedScan / __setattr__

Method __setattr__

embodiedscan/utils/typing_config.py:77–94  ·  view source on GitHub ↗

setattr is only used to set data. The value must have the attribute of `__len__` and have the same length of `PointData`.

(self, name: str, value: Sized)

Source from the content-addressed store, hash-verified

75 """
76
77 def __setattr__(self, name: str, value: Sized) -> None:
78 """setattr is only used to set data.
79
80 The value must have the attribute of `__len__` and have the same length
81 of `PointData`.
82 """
83 if name in ('_metainfo_fields', '_data_fields'):
84 if not hasattr(self, name):
85 super().__setattr__(name, value)
86 else:
87 raise AttributeError(f'{name} has been used as a '
88 'private attribute, which is immutable.')
89
90 else:
91 assert isinstance(value,
92 Sized), 'value must contain `__len__` attribute'
93 # TODO: make sure the input value share the same length
94 super().__setattr__(name, value)
95
96 __setitem__ = __setattr__
97

Callers 4

_init_layersMethod · 0.80
__init__Method · 0.80
_init_layersMethod · 0.80
_init_layersMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected