sort out mypy after its update

This commit is contained in:
Dima Gerasimov 2023-06-21 03:13:58 +01:00
parent 47aa3e61b9
commit 73e267a67b
2 changed files with 4 additions and 5 deletions

View file

@ -52,9 +52,9 @@ def locate_function(module_name: str, function_name: str) -> Callable[[], Iterab
"""
try:
mod = importlib.import_module(module_name)
for (fname, func) in inspect.getmembers(mod, inspect.isfunction):
for (fname, f) in inspect.getmembers(mod, inspect.isfunction):
if fname == function_name:
return func
return f
# in case the function is defined dynamically,
# like with a globals().setdefault(...) or a module-level __getattr__ function
func = getattr(mod, function_name, None)