Traverses the object name and returns the last (rightmost) python object.
(module: types.ModuleType, obj_name: str)
| 275 | |
| 276 | |
| 277 | def get_obj_from_module(module: types.ModuleType, obj_name: str) -> Any: |
| 278 | """Traverses the object name and returns the last (rightmost) python object.""" |
| 279 | if obj_name == '': |
| 280 | return module |
| 281 | obj = module |
| 282 | for part in obj_name.split("."): |
| 283 | obj = getattr(obj, part) |
| 284 | return obj |
| 285 | |
| 286 | |
| 287 | def get_obj_by_name(name: str) -> Any: |
no outgoing calls
no test coverage detected