feat(nks): processing PR comments - better readability

This commit is contained in:
Jakub Jezek 2020-05-13 11:14:06 +02:00
parent eb28198319
commit 77d3611b9f
No known key found for this signature in database
GPG key ID: C4B96E101D2A47F3
2 changed files with 22 additions and 9 deletions

View file

@ -57,19 +57,28 @@ class CollectClips(api.ContextPlugin):
self.log.debug(
"__ assets_shared: {}".format(
context.data["assetsShared"]))
match_range = next(
# Check for clips with the same range
# this is for testing if any vertically neighbouring
# clips has been already processed
clip_matching_with_range = next(
(k for k, v in context.data["assetsShared"].items()
if (v.get("_clipIn", 0) == clip_in)
and (v.get("_clipOut", 0) == clip_out)
), False)
if asset in str(match_range):
match_range = False
# check if clip name is the same in matched
# vertically neighbouring clip
# if it is then it is correct and resent variable to False
# not to be rised wrong name exception
if asset in str(clip_matching_with_range):
clip_matching_with_range = False
assert (not match_range), (
# rise wrong name exception if found one
assert (not clip_matching_with_range), (
"matching clip: {asset}"
" timeline range ({clip_in}:{clip_out})"
" conflicting with {match_range}"
" conflicting with {clip_matching_with_range}"
" >> rename any of clips to be the same as the other <<"
).format(
**locals())

View file

@ -74,21 +74,25 @@ class CollectHierarchyInstance(pyblish.api.ContextPlugin):
# and finding only hierarchical tag
if "hierarchy" in t_type.lower():
# check if any clip with the same clip range
# is alerady in asset shared so
# Check for clips with the same range
# this is for testing if any vertically neighbouring
# clips has been already processed
match = next((
k for k, v in assets_shared.items()
if (v["_clipIn"] == clip_in)
and (v["_clipOut"] == clip_out)
), False)
self.log.warning("Clip matching name: {}".format(match))
self.log.debug(
"__ assets_shared[match]: {}".format(
assets_shared[match]))
# check if hierarchy key is in match
# check if hierarchy key is present in matched
# vertically neighbouring clip
if not assets_shared[match].get("hierarchy"):
match = False
# rise exception if multiple hierarchy tag found
assert not match, (
"Two clips above each other with"
" hierarchy tag are not allowed"