Skip to content

Commit

Permalink
Merge pull request #353 from EvanBldy/main
Browse files Browse the repository at this point in the history
various improvements
  • Loading branch information
EvanBldy authored Jan 13, 2025
2 parents 436abb6 + ae4e70e commit e5bd788
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/psf/black
rev: 24.8.0
rev: 24.10.0
hooks:
- id: black
- repo: https://github.com/PyCQA/autoflake
Expand Down
12 changes: 7 additions & 5 deletions gazu/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -1067,20 +1067,22 @@ def publish_preview(
return new_comment, preview_file


def publish_comments_previews(task, comments=[], client=default):
def batch_comments(comments=[], task=None, client=default):
"""
Publish a list of comments (with attachments and previews) for given task.
Each dict comments may contain a list of attachment files path and preview
files path in the keys "attachment_files" and "preview_files".
files path in the keys "attachment_files" and "preview_files". If no task is
given each comments needs to have a task_id key.
Args:
task (str / dict): The task dict or the task ID.
comments (list): List of comments to publish.
task (str / dict): The task dict or the task ID.
Returns:
list: List of created comments.
"""
task = normalize_model_parameter(task)
if task is not None:
task = normalize_model_parameter(task)

files = {}
for x, comment in enumerate(comments):
Expand All @@ -1093,7 +1095,7 @@ def publish_comments_previews(task, comments=[], client=default):

files["comments"] = (None, json.dumps(comments), "application/json")
return raw.upload(
"actions/tasks/%s/add-comments-previews" % task["id"],
"actions/tasks/%sbatch-comment" % ("%s/" % task["id"] if task else ""),
file_path=None,
files=files,
client=client,
Expand Down

0 comments on commit e5bd788

Please sign in to comment.