mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 08:24:53 +01:00
Merge pull request #2903 from pypeclub/feature/nuke-improve-code-readebility
Nuke: improving readability
This commit is contained in:
commit
406247ad26
1 changed files with 25 additions and 41 deletions
|
|
@ -24,7 +24,11 @@ class ExtractReviewDataMov(openpype.api.Extractor):
|
||||||
outputs = {}
|
outputs = {}
|
||||||
|
|
||||||
def process(self, instance):
|
def process(self, instance):
|
||||||
families = instance.data["families"]
|
families = set(instance.data["families"])
|
||||||
|
|
||||||
|
# add main family to make sure all families are compared
|
||||||
|
families.add(instance.data["family"])
|
||||||
|
|
||||||
task_type = instance.context.data["taskType"]
|
task_type = instance.context.data["taskType"]
|
||||||
subset = instance.data["subset"]
|
subset = instance.data["subset"]
|
||||||
self.log.info("Creating staging dir...")
|
self.log.info("Creating staging dir...")
|
||||||
|
|
@ -50,51 +54,31 @@ class ExtractReviewDataMov(openpype.api.Extractor):
|
||||||
f_task_types = o_data["filter"]["task_types"]
|
f_task_types = o_data["filter"]["task_types"]
|
||||||
f_subsets = o_data["filter"]["sebsets"]
|
f_subsets = o_data["filter"]["sebsets"]
|
||||||
|
|
||||||
|
self.log.debug(
|
||||||
|
"f_families `{}` > families: {}".format(
|
||||||
|
f_families, families))
|
||||||
|
|
||||||
|
self.log.debug(
|
||||||
|
"f_task_types `{}` > task_type: {}".format(
|
||||||
|
f_task_types, task_type))
|
||||||
|
|
||||||
|
self.log.debug(
|
||||||
|
"f_subsets `{}` > subset: {}".format(
|
||||||
|
f_subsets, subset))
|
||||||
|
|
||||||
# test if family found in context
|
# test if family found in context
|
||||||
test_families = any([
|
# using intersection to make sure all defined
|
||||||
# first if exact family set is matching
|
# families are present in combination
|
||||||
# make sure only interesetion of list is correct
|
if f_families and not families.intersection(f_families):
|
||||||
bool(set(families).intersection(f_families)),
|
continue
|
||||||
# and if famiies are set at all
|
|
||||||
# if not then return True because we want this preset
|
|
||||||
# to be active if nothig is set
|
|
||||||
bool(not f_families)
|
|
||||||
])
|
|
||||||
|
|
||||||
# test task types from filter
|
# test task types from filter
|
||||||
test_task_types = any([
|
if f_task_types and task_type not in f_task_types:
|
||||||
# check if actual task type is defined in task types
|
continue
|
||||||
# set in preset's filter
|
|
||||||
bool(task_type in f_task_types),
|
|
||||||
# and if taskTypes are defined in preset filter
|
|
||||||
# if not then return True, because we want this filter
|
|
||||||
# to be active if no taskType is set
|
|
||||||
bool(not f_task_types)
|
|
||||||
])
|
|
||||||
|
|
||||||
# test subsets from filter
|
# test subsets from filter
|
||||||
test_subsets = any([
|
if f_subsets and not any(
|
||||||
# check if any of subset filter inputs
|
re.search(s, subset) for s in f_subsets):
|
||||||
# converted to regex patern is not found in subset
|
|
||||||
# we keep strict case sensitivity
|
|
||||||
bool(next((
|
|
||||||
s for s in f_subsets
|
|
||||||
if re.search(re.compile(s), subset)
|
|
||||||
), None)),
|
|
||||||
# but if no subsets were set then make this acuntable too
|
|
||||||
bool(not f_subsets)
|
|
||||||
])
|
|
||||||
|
|
||||||
# we need all filters to be positive for this
|
|
||||||
# preset to be activated
|
|
||||||
test_all = all([
|
|
||||||
test_families,
|
|
||||||
test_task_types,
|
|
||||||
test_subsets
|
|
||||||
])
|
|
||||||
|
|
||||||
# if it is not positive then skip this preset
|
|
||||||
if not test_all:
|
|
||||||
continue
|
continue
|
||||||
|
|
||||||
self.log.info(
|
self.log.info(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue