MCPcopy Create free account
hub / github.com/TorchSSL/TorchSSL / __getattr__

Method __getattr__

custom_writer.py:151–168  ·  view source on GitHub ↗
(self, name)

Source from the content-addressed store, hash-verified

149
150
151 def __getattr__(self, name):
152 if name in self.tb_writer_funcs:
153 func = getattr(self, name, None)
154 # Return a wrapper for all functions.
155 def wrapper(tag, data, *args, **kwargs):
156 if func is not None:
157 if name not in self.tag_mode_exceptions:
158 tag = f"{tag}/{self.mode}"
159 func(tag, data, *args, global_step=self.step, **kwargs)
160
161 return wrapper
162 else:
163 # default __getattr__ function to get other attributes.
164 try:
165 attr = object.__getattr__(name)
166 except AttributeError:
167 raise AttributeError("type object '{}' has no attribute '{}'".format(self.selected_module, name))
168 return attr
169

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected