Skip to content

Commit d27217c

Browse files
Rename abc to datastore_abc and typing to datastore_typing
1 parent 90b4b58 commit d27217c

19 files changed

+109
-100
lines changed

datastore/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"Query", "Cursor",
1818
"SerializerAdapter",
1919

20-
"abc", "typing", "util"
20+
"datastore_abc", "datastore_typing", "util"
2121
)
2222

2323

@@ -41,6 +41,6 @@
4141

4242

4343
### Exposed submodules ###
44-
from . import abc
45-
from . import typing
44+
from . import datastore_abc
45+
from . import datastore_typing
4646
from . import util

datastore/adapter/_support.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@
1010
#
1111
# * https://github.com/python/mypy/issues/7790 (Associated types)
1212
# * https://github.com/python/mypy/issues/7791 (Types of generic classes)
13-
DS = typing.TypeVar("DS", datastore.abc.BinaryDatastore,
14-
datastore.abc.ObjectDatastore[T_co]) # type: ignore[valid-type]
15-
DA = typing.TypeVar("DA", datastore.abc.BinaryAdapter,
16-
datastore.abc.ObjectAdapter[T_co, T_co]) # type: ignore[valid-type]
13+
DS = typing.TypeVar("DS", datastore.datastore_abc.BinaryDatastore,
14+
datastore.datastore_abc.ObjectDatastore[T_co]) # type: ignore[valid-type]
15+
DA = typing.TypeVar("DA", datastore.datastore_abc.BinaryAdapter,
16+
datastore.datastore_abc.ObjectAdapter[T_co, T_co]) # type: ignore[valid-type]
1717
MD = typing.TypeVar("MD", datastore.util.StreamMetadata,
1818
datastore.util.ChannelMetadata)
19-
RT = typing.TypeVar("RT", datastore.abc.ReceiveStream,
20-
datastore.abc.ReceiveChannel[T_co]) # type: ignore[valid-type]
19+
RT = typing.TypeVar("RT", datastore.datastore_abc.ReceiveStream,
20+
datastore.datastore_abc.ReceiveChannel[T_co]) # type: ignore[valid-type]
2121
RV = typing.TypeVar("RV", bytes, typing.List[T_co]) # type: ignore[valid-type]
2222

2323

datastore/adapter/directory.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ async def directory_remove(self, dir_key: datastore.Key, key: datastore.Key,
117117

118118
class ObjectDatastore(
119119
ObjectDirectorySupport,
120-
datastore.abc.ObjectAdapter[T_co, typing.Union[T_co, str]],
120+
datastore.datastore_abc.ObjectAdapter[T_co, typing.Union[T_co, str]],
121121
typing.Generic[T_co]
122122
):
123123
"""Datastore that tracks directory entries, like in a filesystem.
@@ -162,7 +162,7 @@ class ObjectDatastore(
162162
FORWARD_STAT = True
163163

164164

165-
async def _put(self, key: datastore.Key, value: datastore.abc.ReceiveChannel[T_co],
165+
async def _put(self, key: datastore.Key, value: datastore.datastore_abc.ReceiveChannel[T_co],
166166
**kwargs: typing.Any) -> None:
167167
"""Stores the object `value` named by `key`.
168168
DirectoryTreeDatastore stores a directory entry.
@@ -178,8 +178,10 @@ async def _put(self, key: datastore.Key, value: datastore.abc.ReceiveChannel[T_c
178178
await super().directory_add(dir_key, key, create=True)
179179

180180

181-
async def _put_new(self, prefix: datastore.Key, value: datastore.abc.ReceiveChannel[T_co],
182-
**kwargs: typing.Any) -> datastore.Key:
181+
async def _put_new(self,
182+
prefix: datastore.Key,
183+
value: datastore.datastore_abc.ReceiveChannel[T_co],
184+
**kwargs: typing.Any) -> datastore.Key:
183185
"""Stores the object `value` named by `key`.
184186
DirectoryTreeDatastore stores a directory entry.
185187
"""
@@ -197,7 +199,7 @@ async def _put_new(self, prefix: datastore.Key, value: datastore.abc.ReceiveChan
197199

198200

199201
async def _put_new_indirect(self, prefix: datastore.Key, **kwargs: typing.Any) \
200-
-> datastore.abc.ObjectAdapter._PUT_NEW_INDIRECT_RT[T_co]:
202+
-> datastore.datastore_abc.ObjectAdapter._PUT_NEW_INDIRECT_RT[T_co]:
201203
"""Stores the object `value` named by `key`.
202204
DirectoryTreeDatastore stores a directory entry.
203205
"""
@@ -207,7 +209,7 @@ async def _put_new_indirect(self, prefix: datastore.Key, **kwargs: typing.Any) \
207209
if key.is_top_level():
208210
return key, callback
209211

210-
async def callback_wrapper(value: datastore.abc.ReceiveChannel[T_co]) -> None:
212+
async def callback_wrapper(value: datastore.datastore_abc.ReceiveChannel[T_co]) -> None:
211213
# Add entry to directory
212214
dir_key = key.parent.instance('directory')
213215
await super(ObjectDatastore, self).directory_add(dir_key, key, create=True)

datastore/adapter/keytransform.py

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ async def _put_new_indirect(self, prefix: datastore.Key, **kwargs: typing.Any) \
108108
except BaseException:
109109
# Do proper cancellation on errors
110110
with trio.CancelScope(deadline=0):
111-
if isinstance(self, datastore.abc.BinaryDatastore):
111+
if isinstance(self, datastore.datastore_abc.BinaryDatastore):
112112
callback(datastore.util.receive_stream_from(b""))
113113
else:
114114
callback(datastore.util.receive_channel_from([]))
@@ -157,25 +157,25 @@ async def query(self, query: datastore.Query) -> datastore.Cursor:
157157

158158
class BinaryAdapter(
159159
_Adapter[
160-
datastore.abc.BinaryDatastore,
160+
datastore.datastore_abc.BinaryDatastore,
161161
datastore.util.StreamMetadata,
162-
datastore.abc.ReceiveStream,
162+
datastore.datastore_abc.ReceiveStream,
163163
bytes
164164
],
165-
datastore.abc.BinaryAdapter
165+
datastore.datastore_abc.BinaryAdapter
166166
):
167167
__slots__ = ("key_transform_fn",)
168168

169169

170170
class ObjectAdapter(
171171
typing.Generic[T_co],
172172
_Adapter[
173-
datastore.abc.ObjectDatastore[T_co],
173+
datastore.datastore_abc.ObjectDatastore[T_co],
174174
datastore.util.ChannelMetadata,
175-
datastore.abc.ReceiveChannel[T_co],
175+
datastore.datastore_abc.ReceiveChannel[T_co],
176176
typing.List[T_co]
177177
],
178-
datastore.abc.ObjectAdapter[T_co, T_co]
178+
datastore.datastore_abc.ObjectAdapter[T_co, T_co]
179179
):
180180
__slots__ = ("key_transform_fn",)
181181

@@ -217,25 +217,25 @@ def _transform_key(cls, key: datastore.Key) -> datastore.Key:
217217

218218
class BinaryLowercaseKeyAdapter(
219219
_LowercaseKeyAdapter[
220-
datastore.abc.BinaryDatastore,
220+
datastore.datastore_abc.BinaryDatastore,
221221
datastore.util.StreamMetadata,
222-
datastore.abc.ReceiveStream,
222+
datastore.datastore_abc.ReceiveStream,
223223
bytes
224224
],
225-
datastore.abc.BinaryAdapter
225+
datastore.datastore_abc.BinaryAdapter
226226
):
227227
__slots__ = ("key_transform_fn",)
228228

229229

230230
class ObjectLowercaseKeyAdapter(
231231
typing.Generic[T_co],
232232
_LowercaseKeyAdapter[
233-
datastore.abc.ObjectDatastore[T_co],
233+
datastore.datastore_abc.ObjectDatastore[T_co],
234234
datastore.util.ChannelMetadata,
235-
datastore.abc.ReceiveChannel[T_co],
235+
datastore.datastore_abc.ReceiveChannel[T_co],
236236
typing.List[T_co]
237237
],
238-
datastore.abc.ObjectAdapter[T_co, T_co]
238+
datastore.datastore_abc.ObjectAdapter[T_co, T_co]
239239
):
240240
__slots__ = ("key_transform_fn",)
241241

@@ -286,25 +286,25 @@ def _untransform_key(self, key: datastore.Key) -> datastore.Key:
286286

287287
class BinaryNamespaceAdapter(
288288
_NamespaceAdapter[
289-
datastore.abc.BinaryDatastore,
289+
datastore.datastore_abc.BinaryDatastore,
290290
datastore.util.StreamMetadata,
291-
datastore.abc.ReceiveStream,
291+
datastore.datastore_abc.ReceiveStream,
292292
bytes
293293
],
294-
datastore.abc.BinaryAdapter
294+
datastore.datastore_abc.BinaryAdapter
295295
):
296296
__slots__ = ("key_transform_fn", "namespace",)
297297

298298

299299
class ObjectNamespaceAdapter(
300300
typing.Generic[T_co],
301301
_NamespaceAdapter[
302-
datastore.abc.ObjectDatastore[T_co],
302+
datastore.datastore_abc.ObjectDatastore[T_co],
303303
datastore.util.ChannelMetadata,
304-
datastore.abc.ReceiveChannel[T_co],
304+
datastore.datastore_abc.ReceiveChannel[T_co],
305305
typing.List[T_co]
306306
],
307-
datastore.abc.ObjectAdapter[T_co, T_co]
307+
datastore.datastore_abc.ObjectAdapter[T_co, T_co]
308308
):
309309
__slots__ = ("key_transform_fn", "namespace",)
310310

@@ -412,24 +412,24 @@ def nested_path(path: str, depth: int, length: int) -> str:
412412

413413
class BinaryNestedPathAdapter(
414414
_NestedPathAdapter[
415-
datastore.abc.BinaryDatastore,
415+
datastore.datastore_abc.BinaryDatastore,
416416
datastore.util.StreamMetadata,
417-
datastore.abc.ReceiveStream,
417+
datastore.datastore_abc.ReceiveStream,
418418
bytes
419419
],
420-
datastore.abc.BinaryAdapter
420+
datastore.datastore_abc.BinaryAdapter
421421
):
422422
__slots__ = ("key_transform_fn", "nest_depth", "nest_length", "nest_keyfn")
423423

424424

425425
class ObjectNestedPathAdapter(
426426
typing.Generic[T_co],
427427
_NestedPathAdapter[
428-
datastore.abc.ObjectDatastore[T_co],
428+
datastore.datastore_abc.ObjectDatastore[T_co],
429429
datastore.util.ChannelMetadata,
430-
datastore.abc.ReceiveChannel[T_co],
430+
datastore.datastore_abc.ReceiveChannel[T_co],
431431
typing.List[T_co]
432432
],
433-
datastore.abc.ObjectAdapter[T_co, T_co]
433+
datastore.datastore_abc.ObjectAdapter[T_co, T_co]
434434
):
435435
__slots__ = ("key_transform_fn", "nest_depth", "nest_length", "nest_keyfn")

datastore/adapter/logging.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -148,24 +148,24 @@ async def query(self, query: datastore.Query) -> datastore.Cursor:
148148

149149
class BinaryAdapter(
150150
_Adapter[
151-
datastore.abc.BinaryDatastore,
151+
datastore.datastore_abc.BinaryDatastore,
152152
datastore.util.StreamMetadata,
153-
datastore.abc.ReceiveStream,
153+
datastore.datastore_abc.ReceiveStream,
154154
bytes
155155
],
156-
datastore.abc.BinaryAdapter
156+
datastore.datastore_abc.BinaryAdapter
157157
):
158158
__slots__ = ("logger",)
159159

160160

161161
class ObjectAdapter(
162162
typing.Generic[T_co],
163163
_Adapter[
164-
datastore.abc.ObjectDatastore[T_co],
164+
datastore.datastore_abc.ObjectDatastore[T_co],
165165
datastore.util.ChannelMetadata,
166-
datastore.abc.ReceiveChannel[T_co],
166+
datastore.datastore_abc.ReceiveChannel[T_co],
167167
typing.List[T_co]
168168
],
169-
datastore.abc.ObjectAdapter[T_co, T_co]
169+
datastore.datastore_abc.ObjectAdapter[T_co, T_co]
170170
):
171171
__slots__ = ("logger",)

datastore/adapter/mount.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -294,24 +294,24 @@ async def aclose(self) -> None:
294294

295295
class BinaryAdapter(
296296
_Adapter[
297-
datastore.abc.BinaryDatastore,
297+
datastore.datastore_abc.BinaryDatastore,
298298
datastore.util.StreamMetadata,
299-
datastore.abc.ReceiveStream,
299+
datastore.datastore_abc.ReceiveStream,
300300
bytes
301301
],
302-
datastore.abc.BinaryAdapter
302+
datastore.datastore_abc.BinaryAdapter
303303
):
304304
__slots__ = ("mounts",)
305305

306306

307307
class ObjectAdapter(
308308
typing.Generic[T_co],
309309
_Adapter[
310-
datastore.abc.ObjectDatastore[T_co],
310+
datastore.datastore_abc.ObjectDatastore[T_co],
311311
datastore.util.ChannelMetadata,
312-
datastore.abc.ReceiveChannel[T_co],
312+
datastore.datastore_abc.ReceiveChannel[T_co],
313313
typing.List[T_co]
314314
],
315-
datastore.abc.ObjectAdapter[T_co, T_co]
315+
datastore.datastore_abc.ObjectAdapter[T_co, T_co]
316316
):
317317
__slots__ = ("mounts",)

datastore/adapter/sharded.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,24 +130,24 @@ async def aclose(self) -> None:
130130

131131
class BinaryAdapter(
132132
_Adapter[
133-
datastore.abc.BinaryDatastore,
133+
datastore.datastore_abc.BinaryDatastore,
134134
datastore.util.StreamMetadata,
135-
datastore.abc.ReceiveStream,
135+
datastore.datastore_abc.ReceiveStream,
136136
bytes
137137
],
138-
datastore.abc.BinaryAdapter
138+
datastore.datastore_abc.BinaryAdapter
139139
):
140140
__slots__ = ("_shardingfn", "_stores")
141141

142142

143143
class ObjectAdapter(
144144
typing.Generic[T_co],
145145
_Adapter[
146-
datastore.abc.ObjectDatastore[T_co],
146+
datastore.datastore_abc.ObjectDatastore[T_co],
147147
datastore.util.ChannelMetadata,
148-
datastore.abc.ReceiveChannel[T_co],
148+
datastore.datastore_abc.ReceiveChannel[T_co],
149149
typing.List[T_co]
150150
],
151-
datastore.abc.ObjectAdapter[T_co, T_co]
151+
datastore.datastore_abc.ObjectAdapter[T_co, T_co]
152152
):
153153
__slots__ = ("_shardingfn", "_stores")

0 commit comments

Comments
 (0)