MCPcopy Create free account
hub / github.com/numpy/numpy / __setattr__

Method __setattr__

numpy/ma/core.py:6643–6653  ·  view source on GitHub ↗
(self, attr, value)

Source from the content-addressed store, hash-verified

6641 return self
6642
6643 def __setattr__(self, attr, value):
6644 if not self.__has_singleton():
6645 # allow the singleton to be initialized
6646 return super().__setattr__(attr, value)
6647 elif self is self.__singleton:
6648 raise AttributeError(
6649 f"attributes of {self!r} are not writeable")
6650 else:
6651 # duplicate instance - we can end up here from __array_finalize__,
6652 # where we set the __class__ attribute
6653 return super().__setattr__(attr, value)
6654
6655
6656masked = masked_singleton = MaskedConstant()

Callers

nothing calls this directly

Calls 1

__has_singletonMethod · 0.95

Tested by

no test coverage detected