Skip to content

Commit bc78ca6

Browse files
committed
test
1 parent a6658fa commit bc78ca6

File tree

2 files changed

+22
-19
lines changed

2 files changed

+22
-19
lines changed

.pre-commit-config.yaml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@ repos:
55
hooks:
66
- id: trailing-whitespace
77
- id: end-of-file-fixer
8+
89
- repo: https://github.com/google/yapf
910
rev: v0.31.0
1011
hooks:
11-
id: yapf
12-
name: "yapf (for labelbox-python repo)"
13-
args: ['-i --verbose --recursive --parallel --style "google" ']
14-
language_version: python3.8
12+
- id: yapf
13+
name: "yapf (for labelbox-python repo)"
14+
args: ['-i --verbose --recursive --parallel --style "google" ']
15+
language_version: python3.8

labelbox/client.py

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,12 @@
3030

3131

3232
class Client:
33-
""" A Labelbox client.
33+
""" A Labelbox client.
3434
3535
Contains info necessary for connecting to a Labelbox server (URL,
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.
@@ -703,7 +705,7 @@ def get_data_row_ids_for_external_ids(
703705
for row in self.execute(
704706
query_str,
705707
{'externalId_in': external_ids[i:i + max_ids_per_request]
706-
})['externalIdsToDataRowIds']:
708+
})['externalIdsToDataRowIds']:
707709
result[row['externalId']].append(row['dataRowId'])
708710
return result
709711

0 commit comments

Comments
 (0)