Skip to content

Commit 6545b7f

Browse files
Rename DatabaseDict to CloudDatabaseDict (#2967)
* Rename DatabaseDict to CloudDatabaseDict DatabaseDict represents a cloud database in the target manager. This rename clarifies that there are three database types: Device, Cloud, and VuMark. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com> * Rename VuforiaDatabase to CloudDatabase Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Haiku 4.5 <noreply@anthropic.com>
1 parent 7206757 commit 6545b7f

34 files changed

Lines changed: 196 additions & 196 deletions

README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ This requires Python |minimum-python-version|\+.
2626
import requests
2727
2828
from mock_vws import MockVWS
29-
from mock_vws.database import VuforiaDatabase
29+
from mock_vws.database import CloudDatabase
3030
3131
with MockVWS() as mock:
32-
database = VuforiaDatabase()
32+
database = CloudDatabase()
3333
mock.add_database(database=database)
3434
# This will use the Vuforia mock.
3535
requests.get(url="https://vws.vuforia.com/summary", timeout=30)

docs/source/basic-example.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ Using the mock redirects requests to Vuforia made with `requests`_ to an in-memo
77
import requests
88
99
from mock_vws import MockVWS
10-
from mock_vws.database import VuforiaDatabase
10+
from mock_vws.database import CloudDatabase
1111
1212
with MockVWS() as mock:
13-
database = VuforiaDatabase()
13+
database = CloudDatabase()
1414
mock.add_database(database=database)
1515
# This will use the Vuforia mock.
1616
requests.get(url="https://vws.vuforia.com/summary", timeout=30)

docs/source/mock-api-reference.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ API Reference
1111
:members:
1212
:undoc-members:
1313

14-
.. Many parts of the VuforiaDatabase API are used for the Flask target
14+
.. Many parts of the CloudDatabase API are used for the Flask target
1515
.. database app, but Python users are not expected to use them.
1616
.. Therefore, they are not documented.
1717
18-
.. autoclass:: mock_vws.database.VuforiaDatabase
18+
.. autoclass:: mock_vws.database.CloudDatabase
1919
:members:
2020
:undoc-members:
2121
:exclude-members: to_dict, get_target, from_dict, not_deleted_targets, active_targets, inactive_targets, failed_targets, processing_targets

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ ignore_names = [
450450
# pydantic-settings
451451
"model_config",
452452
# Used in TYPE_CHECKING for type hints
453-
"DatabaseDict",
453+
"CloudDatabaseDict",
454454
"VuMarkDatabaseDict",
455455
]
456456
# Duplicate some of .gitignore

src/mock_vws/_database_matchers.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from beartype import beartype
66
from vws_auth_tools import authorization_header
77

8-
from mock_vws.database import VuforiaDatabase
8+
from mock_vws.database import CloudDatabase
99

1010

1111
@beartype
@@ -15,8 +15,8 @@ def get_database_matching_client_keys(
1515
request_body: bytes | None,
1616
request_method: str,
1717
request_path: str,
18-
databases: Iterable[VuforiaDatabase],
19-
) -> VuforiaDatabase:
18+
databases: Iterable[CloudDatabase],
19+
) -> CloudDatabase:
2020
"""Return the first of the given databases which is being accessed by
2121
the
2222
given client request.
@@ -64,8 +64,8 @@ def get_database_matching_server_keys(
6464
request_body: bytes | None,
6565
request_method: str,
6666
request_path: str,
67-
databases: Iterable[VuforiaDatabase],
68-
) -> VuforiaDatabase:
67+
databases: Iterable[CloudDatabase],
68+
) -> CloudDatabase:
6969
"""Return the first of the given databases which is being accessed by
7070
the
7171
given server request.

src/mock_vws/_flask_server/target_manager.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from flask import Flask, Response, request
1313
from pydantic_settings import BaseSettings
1414

15-
from mock_vws.database import VuforiaDatabase
15+
from mock_vws.database import CloudDatabase
1616
from mock_vws.states import States
1717
from mock_vws.target import ImageTarget
1818
from mock_vws.target_manager import TargetManager
@@ -133,7 +133,7 @@ def create_database() -> Response:
133133
134134
:status 201: The database has been successfully created.
135135
"""
136-
random_database = VuforiaDatabase()
136+
random_database = CloudDatabase()
137137
request_json = json.loads(s=request.data)
138138
server_access_key = request_json.get(
139139
"server_access_key",
@@ -162,7 +162,7 @@ def create_database() -> Response:
162162

163163
state = States[state_name]
164164

165-
database = VuforiaDatabase(
165+
database = CloudDatabase(
166166
server_access_key=server_access_key,
167167
server_secret_key=server_secret_key,
168168
client_access_key=client_access_key,

src/mock_vws/_flask_server/vwq.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
from mock_vws._query_validators.exceptions import (
2222
ValidatorError,
2323
)
24-
from mock_vws.database import VuforiaDatabase
24+
from mock_vws.database import CloudDatabase
2525
from mock_vws.image_matchers import (
2626
ExactMatcher,
2727
ImageMatcher,
@@ -63,15 +63,15 @@ class VWQSettings(BaseSettings):
6363

6464

6565
@beartype
66-
def get_all_databases() -> set[VuforiaDatabase]:
66+
def get_all_databases() -> set[CloudDatabase]:
6767
"""Get all database objects from the target manager back-end."""
6868
settings = VWQSettings.model_validate(obj={})
6969
response = requests.get(
7070
url=f"{settings.target_manager_base_url}/databases",
7171
timeout=30,
7272
)
7373
return {
74-
VuforiaDatabase.from_dict(database_dict=database_dict)
74+
CloudDatabase.from_dict(database_dict=database_dict)
7575
for database_dict in response.json()
7676
}
7777

src/mock_vws/_flask_server/vws.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
TargetStatusProcessingError,
3737
ValidatorError,
3838
)
39-
from mock_vws.database import VuforiaDatabase
39+
from mock_vws.database import CloudDatabase
4040
from mock_vws.image_matchers import (
4141
ExactMatcher,
4242
ImageMatcher,
@@ -86,7 +86,7 @@ class VWSSettings(BaseSettings):
8686

8787

8888
@beartype
89-
def get_all_databases() -> set[VuforiaDatabase]:
89+
def get_all_databases() -> set[CloudDatabase]:
9090
"""Get all database objects from the task manager back-end."""
9191
settings = VWSSettings.model_validate(obj={})
9292
timeout_seconds = 30
@@ -95,7 +95,7 @@ def get_all_databases() -> set[VuforiaDatabase]:
9595
timeout=timeout_seconds,
9696
)
9797
return {
98-
VuforiaDatabase.from_dict(database_dict=database_dict)
98+
CloudDatabase.from_dict(database_dict=database_dict)
9999
for database_dict in response.json()
100100
}
101101

src/mock_vws/_query_tools.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from mock_vws._constants import ResultCodes, TargetStatuses
1515
from mock_vws._database_matchers import get_database_matching_client_keys
1616
from mock_vws._mock_common import json_dump
17-
from mock_vws.database import VuforiaDatabase
17+
from mock_vws.database import CloudDatabase
1818
from mock_vws.image_matchers import ImageMatcher
1919

2020

@@ -25,7 +25,7 @@ def get_query_match_response_text(
2525
request_body: bytes,
2626
request_method: str,
2727
request_path: str,
28-
databases: Iterable[VuforiaDatabase],
28+
databases: Iterable[CloudDatabase],
2929
query_match_checker: ImageMatcher,
3030
) -> str:
3131
"""

src/mock_vws/_query_validators/__init__.py

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

55
from beartype import beartype
66

7-
from mock_vws.database import VuforiaDatabase
7+
from mock_vws.database import CloudDatabase
88

99
from .accept_header_validators import validate_accept_header
1010
from .auth_validators import (
@@ -45,7 +45,7 @@ def run_query_validators(
4545
request_headers: Mapping[str, str],
4646
request_body: bytes,
4747
request_method: str,
48-
databases: Iterable[VuforiaDatabase],
48+
databases: Iterable[CloudDatabase],
4949
) -> None:
5050
"""Run all validators.
5151

0 commit comments

Comments
 (0)