Skip to content

Commit

Permalink
Merge pull request #355 from EvanBldy/main
Browse files Browse the repository at this point in the history
various improvements
  • Loading branch information
EvanBldy authored Jan 23, 2025
2 parents 7c773c8 + d228acf commit 4db767e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
4 changes: 3 additions & 1 deletion gazu/asset.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ def new_asset(
description=None,
extra_data={},
episode=None,
is_shared=False,
client=default,
):
"""
Expand All @@ -181,6 +182,7 @@ def new_asset(
description (str): Additional information.
extra_data (dict): Free field to add any kind of metadata.
episode (str / dict): The episode this asset is linked to.
is_shared (bool): True if asset is shared between multiple projects.
Returns:
dict: Created asset.
Expand All @@ -189,7 +191,7 @@ def new_asset(
asset_type = normalize_model_parameter(asset_type)
episode = normalize_model_parameter(episode)

data = {"name": name, "data": extra_data}
data = {"name": name, "data": extra_data, "is_shared": is_shared}

if description is not None:
data["description"] = description
Expand Down
6 changes: 5 additions & 1 deletion gazu/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,16 +147,20 @@ def get_preview_file(preview_file_id, client=default):
return raw.fetch_one("preview-files", preview_file_id, client=client)


def remove_preview_file(preview_file, client=default):
def remove_preview_file(preview_file, force=False, client=default):
"""
Remove given preview file from database.
Args:
preview_file (str / dict): The preview_file dict or ID.
"""
preview_file = normalize_model_parameter(preview_file)
params = {}
if force:
params = {"force": True}
return raw.delete(
"data/preview-files/%s" % preview_file["id"],
params=params,
client=client,
)

Expand Down
6 changes: 4 additions & 2 deletions gazu/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -675,13 +675,15 @@ def remove_task(task, client=default):
raw.delete("data/tasks/%s" % task["id"], {"force": True}, client=client)


def start_task(task, started_task_status=None, client=default):
def start_task(task, started_task_status=None, person=None, client=default):
"""
Create a comment to change task status to started_task_status
(by default WIP) and set its real start date to now.
Args:
task (str / dict): The task dict or the task ID.
started_task_status (str / dict): The task status dict or ID.
person (str / dict): The person dict or the person ID.
Returns:
dict: Created comment.
Expand All @@ -700,7 +702,7 @@ def start_task(task, started_task_status=None, client=default):
)
)

return add_comment(task, started_task_status, client=client)
return add_comment(task, started_task_status, person=person, client=client)


def task_to_review(
Expand Down

0 comments on commit 4db767e

Please sign in to comment.