Skip to content

Commit 12b88a6

Browse files
Merge pull request #494 from adamtheturtle/commas
Commas
2 parents d36b5d2 + c187a0e commit 12b88a6

File tree

12 files changed

+30
-26
lines changed

12 files changed

+30
-26
lines changed

ci/run_script.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def run_test(test_filename: str) -> None:
2222
str(path),
2323
'--cov=src',
2424
'--cov=tests',
25-
]
25+
],
2626
)
2727
sys.exit(result)
2828

dev-requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ check-manifest==0.36
33
codecov==2.0.15 # Upload coverage data
44
dodgy==0.1.9 # Look for uploaded secrets
55
flake8==3.5.0 # Lint
6+
flake8-commas==2.0.0 # Require silicon valley commas
67
flake8-quotes==0.14.0 # Require single quotes
78
freezegun==0.3.10 # Freeze time in tests
89
hypothesis==3.50.2 # Generate test cases

src/mock_vws/_mock_web_query_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def decorator(method: Callable[..., str]) -> Callable[..., str]:
4848
route_name=method.__name__,
4949
path_pattern=path_pattern,
5050
http_methods=http_methods,
51-
)
51+
),
5252
)
5353

5454
return method

src/mock_vws/_mock_web_services_api.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def set_content_length_header(
9797
wrapped: Callable[..., str],
9898
instance: 'MockVuforiaWebServicesAPI', # pylint: disable=unused-argument
9999
args: Tuple[_RequestObjectProxy, _Context],
100-
kwargs: Dict
100+
kwargs: Dict,
101101
) -> str:
102102
"""
103103
Set the `Content-Length` header.
@@ -155,7 +155,7 @@ def decorator(method: Callable[..., str]) -> Callable[..., str]:
155155
route_name=method.__name__,
156156
path_pattern=path_pattern,
157157
http_methods=http_methods,
158-
)
158+
),
159159
)
160160

161161
key_validator = validate_keys(
@@ -287,7 +287,7 @@ def status(self) -> str:
287287
target is for detection.
288288
"""
289289
processing_time = datetime.timedelta(
290-
seconds=self._processing_time_seconds
290+
seconds=self._processing_time_seconds,
291291
)
292292

293293
time_since_change = datetime.datetime.now() - self.last_modified_date
@@ -312,7 +312,7 @@ def tracking_rating(self) -> int:
312312
pre_rating_time = datetime.timedelta(
313313
# That this is half of the total processing time is unrealistic.
314314
# In VWS it is not a constant percentage.
315-
seconds=self._processing_time_seconds / 2
315+
seconds=self._processing_time_seconds / 2,
316316
)
317317

318318
time_since_upload = datetime.datetime.now() - self.upload_date
@@ -474,29 +474,29 @@ def database_summary(
474474
target for target in self.targets
475475
if target.status == TargetStatuses.SUCCESS.value
476476
and target.active_flag
477-
]
477+
],
478478
)
479479

480480
failed_images = len(
481481
[
482482
target for target in self.targets
483483
if target.status == TargetStatuses.FAILED.value
484-
]
484+
],
485485
)
486486

487487
inactive_images = len(
488488
[
489489
target for target in self.targets
490490
if target.status == TargetStatuses.SUCCESS.value
491491
and not target.active_flag
492-
]
492+
],
493493
)
494494

495495
processing_images = len(
496496
[
497497
target for target in self.targets
498498
if target.status == TargetStatuses.PROCESSING.value
499-
]
499+
],
500500
)
501501

502502
body = {

src/mock_vws/_validators.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def authorization_header( # pylint: disable=too-many-arguments
4141
content: bytes,
4242
content_type: str,
4343
date: str,
44-
request_path: str
44+
request_path: str,
4545
) -> bytes:
4646
"""
4747
Return an `Authorization` header which can be used for a request made to

tests/mock_vws/conftest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,13 +168,13 @@ def verify_mock_vuforia_inactive(
168168
'_target_list',
169169
'_target_summary',
170170
'_update_target',
171-
]
171+
],
172172
)
173173
def endpoint(request: SubRequest) -> TargetAPIEndpoint:
174174
"""
175175
Return details of an endpoint.
176176
"""
177177
endpoint_fixture: TargetAPIEndpoint = request.getfixturevalue(
178-
request.param
178+
request.param,
179179
)
180180
return endpoint_fixture

tests/mock_vws/test_add_target.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class TestContentTypes:
6060
'Documented Content-Type',
6161
'Undocumented Content-Type',
6262
'Empty',
63-
]
63+
],
6464
)
6565
def test_content_types(
6666
self,
@@ -203,7 +203,8 @@ class TestTargetName:
203203
'name', [
204204
'a',
205205
'a' * 64,
206-
], ids=['Short name', 'Long name']
206+
],
207+
ids=['Short name', 'Long name'],
207208
)
208209
def test_name_valid(
209210
self,

tests/mock_vws/test_database_summary.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def test_success(
9393
It is possible to get a success response.
9494
"""
9595
response = database_summary(
96-
vuforia_database_keys=vuforia_database_keys
96+
vuforia_database_keys=vuforia_database_keys,
9797
)
9898

9999
assert_vws_response(

tests/mock_vws/test_target_summary.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def test_target_summary(
4747
'name': name,
4848
'width': 1,
4949
'image': image_data_encoded,
50-
}
50+
},
5151
)
5252

5353
target_id = target_response.json()['target_id']
@@ -116,7 +116,7 @@ def test_after_processing(
116116
'name': 'example',
117117
'width': 1,
118118
'image': image_data_encoded,
119-
}
119+
},
120120
)
121121

122122
target_id = target_response.json()['target_id']
@@ -170,7 +170,7 @@ def test_active_flag(
170170
'width': 1,
171171
'image': image_data_encoded,
172172
'active_flag': active_flag,
173-
}
173+
},
174174
)
175175

176176
response = target_api_request(

tests/mock_vws/test_update_target.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class TestUpdate:
4141
'Documented Content-Type',
4242
'Undocumented Content-Type',
4343
'Empty',
44-
]
44+
],
4545
)
4646
def test_content_types(
4747
self,
@@ -72,7 +72,7 @@ def test_content_types(
7272
vuforia_database_keys=vuforia_database_keys,
7373
data={'name': 'Adam'},
7474
target_id=target_id,
75-
content_type=content_type
75+
content_type=content_type,
7676
)
7777

7878
# Code is FORBIDDEN because the target is processing.
@@ -441,7 +441,8 @@ class TestTargetName:
441441
'name', [
442442
'a',
443443
'a' * 64,
444-
], ids=['Short name', 'Long name']
444+
],
445+
ids=['Short name', 'Long name'],
445446
)
446447
def test_name_valid(
447448
self,

0 commit comments

Comments
 (0)