Skip to content

Commit

Permalink
refactor(client): use lowercase "conjunction" and "unit" in "create_job"
Browse files Browse the repository at this point in the history
PR Closed: #1248
  • Loading branch information
graczhual committed Apr 11, 2022
1 parent 9f0242f commit 4ca1f50
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions docs/code/basic_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
dataset_client.basic_search.create_job(
title="search example",
description="search description",
conjunction="AND",
unit="FILE",
conjunction="and",
unit="file",
filters=[
(
"category",
Expand Down
8 changes: 4 additions & 4 deletions docs/code/search_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
job = dataset_client.basic_search.create_job(
title="search example",
description="search description",
conjunction="AND",
unit="FILE",
conjunction="and",
unit="file",
filters=[
(
"category",
Expand Down Expand Up @@ -61,8 +61,8 @@
job = dataset_client.basic_search.create_job(
title="search example",
description="search description",
conjunction="AND",
unit="Frame",
conjunction="and",
unit="frame",
filters=[
("sensor", "in", ["CAM_BACK_RIGHT", "CAM_FRONT"]),
("size", ">", 0),
Expand Down
6 changes: 3 additions & 3 deletions docs/source/features/search/basic_search.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ A BasicSearchJob can be created by :func:`~tensorbay.client.version.BasicSearch.
:end-before: """"""

.. note::
``conjunction``: The logical conjunction between search filters, which includes "AND" and "OR".
``conjunction``: The logical conjunction between search filters, which includes "and" and "or".

.. note::
``unit``:The unit of basic search. There are two options:
* "FILE": Get the data that meets search filters;
* "FRAME": If at least one data in a frame meets search filters, all data in the frame will be get. This option only works on fusion dataset.
* "file": Get the data that meets search filters;
* "frame": If at least one data in a frame meets search filters, all data in the frame will be get. This option only works on fusion dataset.

.. note::
``filters``: The list of basic search criteria whose format is (key, operator, value, label_type).
Expand Down
10 changes: 5 additions & 5 deletions tensorbay/client/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -822,20 +822,20 @@ def create_job(
*,
conjunction: str,
filters: List[Tuple[Any, ...]],
unit: str = "FILE",
unit: str = "file",
) -> BasicSearchJob:
"""Create a :class:`BasicSearchJob`.
Arguments:
title: The BasicSearchJob title.
description: The BasicSearchJob description.
conjunction: The logical conjunction between search filters, which includes "AND" and
"OR".
conjunction: The logical conjunction between search filters, which includes "and" and
"or".
filters: The list of basic search criteria.
unit: The unit of basic search. There are two options:
1. "FILE": get the data that meets search filters;
2. "FRAME": if at least one data in a frame meets search filters, all data in
1. "file": get the data that meets search filters;
2. "frame": if at least one data in a frame meets search filters, all data in
the frame will be get. This option only works on fusion dataset.
Returns:
Expand Down
8 changes: 4 additions & 4 deletions tests/test_basic_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ def init_dataset_client(accesskey, url, tmp_path_factory):
def init_job(dataset_client):
job = dataset_client.basic_search.create_job(
title="basic search job example",
conjunction="AND",
unit="FILE",
conjunction="and",
unit="file",
filters=[("withLabel", "=", True)],
)
job.abort()
Expand All @@ -114,8 +114,8 @@ def init_job(dataset_client):
job = dataset_client.basic_search.create_job(
title="basic search job example",
description="search description",
conjunction="AND",
unit="FILE",
conjunction="and",
unit="file",
filters=[
(
"category",
Expand Down

0 comments on commit 4ca1f50

Please sign in to comment.