From 17fdefcab85df745784fc45d1ea9886471e64908 Mon Sep 17 00:00:00 2001 From: Florijan Stamenkovic Date: Wed, 20 Jan 2021 10:28:11 +0100 Subject: [PATCH] Remove trailing whitespace --- labelbox/client.py | 22 +++++++++++----------- labelbox/exceptions.py | 2 +- labelbox/pagination.py | 4 ++-- labelbox/schema/benchmark.py | 8 ++++---- labelbox/schema/bulk_import_request.py | 8 ++++---- labelbox/schema/data_row.py | 10 +++++----- labelbox/schema/dataset.py | 6 +++--- labelbox/schema/label.py | 2 +- labelbox/schema/labeling_frontend.py | 2 +- labelbox/schema/organization.py | 4 ++-- labelbox/schema/prediction.py | 4 ++-- labelbox/schema/project.py | 16 ++++++++-------- labelbox/schema/review.py | 4 ++-- labelbox/schema/webhook.py | 2 +- 14 files changed, 47 insertions(+), 47 deletions(-) diff --git a/labelbox/client.py b/labelbox/client.py index 204c763a5..c8ca5b1d4 100644 --- a/labelbox/client.py +++ b/labelbox/client.py @@ -26,11 +26,11 @@ class Client: - """ A Labelbox client. - - Contains info necessary for connecting to a Labelbox server (URL, - authentication key). Provides functions for querying and creating - top-level data objects (Projects, Datasets). + """ A Labelbox client. + + Contains info necessary for connecting to a Labelbox server (URL, + authentication key). Provides functions for querying and creating + top-level data objects (Projects, Datasets). """ def __init__(self, @@ -73,8 +73,8 @@ def __init__(self, labelbox.exceptions.InternalServerError)) def execute(self, query, params=None, timeout=10.0): """ Sends a request to the server for the execution of the - given query. - + given query. + Checks the response for errors and wraps errors in appropriate `labelbox.exceptions.LabelboxError` subtypes. @@ -336,7 +336,7 @@ def get_dataset(self, dataset_id): def get_user(self): """ Gets the current User database object. - + >>> user = client.get_user() """ return self._get_single(User, None) @@ -435,7 +435,7 @@ def _create(self, db_object_type, data): def create_dataset(self, **kwargs): """ Creates a Dataset object on the server. - + Attribute values are passed as keyword arguments. >>> project = client.get_project("") @@ -452,8 +452,8 @@ def create_dataset(self, **kwargs): return self._create(Dataset, kwargs) def create_project(self, **kwargs): - """ Creates a Project object on the server. - + """ Creates a Project object on the server. + Attribute values are passed as keyword arguments. >>> project = client.create_project(name="", description="") diff --git a/labelbox/exceptions.py b/labelbox/exceptions.py index 9a7292b33..14153586d 100644 --- a/labelbox/exceptions.py +++ b/labelbox/exceptions.py @@ -31,7 +31,7 @@ class ResourceNotFoundError(LabelboxError): def __init__(self, db_object_type, params): """ Constructor. - + Args: db_object_type (type): A labelbox.schema.DbObject subtype. params (dict): Dict of params identifying the sought resource. diff --git a/labelbox/pagination.py b/labelbox/pagination.py index 5b8b6719a..14803da27 100644 --- a/labelbox/pagination.py +++ b/labelbox/pagination.py @@ -4,7 +4,7 @@ class PaginatedCollection: """ An iterable collection of database objects (Projects, Labels, etc...). - + Implements automatic (transparent to the user) paginated fetching during iteration. Intended for use by library internals and not by the end user. For a list of attributes see __init__(...) documentation. The params of @@ -13,7 +13,7 @@ class PaginatedCollection: def __init__(self, client, query, params, dereferencing, obj_class): """ Creates a PaginatedCollection. - + Args: client (labelbox.Client): the client used for fetching data from DB. query (str): Base query used for pagination. It must contain two diff --git a/labelbox/schema/benchmark.py b/labelbox/schema/benchmark.py index f703c2519..bc8c9e98a 100644 --- a/labelbox/schema/benchmark.py +++ b/labelbox/schema/benchmark.py @@ -4,9 +4,9 @@ class Benchmark(DbObject): """ Represents a benchmark label. - - The Benchmarks tool works by interspersing data to be labeled, for - which there is a benchmark label, to each person labeling. These + + The Benchmarks tool works by interspersing data to be labeled, for + which there is a benchmark label, to each person labeling. These labeled data are compared against their respective benchmark and an accuracy score between 0 and 100 percent is calculated. @@ -15,7 +15,7 @@ class Benchmark(DbObject): last_activity (datetime) average_agreement (float) completed_count (int) - + created_by (Relationship): `ToOne` relationship to User reference_label (Relationship): `ToOne` relationship to Label """ diff --git a/labelbox/schema/bulk_import_request.py b/labelbox/schema/bulk_import_request.py index a8d54e40b..783ae69c7 100644 --- a/labelbox/schema/bulk_import_request.py +++ b/labelbox/schema/bulk_import_request.py @@ -101,7 +101,7 @@ class BulkImportRequest(DbObject): error_file_url (str): NDJSON that contains error messages for failed annotations status_file_url (str): NDJSON that contains status for each annotation created_at (datetime): UTC timestamp for date BulkImportRequest was created - + project (Relationship): `ToOne` relationship to Project created_by (Relationship): `ToOne` relationship to User """ @@ -125,7 +125,7 @@ def refresh(self) -> None: def wait_until_done(self, sleep_time_seconds: int = 30) -> None: """Blocks import job until certain conditions are met. - + Blocks until the BulkImportRequest.state changes either to `BulkImportRequestState.FINISHED` or `BulkImportRequestState.FAILED`, periodically refreshing object's state. @@ -209,8 +209,8 @@ def create_from_url(cls, client, project_id: str, name: str, def create_from_objects(cls, client, project_id: str, name: str, predictions: Iterable[dict]) -> 'BulkImportRequest': """ - Creates a `BulkImportRequest` from an iterable of dictionaries. - + Creates a `BulkImportRequest` from an iterable of dictionaries. + Conforms to JSON predictions format, e.g.: ``{ "uuid": "9fd9a92e-2560-4e77-81d4-b2e955800092", diff --git a/labelbox/schema/data_row.py b/labelbox/schema/data_row.py index 78c068298..df46f1902 100644 --- a/labelbox/schema/data_row.py +++ b/labelbox/schema/data_row.py @@ -5,21 +5,21 @@ class DataRow(DbObject, Updateable, BulkDeletable): - """ Internal Labelbox representation of a single piece of data (e.g. image, video, text). + """ Internal Labelbox representation of a single piece of data (e.g. image, video, text). Attributes: external_id (str): User-generated file name or identifier - row_data (str): Paths to local files are uploaded to Labelbox's server. + row_data (str): Paths to local files are uploaded to Labelbox's server. Otherwise, it's treated as an external URL. updated_at (datetime) created_at (datetime) - + dataset (Relationship): `ToOne` relationship to Dataset created_by (Relationship): `ToOne` relationship to User organization (Relationship): `ToOne` relationship to Organization labels (Relationship): `ToMany` relationship to Label metadata (Relationship): `ToMany` relationship to AssetMetadata - predictions (Relationship): `ToMany` relationship to Prediction + predictions (Relationship): `ToMany` relationship to Prediction """ external_id = Field.String("external_id") row_data = Field.String("row_data") @@ -50,7 +50,7 @@ def __init__(self, *args, **kwargs): def create_metadata(self, meta_type, meta_value): """ Attaches asset metadata to a DataRow. - + >>> datarow.create_metadata("TEXT", "This is a text message") Args: diff --git a/labelbox/schema/dataset.py b/labelbox/schema/dataset.py index 7a7f0ecd4..994e840a9 100644 --- a/labelbox/schema/dataset.py +++ b/labelbox/schema/dataset.py @@ -8,7 +8,7 @@ class Dataset(DbObject, Updateable, Deletable): - """ A Dataset is a collection of DataRows. + """ A Dataset is a collection of DataRows. Attributes: name (str) @@ -39,7 +39,7 @@ def create_data_row(self, **kwargs): >>> dataset.create_data_row(row_data="http://my_site.com/photos/img_01.jpg") Args: - **kwargs: Key-value arguments containing new `DataRow` data. At a minimum, + **kwargs: Key-value arguments containing new `DataRow` data. At a minimum, must contain `row_data`. Raises: @@ -70,7 +70,7 @@ def create_data_rows(self, items): it is a `str`, then it is interpreted as a local file path. The file is uploaded to Labelbox and a DataRow referencing it is created. If an item is a `dict`, then it should map `DataRow` fields (or their - names) to values. At the minimum an `item` passed as a `dict` must + names) to values. At the minimum an `item` passed as a `dict` must contain a `DataRow.row_data` key and value. >>> dataset.create_data_rows([ diff --git a/labelbox/schema/label.py b/labelbox/schema/label.py index f25ae6c76..91d077f45 100644 --- a/labelbox/schema/label.py +++ b/labelbox/schema/label.py @@ -14,7 +14,7 @@ class Label(DbObject, Updateable, BulkDeletable): agreement (float) benchmark_agreement (float) is_benchmark_reference (bool) - + project (Relationship): `ToOne` relationship to Project data_row (Relationship): `ToOne` relationship to DataRow reviews (Relationship): `ToMany` relationship to Review diff --git a/labelbox/schema/labeling_frontend.py b/labelbox/schema/labeling_frontend.py index 13fe76635..a7fb7f943 100644 --- a/labelbox/schema/labeling_frontend.py +++ b/labelbox/schema/labeling_frontend.py @@ -8,7 +8,7 @@ class LabelingFrontend(DbObject): Represents an HTML / JavaScript UI that is used to generate labels. “Editor” is the default Labeling Frontend that comes in every organization. You can create new labeling frontends for an organization. - + Attributes: name (str) description (str) diff --git a/labelbox/schema/organization.py b/labelbox/schema/organization.py index c23d72133..64b46a78c 100644 --- a/labelbox/schema/organization.py +++ b/labelbox/schema/organization.py @@ -4,10 +4,10 @@ class Organization(DbObject): """ An Organization is a group of Users. - + It is associated with data created by Users within that Organization. Typically all Users within an Organization have access to data created by any User in the same Organization. - + Attributes: updated_at (datetime) created_at (datetime) diff --git a/labelbox/schema/prediction.py b/labelbox/schema/prediction.py index 309f5928f..29ea2d986 100644 --- a/labelbox/schema/prediction.py +++ b/labelbox/schema/prediction.py @@ -15,7 +15,7 @@ class PredictionModel(DbObject): version (int) created_by (Relationship): `ToOne` relationship to User - organization (Relationship): `ToOne` relationship to Organization + organization (Relationship): `ToOne` relationship to Organization """ updated_at = Field.DateTime("updated_at") created_at = Field.DateTime("created_at") @@ -40,7 +40,7 @@ class Prediction(DbObject): created_at (datetime) label (str) agreement (float) - + organization (Relationship): `ToOne` relationship to Organization prediction_model (Relationship): `ToOne` relationship to PredictionModel data_row (Relationship): `ToOne` relationship to DataRow diff --git a/labelbox/schema/project.py b/labelbox/schema/project.py index b23c18539..411ec2258 100644 --- a/labelbox/schema/project.py +++ b/labelbox/schema/project.py @@ -28,7 +28,7 @@ class Project(DbObject, Updateable, Deletable): """ A Project is a container that includes a labeling frontend, an ontology, datasets and labels. - Attributes: + Attributes: name (str) description (str) updated_at (datetime) @@ -150,7 +150,7 @@ def export_labels(self, timeout_seconds=60): Args: timeout_seconds (float): Max waiting time, in seconds. Returns: - URL of the data file with this Project's labels. If the server didn't + URL of the data file with this Project's labels. If the server didn't generate during the `timeout_seconds` period, None is returned. """ sleep_time = 2 @@ -250,8 +250,8 @@ def setup(self, labeling_frontend, labeling_frontend_options): self.update(setup_complete=timestamp) def set_labeling_parameter_overrides(self, data): - """ Adds labeling parameter overrides to this project. - + """ Adds labeling parameter overrides to this project. + >>> project.set_labeling_parameter_overrides([ >>> (data_row_1, 2, 3), (data_row_2, 1, 4)]) @@ -328,7 +328,7 @@ def extend_reservations(self, queue_type): def create_prediction_model(self, name, version): """ Creates a PredictionModel connected to a Legacy Editor Project. - + Args: name (str): The new PredictionModel's name. version (int): The new PredictionModel's version. @@ -346,7 +346,7 @@ def create_prediction_model(self, name, version): def create_prediction(self, label, data_row, prediction_model=None): """ Creates a Prediction within a Legacy Editor Project. Not supported in the new Editor. - + Args: label (str): The `label` field of the new Prediction. data_row (DataRow): The DataRow for which the Prediction is created. @@ -392,7 +392,7 @@ def enable_model_assisted_labeling(self, toggle: bool = True) -> bool: """ Turns model assisted labeling either on or off based on input Args: - toggle (bool): True or False boolean + toggle (bool): True or False boolean Returns: True if toggled on or False if toggled off """ @@ -401,7 +401,7 @@ def enable_model_assisted_labeling(self, toggle: bool = True) -> bool: query_str = """mutation toggle_model_assisted_labelingPyApi($%s: ID!, $%s: Boolean!) { project(where: {id: $%s }) { - showPredictionsToLabelers(show: $%s) { + showPredictionsToLabelers(show: $%s) { id, showingPredictionsToLabelers } } diff --git a/labelbox/schema/review.py b/labelbox/schema/review.py index 10ff904d2..a9ae6d9ae 100644 --- a/labelbox/schema/review.py +++ b/labelbox/schema/review.py @@ -8,7 +8,7 @@ class Review(DbObject, Deletable, Updateable): """ Reviewing labeled data is a collaborative quality assurance technique. A Review object indicates the quality of the assigned Label. The aggregated - review numbers can be obtained on a Project object. + review numbers can be obtained on a Project object. Attributes: created_at (datetime) @@ -22,7 +22,7 @@ class Review(DbObject, Deletable, Updateable): """ class NetScore(Enum): - """ Negative, Zero, or Positive. + """ Negative, Zero, or Positive. """ Negative = auto() Zero = auto() diff --git a/labelbox/schema/webhook.py b/labelbox/schema/webhook.py index a83b93fb1..65802600c 100644 --- a/labelbox/schema/webhook.py +++ b/labelbox/schema/webhook.py @@ -67,7 +67,7 @@ def create(client, topics, url, secret, project): def update(self, topics=None, url=None, status=None): """ Updates this Webhook. - + Args: topics (list of str): The new topics value, optional. url (str): The new URL value, optional.