MCPcopy Index your code
hub / github.com/numpy/numpy / __setattr__

Method __setattr__

numpy/_core/records.py:239–249  ·  view source on GitHub ↗
(self, attr, val)

Source from the content-addressed store, hash-verified

237 raise AttributeError(f"'record' object has no attribute '{attr}'")
238
239 def __setattr__(self, attr, val):
240 if attr in ('setfield', 'getfield', 'dtype'):
241 raise AttributeError(f"Cannot set '{attr}' attribute")
242 fielddict = nt.void.__getattribute__(self, 'dtype').fields
243 res = fielddict.get(attr, None)
244 if res:
245 return self.setfield(val, *res[:2])
246 elif getattr(self, attr, None):
247 return nt.void.__setattr__(self, attr, val)
248 else:
249 raise AttributeError(f"'record' object has no attribute '{attr}'")
250
251 def __getitem__(self, indx):
252 obj = nt.void.__getitem__(self, indx)

Callers 1

__setattr__Method · 0.45

Calls 2

__getattribute__Method · 0.45
getMethod · 0.45

Tested by

no test coverage detected