mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 16:34:53 +01:00
Apply suggestions from code review
Co-authored-by: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com>
This commit is contained in:
parent
fa9af2f8de
commit
f003d8af1d
3 changed files with 21 additions and 26 deletions
|
|
@ -687,33 +687,25 @@ def get_instance_staging_dir(instance):
|
||||||
anatomy_data = instance.data["anatomyData"]
|
anatomy_data = instance.data["anatomyData"]
|
||||||
template_data = copy.deepcopy(anatomy_data)
|
template_data = copy.deepcopy(anatomy_data)
|
||||||
|
|
||||||
product_type = instance.data["productType"]
|
|
||||||
product_name = instance.data["productName"]
|
|
||||||
|
|
||||||
# context data based variables
|
# context data based variables
|
||||||
project_entity = instance.context.data["projectEntity"]
|
context = instance.context
|
||||||
folder_entity = instance.context.data["folderEntity"]
|
|
||||||
task_entity = instance.context.data["taskEntity"]
|
|
||||||
host_name = instance.context.data["hostName"]
|
|
||||||
project_settings = instance.context.data["project_settings"]
|
|
||||||
anatomy = instance.context.data["anatomy"]
|
|
||||||
current_file = instance.context.data.get("currentFile")
|
|
||||||
|
|
||||||
# add current file as workfile name into formatting data
|
# add current file as workfile name into formatting data
|
||||||
|
current_file = context.data.get("currentFile")
|
||||||
if current_file:
|
if current_file:
|
||||||
workfile = os.path.basename(current_file)
|
workfile = os.path.basename(current_file)
|
||||||
workfile_name, _ = os.path.splitext(workfile)
|
workfile_name, _ = os.path.splitext(workfile)
|
||||||
template_data["workfile_name"] = workfile_name
|
template_data["workfile_name"] = workfile_name
|
||||||
|
|
||||||
staging_dir_info = get_staging_dir_info(
|
staging_dir_info = get_staging_dir_info(
|
||||||
host_name,
|
context.data["hostName"],
|
||||||
project_entity,
|
context.data["projectEntity"],
|
||||||
folder_entity,
|
instance.data.get("folderEntity"),
|
||||||
task_entity,
|
instance.data.get("taskEntity"),
|
||||||
product_type,
|
instance.data["productType"],
|
||||||
product_name,
|
instance.data["productName"],
|
||||||
anatomy,
|
anatomy=context.data["anatomy"],
|
||||||
project_settings=project_settings,
|
project_settings=context.data["project_settings"],
|
||||||
template_data=template_data,
|
template_data=template_data,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,12 +9,12 @@ STAGING_DIR_TEMPLATES = "staging"
|
||||||
|
|
||||||
|
|
||||||
def get_staging_dir_config(
|
def get_staging_dir_config(
|
||||||
host_name,
|
|
||||||
project_name,
|
project_name,
|
||||||
task_type,
|
task_type,
|
||||||
task_name,
|
task_name,
|
||||||
product_type,
|
product_type,
|
||||||
product_name,
|
product_name,
|
||||||
|
host_name,
|
||||||
project_settings=None,
|
project_settings=None,
|
||||||
anatomy=None,
|
anatomy=None,
|
||||||
log=None,
|
log=None,
|
||||||
|
|
@ -24,8 +24,8 @@ def get_staging_dir_config(
|
||||||
Args:
|
Args:
|
||||||
host_name (str): Name of host.
|
host_name (str): Name of host.
|
||||||
project_name (str): Name of project.
|
project_name (str): Name of project.
|
||||||
task_type (str): Type of task.
|
task_type (Optional[str]): Type of task.
|
||||||
task_name (str): Name of task.
|
task_name (Optional[str]): Name of task.
|
||||||
product_type (str): Type of product.
|
product_type (str): Type of product.
|
||||||
product_name (str): Name of product.
|
product_name (str): Name of product.
|
||||||
project_settings(Dict[str, Any]): Prepared project settings.
|
project_settings(Dict[str, Any]): Prepared project settings.
|
||||||
|
|
@ -103,13 +103,13 @@ def _validate_template_name(project_name, template_name, anatomy):
|
||||||
|
|
||||||
|
|
||||||
def get_staging_dir_info(
|
def get_staging_dir_info(
|
||||||
host_name,
|
|
||||||
project_entity,
|
project_entity,
|
||||||
folder_entity,
|
folder_entity,
|
||||||
task_entity,
|
task_entity,
|
||||||
product_type,
|
product_type,
|
||||||
product_name,
|
product_name,
|
||||||
anatomy,
|
host_name,
|
||||||
|
anatomy=None,
|
||||||
project_settings=None,
|
project_settings=None,
|
||||||
template_data=None,
|
template_data=None,
|
||||||
always_return_path=None,
|
always_return_path=None,
|
||||||
|
|
@ -157,6 +157,11 @@ def get_staging_dir_info(
|
||||||
if always_return_path is None:
|
if always_return_path is None:
|
||||||
always_return_path = True
|
always_return_path = True
|
||||||
|
|
||||||
|
if anatomy is None:
|
||||||
|
anatomy = Anatomy(
|
||||||
|
project_entity["name"], project_entity=project_entity
|
||||||
|
)
|
||||||
|
|
||||||
if force_tmp_dir:
|
if force_tmp_dir:
|
||||||
return get_temp_dir(
|
return get_temp_dir(
|
||||||
project_name=project_entity["name"],
|
project_name=project_entity["name"],
|
||||||
|
|
|
||||||
|
|
@ -86,9 +86,7 @@ def _create_custom_tempdir(project_name, anatomy=None):
|
||||||
Returns:
|
Returns:
|
||||||
str | None: formatted path or None
|
str | None: formatted path or None
|
||||||
"""
|
"""
|
||||||
env_tmpdir = os.getenv(
|
env_tmpdir = os.getenv("AYON_TMPDIR")
|
||||||
"AYON_TMPDIR",
|
|
||||||
)
|
|
||||||
if not env_tmpdir:
|
if not env_tmpdir:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue