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)
| 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 |
no outgoing calls
no test coverage detected