pumpwood_communication.aux
General auxiliary functions for Pumpwood Communications.
1"""General auxiliary functions for Pumpwood Communications.""" 2import importlib 3from typing import Any, Callable 4 5 6def import_function_by_string(module: str | Any) -> Callable: 7 """Help importing a function using a string or function if not string.""" 8 if not isinstance(module, str): 9 return module 10 11 module_name, function_name = module.rsplit('.', 1) 12 module = importlib.import_module(module_name) 13 func = getattr(module, function_name) 14 return func
def
import_function_by_string(module: str | typing.Any) -> Callable:
7def import_function_by_string(module: str | Any) -> Callable: 8 """Help importing a function using a string or function if not string.""" 9 if not isinstance(module, str): 10 return module 11 12 module_name, function_name = module.rsplit('.', 1) 13 module = importlib.import_module(module_name) 14 func = getattr(module, function_name) 15 return func
Help importing a function using a string or function if not string.