mirror of
ssh://git.janware.com/srv/git/janware/proj/jw-python
synced 2026-01-15 09:53:32 +01:00
misc: Add load_function()
Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
e004f8ade7
commit
cc7aeeac31
1 changed files with 4 additions and 0 deletions
|
|
@ -105,6 +105,10 @@ def load_class_names(path, baseclass, flt=None, remove_flt=False): # export
|
||||||
def load_object(module_path, baseclass, class_name_filter=None, *args, **kwargs): # export
|
def load_object(module_path, baseclass, class_name_filter=None, *args, **kwargs): # export
|
||||||
return load_class(module_path, baseclass, class_name_filter=class_name_filter)(*args, **kwargs)
|
return load_class(module_path, baseclass, class_name_filter=class_name_filter)(*args, **kwargs)
|
||||||
|
|
||||||
|
def load_function(module_path, name): # export
|
||||||
|
mod = importlib.import_module(module_path)
|
||||||
|
return getattr(mod, name)
|
||||||
|
|
||||||
def commit_tmpfile(tmp: str, path: str) -> None: # export
|
def commit_tmpfile(tmp: str, path: str) -> None: # export
|
||||||
caller = log.get_caller_pos()
|
caller = log.get_caller_pos()
|
||||||
if os.path.isfile(path) and filecmp.cmp(tmp, path):
|
if os.path.isfile(path) and filecmp.cmp(tmp, path):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue