Skip to content

Commit 78e9e78

Browse files
author
rllin
committed
fix docstrings
1 parent 5268095 commit 78e9e78

File tree

2 files changed

+19
-23
lines changed

2 files changed

+19
-23
lines changed

labelbox/client.py

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,14 @@ def __init__(self,
3636
endpoint='https://api.labelbox.com/graphql'):
3737
""" Creates and initializes a Labelbox Client.
3838
39+
Logging is defaulted to level WARNING. To receive more verbose
40+
output to console, update logging.level to the
41+
appropriate level.
42+
43+
>>> import logger
44+
>>> logging.basicConfig(level = logging.INFO)
45+
>>> client = Client("<APIKEY>")
46+
3947
Args:
4048
api_key (str): API key. If None, the key is obtained from
4149
the "LABELBOX_API_KEY" environment variable.
@@ -45,17 +53,6 @@ def __init__(self,
4553
is provided as an argument or via the environment
4654
variable.
4755
48-
Logging:
49-
Logging is defaulted to level WARNING. To receive more verbose
50-
output to console, update logging.level to the
51-
appropriate level.
52-
53-
Example:
54-
#get updated on console when client is instantiated
55-
import logger
56-
57-
logging.basicConfig(level = logging.INFO)
58-
client = Client("<APIKEY>")
5956
"""
6057
if api_key is None:
6158
if _LABELBOX_API_KEY not in os.environ:
@@ -310,7 +307,7 @@ def _get_single(self, db_object_type, uid):
310307
def get_project(self, project_id):
311308
""" Gets a single Project with the given ID.
312309
313-
>>> project = client.get_project("<project_id>")
310+
>>> project = client.get_project("<project_id>")
314311
315312
Args:
316313
project_id (str): Unique ID of the Project.
@@ -325,7 +322,7 @@ def get_project(self, project_id):
325322
def get_dataset(self, dataset_id):
326323
""" Gets a single Dataset with the given ID.
327324
328-
>>> dataset = client.get_dataset("<dataset_id>")
325+
>>> dataset = client.get_dataset("<dataset_id>")
329326
330327
Args:
331328
dataset_id (str): Unique ID of the Dataset.
@@ -339,15 +336,15 @@ def get_dataset(self, dataset_id):
339336

340337
def get_user(self):
341338
""" Gets the current User database object.
342-
>>> user = client.get_user()
339+
>>> user = client.get_user()
343340
344341
"""
345342
return self._get_single(User, None)
346343

347344
def get_organization(self):
348345
""" Gets the Organization DB object of the current user.
349346
350-
>>> organization = client.get_organization()
347+
>>> organization = client.get_organization()
351348
352349
"""
353350
return self._get_single(Organization, None)
@@ -373,7 +370,7 @@ def _get_all(self, db_object_type, where):
373370
def get_projects(self, where=None):
374371
""" Fetches all the projects the user has access to.
375372
376-
>>> projects = client.get_projects(where=(Project.name == "<project_name>") & (Project.description == "<project_description>"))
373+
>>> projects = client.get_projects(where=(Project.name == "<project_name>") & (Project.description == "<project_description>"))
377374
378375
Args:
379376
where (Comparison, LogicalOperation or None): The `where` clause
@@ -386,7 +383,7 @@ def get_projects(self, where=None):
386383
def get_datasets(self, where=None):
387384
""" Fetches one or more datasets.
388385
389-
>>> datasets = client.get_datasets(where=(Dataset.name == "<dataset_name>") & (Dataset.description == "<dataset_description"))
386+
>>> datasets = client.get_datasets(where=(Dataset.name == "<dataset_name>") & (Dataset.description == "<dataset_description>"))
390387
391388
Args:
392389
where (Comparison, LogicalOperation or None): The `where` clause
@@ -399,7 +396,7 @@ def get_datasets(self, where=None):
399396
def get_labeling_frontends(self, where=None):
400397
""" Fetches all the labeling frontends.
401398
402-
>>> frontend = client.get_labeling_frontends(where=LabelingFrontend.name == "Editor")
399+
>>> frontend = client.get_labeling_frontends(where=LabelingFrontend.name == "Editor")
403400
404401
Args:
405402
where (Comparison, LogicalOperation or None): The `where` clause
@@ -440,8 +437,8 @@ def create_dataset(self, **kwargs):
440437
""" Creates a Dataset object on the server. Attribute values are
441438
passed as keyword arguments:
442439
443-
>>> project = client.get_project("<project_uid>")
444-
>>> dataset = client.create_dataset(name="<dataset_name>", projects=project)
440+
>>> project = client.get_project("<project_uid>")
441+
>>> dataset = client.create_dataset(name="<dataset_name>", projects=project)
445442
446443
Kwargs:
447444
Keyword arguments with new Dataset attribute values.
@@ -459,7 +456,7 @@ def create_project(self, **kwargs):
459456
""" Creates a Project object on the server. Attribute values are
460457
passed as keyword arguments:
461458
462-
>>> project = client.create_project(name="<project_name>", description="<project_description>")
459+
>>> project = client.create_project(name="<project_name>", description="<project_description>")
463460
464461
Kwargs:
465462
Keyword arguments with new Project attribute values.

labelbox/schema/data_row.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ def __init__(self, *args, **kwargs):
3737

3838
def create_metadata(self, meta_type, meta_value):
3939
""" Creates an asset metadata for this DataRow.
40-
41-
>>> datarow.create_metadata("TEXT", "This is a text message")
40+
>>> datarow.create_metadata("TEXT", "This is a text message")
4241
4342
Args:
4443
meta_type (str): Asset metadata type, must be one of:

0 commit comments

Comments
 (0)