Skip to content

Commit b361e9f

Browse files
committed
test
1 parent 1d89556 commit b361e9f

File tree

2 files changed

+22
-19
lines changed

2 files changed

+22
-19
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: ['--parallel --style "google" ']

labelbox/client.py

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ class Client:
3636
authentication key). Provides functions for querying and creating
3737
top-level data objects (Projects, Datasets).
3838
"""
39-
4039
def __init__(self,
4140
api_key=None,
4241
endpoint='https://api.labelbox.com/graphql',
@@ -133,7 +132,8 @@ def convert_value(value):
133132
if query is not None:
134133
if params is not None:
135134
params = {
136-
key: convert_value(value) for key, value in params.items()
135+
key: convert_value(value)
136+
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,7 +527,9 @@ 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, iam_integration=IAMIntegration._DEFAULT, **kwargs):
530+
def create_dataset(self,
531+
iam_integration=IAMIntegration._DEFAULT,
532+
**kwargs):
531533
""" Creates a Dataset object on the server.
532534
533535
Attribute values are passed as keyword arguments.
@@ -547,11 +549,12 @@ def create_dataset(self, iam_integration=IAMIntegration._DEFAULT, **kwargs):
547549
"""
548550
dataset = self._create(Entity.Dataset, kwargs)
549551

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

554-
if iam_integration is None: return dataset
556+
if iam_integration is None:
557+
return dataset
555558

556559
try:
557560
if not isinstance(iam_integration, IAMIntegration):
@@ -702,7 +705,7 @@ def get_data_row_ids_for_external_ids(
702705
for row in self.execute(
703706
query_str,
704707
{'externalId_in': external_ids[i:i + max_ids_per_request]
705-
})['externalIdsToDataRowIds']:
708+
})['externalIdsToDataRowIds']:
706709
result[row['externalId']].append(row['dataRowId'])
707710
return result
708711

0 commit comments

Comments
 (0)