MCPcopy Create free account
hub / github.com/MAC-VO/MAC-VO / __getattribute__

Method __getattribute__

Utility/Extensions/TensorExtension.py:124–132  ·  view source on GitHub ↗
(self, name: str)

Source from the content-addressed store, hash-verified

122
123 # A further enhancement - we want AutoScale to behave exactly like the tensor it contains
124 def __getattribute__(self, name: str):
125 if name in {'_tensor', 'tensor', 'push', '__class__'}:
126 return object.__getattribute__(self, name)
127 try:
128 return object.__getattribute__(self, name)
129 except AttributeError:
130 # If it's not a class attribute, delegate to the tensor
131 tensor = object.__getattribute__(self, 'tensor')
132 return getattr(tensor, name)
133
134 # Magic methods cannot be forwarded automatically, so has to do this
135 def __getitem__(self, slice): return self.tensor.__getitem__(slice)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected