Skip to content

Commit 65fd0bb

Browse files
[pre-commit.ci lite] apply automatic fixes
1 parent 4543265 commit 65fd0bb

File tree

73 files changed

+449
-499
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+449
-499
lines changed

admin/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
"""Admin tools."""
1+
"""
2+
Admin tools.
3+
"""

admin/create_secrets_files.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
"""
2-
Create licenses and target databases for the tests to run against.
1+
"""Create licenses and target databases for the tests to run against.
32
43
Usage:
54
@@ -11,7 +10,6 @@
1110
$ export EXISTING_SECRETS_FILE=/existing/file/with/inactive/db/creds
1211
# You may have to run this a few times, but it is idempotent.
1312
$ python admin/create_secrets_files.py
14-
1513
"""
1614

1715
import datetime
@@ -27,7 +25,9 @@
2725

2826

2927
def main() -> None:
30-
"""Create secrets files."""
28+
"""
29+
Create secrets files.
30+
"""
3131
email_address = os.environ["VWS_EMAIL_ADDRESS"]
3232
password = os.environ["VWS_PASSWORD"]
3333
new_secrets_dir = Path(os.environ["NEW_SECRETS_DIR"]).expanduser()

ci/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
"""CI helpers."""
1+
"""
2+
CI helpers.
3+
"""

ci/test_custom_linters.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,7 @@ def test_tests_collected_once(
9191
capsys: pytest.CaptureFixture[str],
9292
request: pytest.FixtureRequest,
9393
) -> None:
94-
"""
95-
Each test in the test suite is collected exactly once.
94+
"""Each test in the test suite is collected exactly once.
9695
9796
This does not necessarily mean that they are run - they may be skipped.
9897
"""

conftest.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
"""Setup for Sybil."""
1+
"""
2+
Setup for Sybil.
3+
"""
24

35
from doctest import ELLIPSIS
46

@@ -35,8 +37,7 @@ def pytest_collection_modifyitems(items: list[pytest.Item]) -> None:
3537
@beartype
3638
@pytest.hookimpl(optionalhook=True)
3739
def pytest_set_filtered_exceptions() -> tuple[type[Exception], ...]:
38-
"""
39-
Return exceptions to retry on.
40+
"""Return exceptions to retry on.
4041
4142
This is for ``pytest-retry``.
4243
The configuration for retries is in ``pyproject.toml``.

docs/source/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
"""Documentation."""
1+
"""
2+
Documentation.
3+
"""

src/mock_vws/_base64_decoding.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111

1212
@beartype
1313
def decode_base64(encoded_data: str) -> bytes:
14-
"""
15-
Decode base64 somewhat like Vuforia does.
14+
"""Decode base64 somewhat like Vuforia does.
1615
1716
Raises:
1817
binascii.Error: Vuforia would consider this encoded data as an

src/mock_vws/_constants.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99

1010
@beartype
1111
class ResultCodes(Enum):
12-
"""
13-
Constants representing various VWS result codes.
12+
"""Constants representing various VWS result codes.
1413
1514
See
1615
https://developer.vuforia.com/library/web-api/cloud-targets-web-services-api#result-codes.
@@ -44,8 +43,7 @@ class ResultCodes(Enum):
4443

4544
@beartype
4645
class TargetStatuses(Enum):
47-
"""
48-
Constants representing VWS target statuses.
46+
"""Constants representing VWS target statuses.
4947
5048
See the 'status' field in
5149
https://developer.vuforia.com/library/web-api/cloud-targets-web-services-api#target-record

src/mock_vws/_database_matchers.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ def get_database_matching_client_keys(
1919
request_path: str,
2020
databases: Iterable[VuforiaDatabase],
2121
) -> VuforiaDatabase:
22-
"""
23-
Return the first of the given databases which is being accessed by the
22+
"""Return the first of the given databases which is being accessed by the
2423
given client request.
2524
2625
Args:
@@ -65,8 +64,7 @@ def get_database_matching_server_keys(
6564
request_path: str,
6665
databases: Iterable[VuforiaDatabase],
6766
) -> VuforiaDatabase:
68-
"""
69-
Return the first of the given databases which is being accessed by the
67+
"""Return the first of the given databases which is being accessed by the
7068
given server request.
7169
7270
Args:
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
"""Flask server for the mock Vuforia web service."""
1+
"""
2+
Flask server for the mock Vuforia web service.
3+
"""

src/mock_vws/_flask_server/target_manager.py

Lines changed: 33 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,18 @@
3232

3333
@beartype
3434
class _TargetRaterChoice(StrEnum):
35-
"""Target rater choices."""
35+
"""
36+
Target rater choices.
37+
"""
3638

3739
BRISQUE = auto()
3840
PERFECT = auto()
3941
RANDOM = auto()
4042

4143
def to_target_rater(self) -> TargetTrackingRater:
42-
"""Get the target rater."""
44+
"""
45+
Get the target rater.
46+
"""
4347
match self:
4448
case self.BRISQUE:
4549
return BrisqueTargetTrackingRater()
@@ -53,7 +57,9 @@ def to_target_rater(self) -> TargetTrackingRater:
5357

5458
@beartype
5559
class TargetManagerSettings(BaseSettings):
56-
"""Settings for the Target Manager Flask app."""
60+
"""
61+
Settings for the Target Manager Flask app.
62+
"""
5763

5864
target_manager_host: str = ""
5965
target_rater: _TargetRaterChoice = _TargetRaterChoice.BRISQUE
@@ -65,8 +71,7 @@ class TargetManagerSettings(BaseSettings):
6571
)
6672
@beartype
6773
def delete_database(database_name: str) -> Response:
68-
"""
69-
Delete a database.
74+
"""Delete a database.
7075
7176
:status 200: The database has been deleted.
7277
"""
@@ -99,32 +104,29 @@ def get_databases() -> Response:
99104
@TARGET_MANAGER_FLASK_APP.route("/databases", methods=[HTTPMethod.POST])
100105
@beartype
101106
def create_database() -> Response:
102-
"""
103-
Create a new database.
104-
105-
:reqheader Content-Type: application/json
106-
:resheader Content-Type: application/json
107-
108-
:reqjson string client_access_key: (Optional) The client access key for the
109-
database.
110-
:reqjson string client_secret_key: (Optional) The client secret key for the
111-
database.
112-
:reqjson string database_name: (Optional) The name of the database.
113-
:reqjson string server_access_key: (Optional) The server access key for the
114-
database.
115-
:reqjson string server_secret_key: (Optional) The server secret key for the
116-
database.
117-
:reqjson string state_name: (Optional) The state of the database. This can
118-
be "WORKING" or "PROJECT_INACTIVE". This defaults to "WORKING".
119-
120-
:resjson string client_access_key: The client access key for the database.
121-
:resjson string client_secret_key: The client secret key for the database.
122-
:resjson string database_name: The database name.
123-
:resjson string server_access_key: The server access key for the database.
124-
:resjson string server_secret_key: The server secret key for the database.
125-
:resjson string state_name: The database state. This will be "WORKING" or
126-
"PROJECT_INACTIVE".
127-
:reqjsonarr targets: The targets in the database.
107+
"""Create a new database.
108+
109+
:reqheader Content-Type: application/json :resheader Content-Type:
110+
application/json
111+
112+
:reqjson string client_access_key: (Optional) The client access key
113+
for the database. :reqjson string client_secret_key: (Optional)
114+
The client secret key for the database. :reqjson string
115+
database_name: (Optional) The name of the database. :reqjson string
116+
server_access_key: (Optional) The server access key for the
117+
database. :reqjson string server_secret_key: (Optional) The server
118+
secret key for the database. :reqjson string state_name:
119+
(Optional) The state of the database. This can be "WORKING" or
120+
"PROJECT_INACTIVE". This defaults to "WORKING".
121+
122+
:resjson string client_access_key: The client access key for the
123+
database. :resjson string client_secret_key: The client secret key
124+
for the database. :resjson string database_name: The database name.
125+
:resjson string server_access_key: The server access key for the
126+
database. :resjson string server_secret_key: The server secret key
127+
for the database. :resjson string state_name: The database state.
128+
This will be "WORKING" or "PROJECT_INACTIVE". :reqjsonarr targets:
129+
The targets in the database.
128130
129131
:status 201: The database has been successfully created.
130132
"""

src/mock_vws/_flask_server/vwq.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
"""
2-
A fake implementation of the Vuforia Web Query API using Flask.
1+
"""A fake implementation of the Vuforia Web Query API using Flask.
32
43
See
54
https://developer.vuforia.com/library/web-api/vuforia-query-web-api
@@ -34,13 +33,17 @@
3433

3534
@beartype
3635
class _ImageMatcherChoice(StrEnum):
37-
"""Image matcher choices."""
36+
"""
37+
Image matcher choices.
38+
"""
3839

3940
EXACT = auto()
4041
STRUCTURAL_SIMILARITY = auto()
4142

4243
def to_image_matcher(self) -> ImageMatcher:
43-
"""Get the image matcher."""
44+
"""
45+
Get the image matcher.
46+
"""
4447
match self:
4548
case self.EXACT:
4649
return ExactMatcher()
@@ -52,7 +55,9 @@ def to_image_matcher(self) -> ImageMatcher:
5255

5356
@beartype
5457
class VWQSettings(BaseSettings):
55-
"""Settings for the VWQ Flask app."""
58+
"""
59+
Settings for the VWQ Flask app.
60+
"""
5661

5762
vwq_host: str = ""
5863
target_manager_base_url: str
@@ -80,10 +85,9 @@ def get_all_databases() -> set[VuforiaDatabase]:
8085
@CLOUDRECO_FLASK_APP.before_request
8186
@beartype
8287
def set_terminate_wsgi_input() -> None:
83-
"""
84-
We set ``wsgi.input_terminated`` to ``True`` when going through
85-
``requests`` in our tests, so that requests have the given
86-
``Content-Length`` headers and the given data in ``request.headers`` and
88+
"""We set ``wsgi.input_terminated`` to ``True`` when going through
89+
``requests`` in our tests, so that requests have the given ``Content-
90+
Length`` headers and the given data in ``request.headers`` and
8791
``request.data``.
8892
8993
We do not set this at all when running an application as standalone.

0 commit comments

Comments
 (0)