moved compile_list_of_regexes to profiles_filtering and moved it's import in openpype.lib earlier

This commit is contained in:
iLLiCiTiT 2021-09-16 11:49:37 +02:00
parent 0631a7d9b9
commit 95424cdfc7
3 changed files with 26 additions and 25 deletions

View file

@ -59,6 +59,11 @@ from .python_module_tools import (
import_module_from_dirpath
)
from .profiles_filtering import (
compile_list_of_regexes,
filter_profiles
)
from .avalon_context import (
CURRENT_DOC_SCHEMAS,
PROJECT_NAME_ALLOWED_SYMBOLS,
@ -118,13 +123,9 @@ from .applications import (
prepare_host_environments,
prepare_context_environments,
get_app_environments_for_context,
apply_project_environments_value,
compile_list_of_regexes
apply_project_environments_value
)
from .profiles_filtering import filter_profiles
from .plugin_tools import (
TaskNotSetError,
get_subset_name,

View file

@ -25,6 +25,7 @@ from . import (
PypeLogger,
Anatomy
)
from .profiles_filtering import compile_list_of_regexes
from .local_settings import get_openpype_username
from .avalon_context import (
get_workdir_data,
@ -1495,22 +1496,3 @@ def should_workfile_tool_start(
return get_option_from_settings(
startup_presets, host_name, task_name, default_output)
def compile_list_of_regexes(in_list):
"""Convert strings in entered list to compiled regex objects."""
regexes = list()
if not in_list:
return regexes
for item in in_list:
if not item:
continue
try:
regexes.append(re.compile(item))
except TypeError:
print((
"Invalid type \"{}\" value \"{}\"."
" Expected string based object. Skipping."
).format(str(type(item)), str(item)))
return regexes

View file

@ -1,10 +1,28 @@
import re
import logging
from .applications import compile_list_of_regexes
log = logging.getLogger(__name__)
def compile_list_of_regexes(in_list):
"""Convert strings in entered list to compiled regex objects."""
regexes = list()
if not in_list:
return regexes
for item in in_list:
if not item:
continue
try:
regexes.append(re.compile(item))
except TypeError:
print((
"Invalid type \"{}\" value \"{}\"."
" Expected string based object. Skipping."
).format(str(type(item)), str(item)))
return regexes
def _profile_exclusion(matching_profiles, logger):
"""Find out most matching profile byt host, task and family match.