mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +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"]
|
||||
template_data = copy.deepcopy(anatomy_data)
|
||||
|
||||
product_type = instance.data["productType"]
|
||||
product_name = instance.data["productName"]
|
||||
|
||||
# context data based variables
|
||||
project_entity = instance.context.data["projectEntity"]
|
||||
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")
|
||||
context = instance.context
|
||||
|
||||
# add current file as workfile name into formatting data
|
||||
current_file = context.data.get("currentFile")
|
||||
if current_file:
|
||||
workfile = os.path.basename(current_file)
|
||||
workfile_name, _ = os.path.splitext(workfile)
|
||||
template_data["workfile_name"] = workfile_name
|
||||
|
||||
staging_dir_info = get_staging_dir_info(
|
||||
host_name,
|
||||
project_entity,
|
||||
folder_entity,
|
||||
task_entity,
|
||||
product_type,
|
||||
product_name,
|
||||
anatomy,
|
||||
project_settings=project_settings,
|
||||
context.data["hostName"],
|
||||
context.data["projectEntity"],
|
||||
instance.data.get("folderEntity"),
|
||||
instance.data.get("taskEntity"),
|
||||
instance.data["productType"],
|
||||
instance.data["productName"],
|
||||
anatomy=context.data["anatomy"],
|
||||
project_settings=context.data["project_settings"],
|
||||
template_data=template_data,
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -9,12 +9,12 @@ STAGING_DIR_TEMPLATES = "staging"
|
|||
|
||||
|
||||
def get_staging_dir_config(
|
||||
host_name,
|
||||
project_name,
|
||||
task_type,
|
||||
task_name,
|
||||
product_type,
|
||||
product_name,
|
||||
host_name,
|
||||
project_settings=None,
|
||||
anatomy=None,
|
||||
log=None,
|
||||
|
|
@ -24,8 +24,8 @@ def get_staging_dir_config(
|
|||
Args:
|
||||
host_name (str): Name of host.
|
||||
project_name (str): Name of project.
|
||||
task_type (str): Type of task.
|
||||
task_name (str): Name of task.
|
||||
task_type (Optional[str]): Type of task.
|
||||
task_name (Optional[str]): Name of task.
|
||||
product_type (str): Type of product.
|
||||
product_name (str): Name of product.
|
||||
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(
|
||||
host_name,
|
||||
project_entity,
|
||||
folder_entity,
|
||||
task_entity,
|
||||
product_type,
|
||||
product_name,
|
||||
anatomy,
|
||||
host_name,
|
||||
anatomy=None,
|
||||
project_settings=None,
|
||||
template_data=None,
|
||||
always_return_path=None,
|
||||
|
|
@ -157,6 +157,11 @@ def get_staging_dir_info(
|
|||
if always_return_path is None:
|
||||
always_return_path = True
|
||||
|
||||
if anatomy is None:
|
||||
anatomy = Anatomy(
|
||||
project_entity["name"], project_entity=project_entity
|
||||
)
|
||||
|
||||
if force_tmp_dir:
|
||||
return get_temp_dir(
|
||||
project_name=project_entity["name"],
|
||||
|
|
|
|||
|
|
@ -86,9 +86,7 @@ def _create_custom_tempdir(project_name, anatomy=None):
|
|||
Returns:
|
||||
str | None: formatted path or None
|
||||
"""
|
||||
env_tmpdir = os.getenv(
|
||||
"AYON_TMPDIR",
|
||||
)
|
||||
env_tmpdir = os.getenv("AYON_TMPDIR")
|
||||
if not env_tmpdir:
|
||||
return
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue