Given a dotted module path to a function (e.g. 'myapp.tasks.my_func'), import that module and return the function.
(dotted_path: str)
| 143 | |
| 144 | |
| 145 | def import_and_get_function(dotted_path: str) -> Any: |
| 146 | """ |
| 147 | Given a dotted module path to a function (e.g. 'myapp.tasks.my_func'), |
| 148 | import that module and return the function. |
| 149 | """ |
| 150 | module, function = dotted_path.rsplit(".", 1) |
| 151 | app_module = importlib.import_module(module) |
| 152 | return getattr(app_module, function) |
| 153 | |
| 154 | |
| 155 | def human_size(num: float, suffix: str = "B") -> str: |
no outgoing calls
no test coverage detected