Skip to content

Commit 55adfe3

Browse files
chore: regenerate sync library after Mapping refactor
Regenerated the sync library from async sources to reflect the changes from PR #103 which switched input parameters from dict to Mapping. Co-authored-by: William Easton <strawgate@users.noreply.github.com>
1 parent b29d2e9 commit 55adfe3

File tree

17 files changed

+60
-60
lines changed

17 files changed

+60
-60
lines changed

key-value/key-value-sync/src/key_value/sync/code_gen/adapters/raise_on_missing/adapter.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# WARNING: this file is auto-generated by 'build_sync_library.py'
22
# from the original file 'adapter.py'
33
# DO NOT CHANGE! Change the original file instead.
4-
from collections.abc import Sequence
4+
from collections.abc import Mapping, Sequence
55
from typing import Any, Literal, SupportsFloat, overload
66

77
from key_value.shared.errors import MissingKeyError
@@ -129,7 +129,7 @@ def ttl_many(
129129

130130
return results
131131

132-
def put(self, key: str, value: dict[str, Any], *, collection: str | None = None, ttl: SupportsFloat | None = None) -> None:
132+
def put(self, key: str, value: Mapping[str, Any], *, collection: str | None = None, ttl: SupportsFloat | None = None) -> None:
133133
"""Store a key-value pair in the specified collection with optional TTL.
134134
135135
Args:
@@ -144,7 +144,7 @@ def put(self, key: str, value: dict[str, Any], *, collection: str | None = None,
144144
def put_many(
145145
self,
146146
keys: list[str],
147-
values: Sequence[dict[str, Any]],
147+
values: Sequence[Mapping[str, Any]],
148148
*,
149149
collection: str | None = None,
150150
ttl: Sequence[SupportsFloat | None] | None = None,

key-value/key-value-sync/src/key_value/sync/code_gen/protocols/key_value.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# WARNING: this file is auto-generated by 'build_sync_library.py'
22
# from the original file 'key_value.py'
33
# DO NOT CHANGE! Change the original file instead.
4-
from collections.abc import Sequence
4+
from collections.abc import Mapping, Sequence
55
from typing import Any, Protocol, SupportsFloat, runtime_checkable
66

77

@@ -34,7 +34,7 @@ def ttl(self, key: str, *, collection: str | None = None) -> tuple[dict[str, Any
3434
"""
3535
...
3636

37-
def put(self, key: str, value: dict[str, Any], *, collection: str | None = None, ttl: SupportsFloat | None = None) -> None:
37+
def put(self, key: str, value: Mapping[str, Any], *, collection: str | None = None, ttl: SupportsFloat | None = None) -> None:
3838
"""Store a key-value pair in the specified collection with optional TTL.
3939
4040
Args:
@@ -83,7 +83,7 @@ def ttl_many(self, keys: list[str], *, collection: str | None = None) -> list[tu
8383
def put_many(
8484
self,
8585
keys: list[str],
86-
values: Sequence[dict[str, Any]],
86+
values: Sequence[Mapping[str, Any]],
8787
*,
8888
collection: str | None = None,
8989
ttl: Sequence[SupportsFloat | None] | None = None,

key-value/key-value-sync/src/key_value/sync/code_gen/stores/base.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
from abc import ABC, abstractmethod
99
from collections import defaultdict
10-
from collections.abc import Sequence
10+
from collections.abc import Mapping, Sequence
1111
from threading import Lock
1212
from types import TracebackType
1313
from typing import Any, SupportsFloat
@@ -179,7 +179,7 @@ def _put_managed_entries(self, *, collection: str, keys: list[str], managed_entr
179179
self._put_managed_entry(collection=collection, key=key, managed_entry=managed_entry)
180180

181181
@override
182-
def put(self, key: str, value: dict[str, Any], *, collection: str | None = None, ttl: SupportsFloat | None = None) -> None:
182+
def put(self, key: str, value: Mapping[str, Any], *, collection: str | None = None, ttl: SupportsFloat | None = None) -> None:
183183
"""Store a key-value pair in the specified collection with optional TTL."""
184184
collection = collection or self.default_collection
185185
self.setup_collection(collection=collection)
@@ -189,8 +189,8 @@ def put(self, key: str, value: dict[str, Any], *, collection: str | None = None,
189189
self._put_managed_entry(collection=collection, key=key, managed_entry=managed_entry)
190190

191191
def _prepare_put_many(
192-
self, *, keys: list[str], values: Sequence[dict[str, Any]], ttl: Sequence[SupportsFloat | None] | SupportsFloat | None
193-
) -> tuple[list[str], Sequence[dict[str, Any]], list[float | None]]:
192+
self, *, keys: list[str], values: Sequence[Mapping[str, Any]], ttl: Sequence[SupportsFloat | None] | SupportsFloat | None
193+
) -> tuple[list[str], Sequence[Mapping[str, Any]], list[float | None]]:
194194
"""Prepare multiple managed entries for a put_many operation.
195195
196196
Inheriting classes can use this method if they need to modify a put_many operation."""
@@ -211,7 +211,7 @@ def _prepare_put_many(
211211
def put_many(
212212
self,
213213
keys: list[str],
214-
values: Sequence[dict[str, Any]],
214+
values: Sequence[Mapping[str, Any]],
215215
*,
216216
collection: str | None = None,
217217
ttl: Sequence[SupportsFloat | None] | None = None,

key-value/key-value-sync/src/key_value/sync/code_gen/wrappers/base.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# WARNING: this file is auto-generated by 'build_sync_library.py'
22
# from the original file 'base.py'
33
# DO NOT CHANGE! Change the original file instead.
4-
from collections.abc import Sequence
4+
from collections.abc import Mapping, Sequence
55
from typing import Any, SupportsFloat
66

77
from typing_extensions import override
@@ -31,14 +31,14 @@ def ttl_many(self, keys: list[str], *, collection: str | None = None) -> list[tu
3131
return self.key_value.ttl_many(collection=collection, keys=keys)
3232

3333
@override
34-
def put(self, key: str, value: dict[str, Any], *, collection: str | None = None, ttl: SupportsFloat | None = None) -> None:
34+
def put(self, key: str, value: Mapping[str, Any], *, collection: str | None = None, ttl: SupportsFloat | None = None) -> None:
3535
return self.key_value.put(collection=collection, key=key, value=value, ttl=ttl)
3636

3737
@override
3838
def put_many(
3939
self,
4040
keys: list[str],
41-
values: Sequence[dict[str, Any]],
41+
values: Sequence[Mapping[str, Any]],
4242
*,
4343
collection: str | None = None,
4444
ttl: Sequence[SupportsFloat | None] | None = None,

key-value/key-value-sync/src/key_value/sync/code_gen/wrappers/compression/wrapper.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import base64
55
import gzip
66
import json
7-
from collections.abc import Sequence
7+
from collections.abc import Mapping, Sequence
88
from typing import Any, SupportsFloat
99

1010
from key_value.shared.utils.managed_entry import ManagedEntry
@@ -126,18 +126,18 @@ def ttl_many(self, keys: list[str], *, collection: str | None = None) -> list[tu
126126
return [(self._decompress_value(value), ttl) for (value, ttl) in results]
127127

128128
@override
129-
def put(self, key: str, value: dict[str, Any], *, collection: str | None = None, ttl: SupportsFloat | None = None) -> None:
130-
compressed_value = self._compress_value(value)
129+
def put(self, key: str, value: Mapping[str, Any], *, collection: str | None = None, ttl: SupportsFloat | None = None) -> None:
130+
compressed_value = self._compress_value(dict(value))
131131
return self.key_value.put(key=key, value=compressed_value, collection=collection, ttl=ttl)
132132

133133
@override
134134
def put_many(
135135
self,
136136
keys: list[str],
137-
values: Sequence[dict[str, Any]],
137+
values: Sequence[Mapping[str, Any]],
138138
*,
139139
collection: str | None = None,
140140
ttl: Sequence[SupportsFloat | None] | None = None,
141141
) -> None:
142-
compressed_values = [self._compress_value(value) for value in values]
142+
compressed_values = [self._compress_value(dict(value)) for value in values]
143143
return self.key_value.put_many(keys=keys, values=compressed_values, collection=collection, ttl=ttl)

key-value/key-value-sync/src/key_value/sync/code_gen/wrappers/encryption/base.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# DO NOT CHANGE! Change the original file instead.
44
import base64
55
import json
6-
from collections.abc import Callable, Sequence
6+
from collections.abc import Callable, Mapping, Sequence
77
from typing import Any, SupportsFloat
88

99
from key_value.shared.errors.key_value import SerializationError
@@ -157,18 +157,18 @@ def ttl_many(self, keys: list[str], *, collection: str | None = None) -> list[tu
157157
return [(self._decrypt_value(value), ttl) for (value, ttl) in results]
158158

159159
@override
160-
def put(self, key: str, value: dict[str, Any], *, collection: str | None = None, ttl: SupportsFloat | None = None) -> None:
161-
encrypted_value = self._encrypt_value(value)
160+
def put(self, key: str, value: Mapping[str, Any], *, collection: str | None = None, ttl: SupportsFloat | None = None) -> None:
161+
encrypted_value = self._encrypt_value(dict(value))
162162
return self.key_value.put(key=key, value=encrypted_value, collection=collection, ttl=ttl)
163163

164164
@override
165165
def put_many(
166166
self,
167167
keys: list[str],
168-
values: Sequence[dict[str, Any]],
168+
values: Sequence[Mapping[str, Any]],
169169
*,
170170
collection: str | None = None,
171171
ttl: Sequence[SupportsFloat | None] | None = None,
172172
) -> None:
173-
encrypted_values = [self._encrypt_value(value) for value in values]
173+
encrypted_values = [self._encrypt_value(dict(value)) for value in values]
174174
return self.key_value.put_many(keys=keys, values=encrypted_values, collection=collection, ttl=ttl)

key-value/key-value-sync/src/key_value/sync/code_gen/wrappers/fallback/wrapper.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# WARNING: this file is auto-generated by 'build_sync_library.py'
22
# from the original file 'wrapper.py'
33
# DO NOT CHANGE! Change the original file instead.
4-
from collections.abc import Sequence
4+
from collections.abc import Mapping, Sequence
55
from typing import Any, SupportsFloat
66

77
from typing_extensions import override
@@ -74,7 +74,7 @@ def ttl_many(self, keys: list[str], *, collection: str | None = None) -> list[tu
7474
return self.fallback_key_value.ttl_many(keys=keys, collection=collection)
7575

7676
@override
77-
def put(self, key: str, value: dict[str, Any], *, collection: str | None = None, ttl: SupportsFloat | None = None) -> None:
77+
def put(self, key: str, value: Mapping[str, Any], *, collection: str | None = None, ttl: SupportsFloat | None = None) -> None:
7878
if self.write_to_fallback:
7979
try:
8080
return self.primary_key_value.put(key=key, value=value, collection=collection, ttl=ttl)
@@ -87,7 +87,7 @@ def put(self, key: str, value: dict[str, Any], *, collection: str | None = None,
8787
def put_many(
8888
self,
8989
keys: list[str],
90-
values: Sequence[dict[str, Any]],
90+
values: Sequence[Mapping[str, Any]],
9191
*,
9292
collection: str | None = None,
9393
ttl: Sequence[SupportsFloat | None] | None = None,

key-value/key-value-sync/src/key_value/sync/code_gen/wrappers/limit_size/wrapper.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# WARNING: this file is auto-generated by 'build_sync_library.py'
22
# from the original file 'wrapper.py'
33
# DO NOT CHANGE! Change the original file instead.
4-
from collections.abc import Sequence
4+
from collections.abc import Mapping, Sequence
55
from typing import Any, SupportsFloat
66

77
from key_value.shared.errors.wrappers.limit_size import EntryTooLargeError, EntryTooSmallError
@@ -83,28 +83,28 @@ def _within_size_limit(self, value: dict[str, Any], *, collection: str | None =
8383
return True
8484

8585
@override
86-
def put(self, key: str, value: dict[str, Any], *, collection: str | None = None, ttl: SupportsFloat | None = None) -> None:
87-
if self._within_size_limit(value=value, collection=collection, key=key):
86+
def put(self, key: str, value: Mapping[str, Any], *, collection: str | None = None, ttl: SupportsFloat | None = None) -> None:
87+
if self._within_size_limit(value=dict(value), collection=collection, key=key):
8888
self.key_value.put(collection=collection, key=key, value=value, ttl=ttl)
8989

9090
@override
9191
def put_many(
9292
self,
9393
keys: list[str],
94-
values: Sequence[dict[str, Any]],
94+
values: Sequence[Mapping[str, Any]],
9595
*,
9696
collection: str | None = None,
9797
ttl: Sequence[SupportsFloat | None] | None = None,
9898
) -> None:
9999
filtered_keys: list[str] = []
100-
filtered_values: list[dict[str, Any]] = []
100+
filtered_values: list[Mapping[str, Any]] = []
101101
filtered_ttls: list[SupportsFloat | None] | None = None
102102

103103
if isinstance(ttl, Sequence):
104104
filtered_ttls = []
105105

106106
for i, (k, v) in enumerate(zip(keys, values, strict=True)):
107-
if self._within_size_limit(value=v, collection=collection, key=k):
107+
if self._within_size_limit(value=dict(v), collection=collection, key=k):
108108
filtered_keys.append(k)
109109
filtered_values.append(v)
110110
if isinstance(ttl, Sequence):

key-value/key-value-sync/src/key_value/sync/code_gen/wrappers/logging/wrapper.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# DO NOT CHANGE! Change the original file instead.
44
import json
55
import logging
6-
from collections.abc import Sequence
6+
from collections.abc import Mapping, Sequence
77
from typing import Any, Literal, SupportsFloat
88

99
from typing_extensions import override
@@ -144,7 +144,7 @@ def ttl_many(self, keys: list[str], *, collection: str | None = None) -> list[tu
144144
return results
145145

146146
@override
147-
def put(self, key: str, value: dict[str, Any], *, collection: str | None = None, ttl: SupportsFloat | None = None) -> None:
147+
def put(self, key: str, value: Mapping[str, Any], *, collection: str | None = None, ttl: SupportsFloat | None = None) -> None:
148148
self._log(state="start", action="PUT", keys=key, collection=collection, values=value, extra={"ttl": ttl})
149149

150150
self.key_value.put(key=key, value=value, collection=collection, ttl=ttl)
@@ -155,7 +155,7 @@ def put(self, key: str, value: dict[str, Any], *, collection: str | None = None,
155155
def put_many(
156156
self,
157157
keys: list[str],
158-
values: Sequence[dict[str, Any]],
158+
values: Sequence[Mapping[str, Any]],
159159
*,
160160
collection: str | None = None,
161161
ttl: Sequence[SupportsFloat | None] | None = None,

key-value/key-value-sync/src/key_value/sync/code_gen/wrappers/passthrough_cache/wrapper.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# WARNING: this file is auto-generated by 'build_sync_library.py'
22
# from the original file 'wrapper.py'
33
# DO NOT CHANGE! Change the original file instead.
4-
from collections.abc import Sequence
4+
from collections.abc import Mapping, Sequence
55
from typing import Any, SupportsFloat
66

77
from typing_extensions import override
@@ -147,7 +147,7 @@ def ttl_many(self, keys: list[str], *, collection: str | None = None) -> list[tu
147147
return [key_to_value[key] for key in keys]
148148

149149
@override
150-
def put(self, key: str, value: dict[str, Any], *, collection: str | None = None, ttl: SupportsFloat | None = None) -> None:
150+
def put(self, key: str, value: Mapping[str, Any], *, collection: str | None = None, ttl: SupportsFloat | None = None) -> None:
151151
_ = self.cache_key_value.delete(collection=collection, key=key)
152152

153153
self.primary_key_value.put(collection=collection, key=key, value=value, ttl=ttl)
@@ -156,7 +156,7 @@ def put(self, key: str, value: dict[str, Any], *, collection: str | None = None,
156156
def put_many(
157157
self,
158158
keys: list[str],
159-
values: Sequence[dict[str, Any]],
159+
values: Sequence[Mapping[str, Any]],
160160
*,
161161
collection: str | None = None,
162162
ttl: Sequence[SupportsFloat | None] | None = None,

0 commit comments

Comments
 (0)