Skip to content

Commit 7ec6f9e

Browse files
author
Matt Sokoloff
committed
format and cleanup notebooks
1 parent 766dbb1 commit 7ec6f9e

20 files changed

+958
-622
lines changed

examples/basics/basics.ipynb

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
"# Set this if running in colab. Otherwise it should work if you have the LABELBOX_API_KEY set.\n",
9090
"API_KEY = os.environ[\"LABELBOX_API_KEY\"]\n",
9191
"# Only update this if you have an on-prem deployment\n",
92-
"ENDPOINT = \"https://api.labelbox.com/graphql\" "
92+
"ENDPOINT = \"https://api.labelbox.com/graphql\""
9393
]
9494
},
9595
{
@@ -108,7 +108,7 @@
108108
"metadata": {},
109109
"outputs": [],
110110
"source": [
111-
"client = Client(api_key = API_KEY, endpoint = ENDPOINT)"
111+
"client = Client(api_key=API_KEY, endpoint=ENDPOINT)"
112112
]
113113
},
114114
{
@@ -191,7 +191,7 @@
191191
"metadata": {},
192192
"outputs": [],
193193
"source": [
194-
"project.update(description = \"new description field\")\n",
194+
"project.update(description=\"new description field\")\n",
195195
"print(project.description)"
196196
]
197197
},
@@ -279,14 +279,12 @@
279279
}
280280
],
281281
"source": [
282-
"datasets = client.get_datasets(where = Dataset.name == DATASET_NAME )\n",
282+
"datasets = client.get_datasets(where=Dataset.name == DATASET_NAME)\n",
283+
"\n",
284+
"projects = client.get_projects(\n",
285+
" where=((Project.name == PROJECT_NAME)\n",
286+
" & (Project.description == \"new description field\")))\n",
283287
"\n",
284-
"projects = client.get_projects(where = (\n",
285-
" (Project.name == PROJECT_NAME)\n",
286-
" & \n",
287-
" (Project.description == \"new description field\")\n",
288-
"))\n",
289-
" \n",
290288
"# The above two queries return PaginatedCollections because the filter parameters aren't guarenteed to be unique.\n",
291289
"# So even if there is one element returned it is in a paginatedCollection.\n",
292290
"print(projects)\n",
@@ -313,9 +311,10 @@
313311
"metadata": {},
314312
"source": [
315313
"### Relationship\n",
316-
"* This solves the above problem of querying by a relationship\n",
314+
"* Relationships can be used to query for related objects (solves the limitation outlined above)\n",
315+
" * E.g. if a user wants all projects that have a specific dataset attached, then can run the code below.\n",
317316
"* You can find all realtionships of a DB object in the source code\n",
318-
" * eg. for a Project ( https://github.com/Labelbox/labelbox-python/blob/develop/labelbox/schema/project.py))"
317+
" * E.g. for a Project ( https://github.com/Labelbox/labelbox-python/blob/develop/labelbox/schema/project.py))"
319318
]
320319
},
321320
{

0 commit comments

Comments
 (0)