mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 08:24:53 +01:00
renamed function 'load_module_from_dirpath' to 'import_module_from_dirpath'
This commit is contained in:
parent
49c649e36d
commit
4a5f015f4f
3 changed files with 9 additions and 9 deletions
|
|
@ -56,7 +56,7 @@ from .python_module_tools import (
|
||||||
modules_from_path,
|
modules_from_path,
|
||||||
recursive_bases_from_class,
|
recursive_bases_from_class,
|
||||||
classes_from_module,
|
classes_from_module,
|
||||||
load_module_from_dirpath
|
import_module_from_dirpath
|
||||||
)
|
)
|
||||||
|
|
||||||
from .avalon_context import (
|
from .avalon_context import (
|
||||||
|
|
@ -176,7 +176,7 @@ __all__ = [
|
||||||
"modules_from_path",
|
"modules_from_path",
|
||||||
"recursive_bases_from_class",
|
"recursive_bases_from_class",
|
||||||
"classes_from_module",
|
"classes_from_module",
|
||||||
"load_module_from_dirpath",
|
"import_module_from_dirpath",
|
||||||
|
|
||||||
"CURRENT_DOC_SCHEMAS",
|
"CURRENT_DOC_SCHEMAS",
|
||||||
"PROJECT_NAME_ALLOWED_SYMBOLS",
|
"PROJECT_NAME_ALLOWED_SYMBOLS",
|
||||||
|
|
|
||||||
|
|
@ -136,7 +136,7 @@ def classes_from_module(superclass, module):
|
||||||
return classes
|
return classes
|
||||||
|
|
||||||
|
|
||||||
def _load_module_from_dirpath_py2(dirpath, module_name, dst_module_name):
|
def _import_module_from_dirpath_py2(dirpath, module_name, dst_module_name):
|
||||||
full_module_name = "{}.{}".format(dst_module_name, module_name)
|
full_module_name = "{}.{}".format(dst_module_name, module_name)
|
||||||
if full_module_name in sys.modules:
|
if full_module_name in sys.modules:
|
||||||
return sys.modules[full_module_name]
|
return sys.modules[full_module_name]
|
||||||
|
|
@ -152,7 +152,7 @@ def _load_module_from_dirpath_py2(dirpath, module_name, dst_module_name):
|
||||||
return module
|
return module
|
||||||
|
|
||||||
|
|
||||||
def _load_module_from_dirpath_py3(dirpath, module_name, dst_module_name):
|
def _import_module_from_dirpath_py3(dirpath, module_name, dst_module_name):
|
||||||
full_module_name = "{}.{}".format(dst_module_name, module_name)
|
full_module_name = "{}.{}".format(dst_module_name, module_name)
|
||||||
if full_module_name in sys.modules:
|
if full_module_name in sys.modules:
|
||||||
return sys.modules[full_module_name]
|
return sys.modules[full_module_name]
|
||||||
|
|
@ -179,13 +179,13 @@ def _load_module_from_dirpath_py3(dirpath, module_name, dst_module_name):
|
||||||
return module
|
return module
|
||||||
|
|
||||||
|
|
||||||
def load_module_from_dirpath(dirpath, folder_name, dst_module_name):
|
def import_module_from_dirpath(dirpath, folder_name, dst_module_name):
|
||||||
if PY3:
|
if PY3:
|
||||||
module = _load_module_from_dirpath_py3(
|
module = _import_module_from_dirpath_py3(
|
||||||
dirpath, folder_name, dst_module_name
|
dirpath, folder_name, dst_module_name
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
module = _load_module_from_dirpath_py2(
|
module = _import_module_from_dirpath_py2(
|
||||||
dirpath, folder_name, dst_module_name
|
dirpath, folder_name, dst_module_name
|
||||||
)
|
)
|
||||||
return module
|
return module
|
||||||
|
|
|
||||||
|
|
@ -173,7 +173,7 @@ def load_modules(force=False):
|
||||||
# Import helper functions from lib
|
# Import helper functions from lib
|
||||||
from openpype.lib import (
|
from openpype.lib import (
|
||||||
import_filepath,
|
import_filepath,
|
||||||
load_module_from_dirpath
|
import_module_from_dirpath
|
||||||
)
|
)
|
||||||
|
|
||||||
# Change `sys.modules`
|
# Change `sys.modules`
|
||||||
|
|
@ -203,7 +203,7 @@ def load_modules(force=False):
|
||||||
# TODO add more logic how to define if folder is module or not
|
# TODO add more logic how to define if folder is module or not
|
||||||
# - check manifest and content of manifest
|
# - check manifest and content of manifest
|
||||||
if os.path.isdir(fullpath):
|
if os.path.isdir(fullpath):
|
||||||
module = load_module_from_dirpath(
|
module = import_module_from_dirpath(
|
||||||
dirpath, filename, modules_key
|
dirpath, filename, modules_key
|
||||||
)
|
)
|
||||||
module_name = filename
|
module_name = filename
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue