Skip to content

Commit

Permalink
[task] deprecate function gazu.task.get_task_by_name
Browse files Browse the repository at this point in the history
  • Loading branch information
EvanBldy committed Jan 10, 2024
1 parent 91d00ca commit 5d61613
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
20 changes: 13 additions & 7 deletions gazu/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import json

from deprecated import deprecated

from gazu.exception import (
TaskStatusNotFoundException,
TaskMustBeADictException,
Expand Down Expand Up @@ -403,20 +405,15 @@ def all_done_tasks_for_person(person, client=default):


@cache
def get_task_by_entity(entity, task_type, client=default):
return get_task_by_name(entity, task_type, client=client)


@cache
def get_task_by_name(entity, task_type, name="main", client=default):
def get_task_by_entity(entity, task_type, name="main", client=default):
"""
Args:
entity (str / dict): The entity dict or the entity ID.
task_type (str / dict): The task type dict or ID.
name (str): Name of the task to look for.
Returns:
Task matching given name for given entity and task type.
Task matching given entity, task type and name.
"""
entity = normalize_model_parameter(entity)
task_type = normalize_model_parameter(task_type)
Expand All @@ -431,6 +428,15 @@ def get_task_by_name(entity, task_type, name="main", client=default):
)


@deprecated(
version="0.9.17",
reason="You should use another function: gazu.task.get_task_by_entity, it will be removed in a future version of Gazu (0.10.0).",
)
@cache
def get_task_by_name(entity, task_type, name="main", client=default):
return get_task_by_entity(entity, task_type, name=name, client=client)


@cache
def get_task_type(task_type_id, client=default):
"""
Expand Down
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ packages = find:
install_requires =
python-socketio[client]==5.11.0; python_version != '2.7'
requests>=2.25.1
Deprecated==1.2.14

[options.packages.find]
# ignore gazutest directory
Expand Down

0 comments on commit 5d61613

Please sign in to comment.