Skip to content

Commit 63ce5b3

Browse files
committed
test
1 parent 52dc4e9 commit 63ce5b3

File tree

2 files changed

+17
-18
lines changed

2 files changed

+17
-18
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ repos:
1111
hooks:
1212
- id: yapf
1313
name: "yapf (for labelbox-python repo)"
14-
args: [--verbose --recursive --parallel --style "google" ]
14+
args: [--verbose --recursive --parallel --style="google" ]

labelbox/client.py

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ class Client:
3636
authentication key). Provides functions for querying and creating
3737
top-level data objects (Projects, Datasets).
3838
"""
39+
3940
def __init__(self,
4041
api_key=None,
4142
endpoint='https://api.labelbox.com/graphql',
@@ -132,8 +133,7 @@ def convert_value(value):
132133
if query is not None:
133134
if params is not None:
134135
params = {
135-
key: convert_value(value)
136-
for key, value in params.items()
136+
key: convert_value(value) for key, value in params.items()
137137
}
138138
data = json.dumps({
139139
'query': query,
@@ -334,18 +334,18 @@ def upload_data(self,
334334

335335
request_data = {
336336
"operations":
337-
json.dumps({
338-
"variables": {
339-
"file": None,
340-
"contentLength": len(content),
341-
"sign": sign
342-
},
343-
"query":
344-
"""mutation UploadFile($file: Upload!, $contentLength: Int!,
337+
json.dumps({
338+
"variables": {
339+
"file": None,
340+
"contentLength": len(content),
341+
"sign": sign
342+
},
343+
"query":
344+
"""mutation UploadFile($file: Upload!, $contentLength: Int!,
345345
$sign: Boolean) {
346346
uploadFile(file: $file, contentLength: $contentLength,
347347
sign: $sign) {url filename} } """,
348-
}),
348+
}),
349349
"map": (None, json.dumps({"1": ["variables.file"]})),
350350
}
351351
response = requests.post(
@@ -354,7 +354,7 @@ def upload_data(self,
354354
data=request_data,
355355
files={
356356
"1": (filename, content, content_type) if
357-
(filename and content_type) else content
357+
(filename and content_type) else content
358358
})
359359

360360
if response.status_code == 502:
@@ -527,9 +527,7 @@ def _create(self, db_object_type, data):
527527
res = res["create%s" % db_object_type.type_name()]
528528
return db_object_type(self, res)
529529

530-
def create_dataset(self,
531-
iam_integration=IAMIntegration._DEFAULT,
532-
**kwargs):
530+
def create_dataset(self, iam_integration=IAMIntegration._DEFAULT, **kwargs):
533531
""" Creates a Dataset object on the server.
534532
535533
Attribute values are passed as keyword arguments.
@@ -549,7 +547,8 @@ def create_dataset(self,
549547
"""
550548
dataset = self._create(Entity.Dataset, kwargs)
551549

552-
if iam_integration == IAMIntegration._DEFAULT: iam_integration = self.get_organization().get_default_iam_integration()
550+
if iam_integration == IAMIntegration._DEFAULT:iam_integration = self.get_organization(
551+
).get_default_iam_integration()
553552

554553
if iam_integration is None:
555554
return dataset
@@ -703,7 +702,7 @@ def get_data_row_ids_for_external_ids(
703702
for row in self.execute(
704703
query_str,
705704
{'externalId_in': external_ids[i:i + max_ids_per_request]
706-
})['externalIdsToDataRowIds']:
705+
})['externalIdsToDataRowIds']:
707706
result[row['externalId']].append(row['dataRowId'])
708707
return result
709708

0 commit comments

Comments
 (0)