(self, attr)
| 213 | return super().__str__() |
| 214 | |
| 215 | def __getattribute__(self, attr): |
| 216 | if attr in ('setfield', 'getfield', 'dtype'): |
| 217 | return nt.void.__getattribute__(self, attr) |
| 218 | try: |
| 219 | return nt.void.__getattribute__(self, attr) |
| 220 | except AttributeError: |
| 221 | pass |
| 222 | fielddict = nt.void.__getattribute__(self, 'dtype').fields |
| 223 | res = fielddict.get(attr, None) |
| 224 | if res: |
| 225 | obj = self.getfield(*res[:2]) |
| 226 | # if it has fields return a record, |
| 227 | # otherwise return the object |
| 228 | try: |
| 229 | dt = obj.dtype |
| 230 | except AttributeError: |
| 231 | # happens if field is Object type |
| 232 | return obj |
| 233 | if dt.names is not None: |
| 234 | return obj.view((self.__class__, obj.dtype)) |
| 235 | return obj |
| 236 | else: |
| 237 | raise AttributeError(f"'record' object has no attribute '{attr}'") |
| 238 | |
| 239 | def __setattr__(self, attr, val): |
| 240 | if attr in ('setfield', 'getfield', 'dtype'): |
no test coverage detected