MCPcopy
hub / github.com/Vchitect/Latte / get_obj_from_module

Function get_obj_from_module

tools/dnnlib/util.py:266–273  ·  view source on GitHub ↗

Traverses the object name and returns the last (rightmost) python object.

(module: types.ModuleType, obj_name: str)

Source from the content-addressed store, hash-verified

264
265
266def get_obj_from_module(module: types.ModuleType, obj_name: str) -> Any:
267 """Traverses the object name and returns the last (rightmost) python object."""
268 if obj_name == '':
269 return module
270 obj = module
271 for part in obj_name.split("."):
272 obj = getattr(obj, part)
273 return obj
274
275
276def get_obj_by_name(name: str) -> Any:

Callers 2

get_module_from_obj_nameFunction · 0.85
get_obj_by_nameFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected