From ca2809f417c3da9bcc0af2f26dcadefe231d07b0 Mon Sep 17 00:00:00 2001 From: "changjun.zhu" Date: Mon, 11 Apr 2022 20:24:16 +0800 Subject: [PATCH] refactor(client): use lowercase "conjunction" and "unit" in "create_job" --- docs/code/basic_search.py | 4 ++-- docs/code/search_result.py | 8 ++++---- docs/source/features/search/basic_search.rst | 6 +++--- tensorbay/client/version.py | 10 +++++----- tests/test_basic_search.py | 8 ++++---- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/docs/code/basic_search.py b/docs/code/basic_search.py index 03f1e34b5..8423c28bd 100644 --- a/docs/code/basic_search.py +++ b/docs/code/basic_search.py @@ -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", diff --git a/docs/code/search_result.py b/docs/code/search_result.py index 2feac0fb8..e728d3b9b 100644 --- a/docs/code/search_result.py +++ b/docs/code/search_result.py @@ -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", @@ -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), diff --git a/docs/source/features/search/basic_search.rst b/docs/source/features/search/basic_search.rst index 34e1b8774..ef86a52a8 100644 --- a/docs/source/features/search/basic_search.rst +++ b/docs/source/features/search/basic_search.rst @@ -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). diff --git a/tensorbay/client/version.py b/tensorbay/client/version.py index bdc0fce29..653851540 100644 --- a/tensorbay/client/version.py +++ b/tensorbay/client/version.py @@ -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: diff --git a/tests/test_basic_search.py b/tests/test_basic_search.py index 33ff8a2a2..01bb7dfce 100644 --- a/tests/test_basic_search.py +++ b/tests/test_basic_search.py @@ -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() @@ -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",