@@ -32,7 +32,7 @@ class Client:
3232
3333 def __init__ (self , api_key = None ,
3434 endpoint = 'https://api.labelbox.com/graphql' ):
35- """ Create and initialize a Labelbox Client.
35+ """ Creates and initializes a Labelbox Client.
3636
3737 Args:
3838 api_key (str): API key. If None, the key is obtained from
@@ -63,19 +63,20 @@ def execute(self, query, params=None, timeout=10.0):
6363 in appropriate labelbox.exceptions.LabelboxError subtypes.
6464
6565 Args:
66- query (str): the query to execute.
67- params (dict): query parameters referenced within the query.
66+ query (str): The query to execute.
67+ params (dict): Query parameters referenced within the query.
6868 timeout (float): Max allowed time for query execution,
6969 in seconds.
70- Return :
70+ Returns :
7171 dict, parsed JSON response.
7272 Raises:
7373 labelbox.exceptions.AuthenticationError: If authentication
7474 failed.
7575 labelbox.exceptions.InvalidQueryError: If `query` is not
7676 syntactically or semantically valid (checked server-side).
7777 labelbox.exceptions.ApiLimitError: If the server API limit was
78- exceeded. Check Labelbox documentation to see API limits.
78+ exceeded. See "How to import data" in the online documentation
79+ to see API limits.
7980 labelbox.exceptions.TimeoutError: If response was not received
8081 in `timeout` seconds.
8182 labelbox.exceptions.NetworkError: If an unknown error occurred
@@ -172,12 +173,13 @@ def check_errors(keywords, *path):
172173
173174 def upload_data (self , data ):
174175 """ Uploads the given data (bytes) to Labelbox.
176+
175177 Args:
176- data (bytes): the data to upload.
177- Return :
178+ data (bytes): The data to upload.
179+ Returns :
178180 str, the URL of uploaded data.
179181 Raises:
180- labelbox.exceptions.LabelboxError: if upload failes .
182+ labelbox.exceptions.LabelboxError: If upload failed .
181183 """
182184 request_data = {
183185 "operations" : json .dumps ({
@@ -213,7 +215,7 @@ def _get_single(self, db_object_type, uid):
213215 Args:
214216 db_object_type (type): DbObject subclass.
215217 uid (str): Unique ID of the row.
216- Return :
218+ Returns :
217219 Object of `db_object_type`.
218220 Raises:
219221 labelbox.exceptions.ResourceNotFoundError: If there is no object
@@ -230,9 +232,10 @@ def _get_single(self, db_object_type, uid):
230232
231233 def get_project (self , project_id ):
232234 """ Gets a single Project with the given ID.
235+
233236 Args:
234237 project_id (str): Unique ID of the Project.
235- Return :
238+ Returns :
236239 The sought Project.
237240 Raises:
238241 labelbox.exceptions.ResourceNotFoundError: If there is no
@@ -242,9 +245,10 @@ def get_project(self, project_id):
242245
243246 def get_dataset (self , dataset_id ):
244247 """ Gets a single Dataset with the given ID.
248+
245249 Args:
246250 dataset_id (str): Unique ID of the Dataset.
247- Return :
251+ Returns :
248252 The sought Dataset.
249253 Raises:
250254 labelbox.exceptions.ResourceNotFoundError: If there is no
@@ -267,7 +271,7 @@ def _get_all(self, db_object_type, where):
267271 db_object_type (type): DbObject subclass.
268272 where (Comparison, LogicalOperation or None): The `where` clause
269273 for filtering.
270- Return :
274+ Returns :
271275 An iterable of `db_object_type` instances.
272276 """
273277 not_deleted = db_object_type .deleted == False
@@ -284,7 +288,7 @@ def get_projects(self, where=None):
284288 Args:
285289 where (Comparison, LogicalOperation or None): The `where` clause
286290 for filtering.
287- Return :
291+ Returns :
288292 An iterable of Projects (typically a PaginatedCollection).
289293 """
290294 return self ._get_all (Project , where )
@@ -295,7 +299,7 @@ def get_datasets(self, where=None):
295299 Args:
296300 where (Comparison, LogicalOperation or None): The `where` clause
297301 for filtering.
298- Return :
302+ Returns :
299303 An iterable of Datasets (typically a PaginatedCollection).
300304 """
301305 return self ._get_all (Dataset , where )
@@ -306,23 +310,23 @@ def get_labeling_frontends(self, where=None):
306310 Args:
307311 where (Comparison, LogicalOperation or None): The `where` clause
308312 for filtering.
309- Return :
313+ Returns :
310314 An iterable of LabelingFrontends (typically a PaginatedCollection).
311315 """
312316 return self ._get_all (LabelingFrontend , where )
313317
314318 def _create (self , db_object_type , data ):
315- """ Creates a object on the server. Attribute values are
319+ """ Creates an object on the server. Attribute values are
316320 passed as keyword arguments:
317321
318322 Args:
319323 db_object_type (type): A DbObjectType subtype.
320324 data (dict): Keys are attributes or their names (in Python,
321325 snake-case convention) and values are desired attribute values.
322- Return :
323- a new object of the given DB object type.
326+ Returns :
327+ A new object of the given DB object type.
324328 Raises:
325- InvalidAttributeError: in case the DB object type does not contain
329+ InvalidAttributeError: If the DB object type does not contain
326330 any of the attribute names given in `data`.
327331 """
328332 # Convert string attribute names to Field or Relationship objects.
@@ -347,10 +351,10 @@ def create_dataset(self, **kwargs):
347351 Keyword arguments with new Dataset attribute values.
348352 Keys are attribute names (in Python, snake-case convention) and
349353 values are desired attribute values.
350- Return :
351- a new Dataset object.
354+ Returns :
355+ A new Dataset object.
352356 Raises:
353- InvalidAttributeError: in case the Dataset type does not contain
357+ InvalidAttributeError: If the Dataset type does not contain
354358 any of the attribute names given in kwargs.
355359 """
356360 return self ._create (Dataset , kwargs )
@@ -364,10 +368,10 @@ def create_project(self, **kwargs):
364368 Keyword arguments with new Project attribute values.
365369 Keys are attribute names (in Python, snake-case convention) and
366370 values are desired attribute values.
367- Return :
368- a new Project object.
371+ Returns :
372+ A new Project object.
369373 Raises:
370- InvalidAttributeError: in case the Project type does not contain
374+ InvalidAttributeError: If the Project type does not contain
371375 any of the attribute names given in kwargs.
372376 """
373377 return self ._create (Project , kwargs )
0 commit comments