(self, attr)
| 240 | return super().__str__() |
| 241 | |
| 242 | def __getattribute__(self, attr): |
| 243 | if attr in ('setfield', 'getfield', 'dtype'): |
| 244 | return nt.void.__getattribute__(self, attr) |
| 245 | try: |
| 246 | return nt.void.__getattribute__(self, attr) |
| 247 | except AttributeError: |
| 248 | pass |
| 249 | fielddict = nt.void.__getattribute__(self, 'dtype').fields |
| 250 | res = fielddict.get(attr, None) |
| 251 | if res: |
| 252 | obj = self.getfield(*res[:2]) |
| 253 | # if it has fields return a record, |
| 254 | # otherwise return the object |
| 255 | try: |
| 256 | dt = obj.dtype |
| 257 | except AttributeError: |
| 258 | #happens if field is Object type |
| 259 | return obj |
| 260 | if dt.names is not None: |
| 261 | return obj.view((self.__class__, obj.dtype)) |
| 262 | return obj |
| 263 | else: |
| 264 | raise AttributeError("'record' object has no " |
| 265 | "attribute '%s'" % attr) |
| 266 | |
| 267 | def __setattr__(self, attr, val): |
| 268 | if attr in ('setfield', 'getfield', 'dtype'): |
no test coverage detected