datahold 4.0.0.dev7__tar.gz → 4.0.0.dev8__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {datahold-4.0.0.dev7 → datahold-4.0.0.dev8}/PKG-INFO +1 -1
- {datahold-4.0.0.dev7 → datahold-4.0.0.dev8}/pyproject.toml +1 -1
- {datahold-4.0.0.dev7 → datahold-4.0.0.dev8}/src/datahold/__init__.py +34 -31
- {datahold-4.0.0.dev7 → datahold-4.0.0.dev8}/src/datahold.egg-info/PKG-INFO +1 -1
- {datahold-4.0.0.dev7 → datahold-4.0.0.dev8}/tests/testdata.toml +9 -0
- {datahold-4.0.0.dev7 → datahold-4.0.0.dev8}/LICENSE.txt +0 -0
- {datahold-4.0.0.dev7 → datahold-4.0.0.dev8}/MANIFEST.in +0 -0
- {datahold-4.0.0.dev7 → datahold-4.0.0.dev8}/README.rst +0 -0
- {datahold-4.0.0.dev7 → datahold-4.0.0.dev8}/docs/v1.1.rst +0 -0
- {datahold-4.0.0.dev7 → datahold-4.0.0.dev8}/docs/v1.2.rst +0 -0
- {datahold-4.0.0.dev7 → datahold-4.0.0.dev8}/docs/v2.0.rst +0 -0
- {datahold-4.0.0.dev7 → datahold-4.0.0.dev8}/docs/v2.1.rst +0 -0
- {datahold-4.0.0.dev7 → datahold-4.0.0.dev8}/docs/v2.2.rst +0 -0
- {datahold-4.0.0.dev7 → datahold-4.0.0.dev8}/docs/v2.3.rst +0 -0
- {datahold-4.0.0.dev7 → datahold-4.0.0.dev8}/docs/v3.0.rst +0 -0
- {datahold-4.0.0.dev7 → datahold-4.0.0.dev8}/docs/v4.0.rst +0 -0
- {datahold-4.0.0.dev7 → datahold-4.0.0.dev8}/run_tests.py +0 -0
- {datahold-4.0.0.dev7 → datahold-4.0.0.dev8}/setup.cfg +0 -0
- {datahold-4.0.0.dev7 → datahold-4.0.0.dev8}/src/datahold/py.typed +0 -0
- {datahold-4.0.0.dev7 → datahold-4.0.0.dev8}/src/datahold.egg-info/SOURCES.txt +0 -0
- {datahold-4.0.0.dev7 → datahold-4.0.0.dev8}/src/datahold.egg-info/dependency_links.txt +0 -0
- {datahold-4.0.0.dev7 → datahold-4.0.0.dev8}/src/datahold.egg-info/requires.txt +0 -0
- {datahold-4.0.0.dev7 → datahold-4.0.0.dev8}/src/datahold.egg-info/top_level.txt +0 -0
- {datahold-4.0.0.dev7 → datahold-4.0.0.dev8}/tests/test_FrozenHoldDict.py +0 -0
- {datahold-4.0.0.dev7 → datahold-4.0.0.dev8}/tests/test_FrozenHoldList.py +0 -0
- {datahold-4.0.0.dev7 → datahold-4.0.0.dev8}/tests/test_FrozenHoldSet.py +0 -0
- {datahold-4.0.0.dev7 → datahold-4.0.0.dev8}/tests/test_HoldDict.py +0 -0
- {datahold-4.0.0.dev7 → datahold-4.0.0.dev8}/tests/test_HoldList.py +0 -0
- {datahold-4.0.0.dev7 → datahold-4.0.0.dev8}/tests/test_HoldSet.py +0 -0
- {datahold-4.0.0.dev7 → datahold-4.0.0.dev8}/tests/test_testdata.py +0 -0
|
@@ -16,6 +16,7 @@ __all__: list[str] = [
|
|
|
16
16
|
"DataSet",
|
|
17
17
|
"FrozenDataDict",
|
|
18
18
|
"FrozenDataList",
|
|
19
|
+
"FrozenDataMapping",
|
|
19
20
|
"FrozenDataSet",
|
|
20
21
|
]
|
|
21
22
|
|
|
@@ -106,6 +107,10 @@ class BaseDataCollection[Item](
|
|
|
106
107
|
except TypeError:
|
|
107
108
|
return other in (x for x in self.__fget__()) # type: ignore[operator]
|
|
108
109
|
|
|
110
|
+
@abstractmethod
|
|
111
|
+
@setdoc.basic
|
|
112
|
+
def __fget__(self: Self) -> Data[Item]: ...
|
|
113
|
+
|
|
109
114
|
@setdoc.basic
|
|
110
115
|
def __iter__(self: Self, /) -> abc.Iterator[Item]:
|
|
111
116
|
return iter(self.__fget__())
|
|
@@ -114,10 +119,6 @@ class BaseDataCollection[Item](
|
|
|
114
119
|
def __len__(self: Self, /) -> int:
|
|
115
120
|
return len(self.__fget__())
|
|
116
121
|
|
|
117
|
-
@abstractmethod
|
|
118
|
-
@setdoc.basic
|
|
119
|
-
def __fget__(self: Self) -> Data[Item]: ...
|
|
120
|
-
|
|
121
122
|
|
|
122
123
|
### ABSTRACT SET ###
|
|
123
124
|
|
|
@@ -209,7 +210,10 @@ class DataSet[Item: abc.Hashable](
|
|
|
209
210
|
|
|
210
211
|
@setdoc.basic
|
|
211
212
|
def add(self: Self, item: Item, /) -> None:
|
|
212
|
-
|
|
213
|
+
data: set[Item]
|
|
214
|
+
data = self.__fget__()
|
|
215
|
+
data.add(item)
|
|
216
|
+
self.__fset__(data)
|
|
213
217
|
|
|
214
218
|
@setdoc.basic
|
|
215
219
|
def copy(self: Self) -> Self:
|
|
@@ -221,10 +225,7 @@ class DataSet[Item: abc.Hashable](
|
|
|
221
225
|
/,
|
|
222
226
|
*others: abc.Iterable[abc.Hashable],
|
|
223
227
|
) -> None:
|
|
224
|
-
|
|
225
|
-
data = self.__fget__()
|
|
226
|
-
data.difference_update(*others)
|
|
227
|
-
self.__fset__(data)
|
|
228
|
+
self.__fset__(self.__fget__().difference(*others))
|
|
228
229
|
|
|
229
230
|
@setdoc.basic
|
|
230
231
|
def discard(self: Self, item: abc.Hashable, /) -> None:
|
|
@@ -237,19 +238,13 @@ class DataSet[Item: abc.Hashable](
|
|
|
237
238
|
def intersection_update(
|
|
238
239
|
self: Self, /, *others: abc.Iterable[abc.Hashable]
|
|
239
240
|
) -> None:
|
|
240
|
-
|
|
241
|
-
data = self.__fget__()
|
|
242
|
-
data.intersection_update(*others)
|
|
243
|
-
self.__fset__(data)
|
|
241
|
+
self.__fset__(self.__fget__().intersection(*others))
|
|
244
242
|
|
|
245
243
|
@setdoc.basic
|
|
246
244
|
def symmetric_difference_update(
|
|
247
245
|
self: Self, other: abc.Iterable[Item], /
|
|
248
246
|
) -> None:
|
|
249
|
-
|
|
250
|
-
data = self.__fget__()
|
|
251
|
-
data.symmetric_difference_update(other)
|
|
252
|
-
self.__fset__(data)
|
|
247
|
+
self.__fset__(self.__fget__().symmetric_difference(other))
|
|
253
248
|
|
|
254
249
|
@setdoc.basic
|
|
255
250
|
def update(self: Self, /, *others: abc.Iterable[Item]) -> None:
|
|
@@ -257,7 +252,7 @@ class DataSet[Item: abc.Hashable](
|
|
|
257
252
|
|
|
258
253
|
|
|
259
254
|
### MAPPING ###
|
|
260
|
-
class BaseDataMapping[Key, Value](
|
|
255
|
+
class BaseDataMapping[Key: abc.Hashable, Value](
|
|
261
256
|
BaseDataCollection[Key], abc.Mapping[Key, Value]
|
|
262
257
|
):
|
|
263
258
|
"""Provide an easy abc for a custom mapping."""
|
|
@@ -270,8 +265,11 @@ class BaseDataMapping[Key, Value](
|
|
|
270
265
|
Protocol,
|
|
271
266
|
):
|
|
272
267
|
@setdoc.basic
|
|
273
|
-
def __getitem__(self: Self, key: Never, /) -> DataValue:
|
|
274
|
-
|
|
268
|
+
def __getitem__(self: Self, key: Never, /) -> DataValue: ...
|
|
269
|
+
|
|
270
|
+
@abstractmethod
|
|
271
|
+
@setdoc.basic
|
|
272
|
+
def __fget__(self: Self) -> Data[Key, Value]: ...
|
|
275
273
|
|
|
276
274
|
@setdoc.basic
|
|
277
275
|
def __getitem__(self: Self, key: object, /) -> Value:
|
|
@@ -280,9 +278,18 @@ class BaseDataMapping[Key, Value](
|
|
|
280
278
|
except TypeError:
|
|
281
279
|
raise KeyError(key) from None
|
|
282
280
|
|
|
283
|
-
|
|
281
|
+
|
|
282
|
+
class FrozenDataMapping[Key: abc.Hashable, Value](
|
|
283
|
+
BaseDataMapping[Key, Value],
|
|
284
|
+
abc.Hashable,
|
|
285
|
+
):
|
|
286
|
+
"""Provide an easy abc for a custom frozen mapping."""
|
|
287
|
+
|
|
288
|
+
__slots__ = ()
|
|
289
|
+
|
|
284
290
|
@setdoc.basic
|
|
285
|
-
def
|
|
291
|
+
def __hash__(self: Self) -> int:
|
|
292
|
+
return hash(frozendict(self.items()))
|
|
286
293
|
|
|
287
294
|
|
|
288
295
|
### DICT ###
|
|
@@ -350,16 +357,12 @@ class BaseDataDict[Key: abc.Hashable, Value](
|
|
|
350
357
|
|
|
351
358
|
class FrozenDataDict[Key: abc.Hashable, Value](
|
|
352
359
|
BaseDataDict[Key, Value],
|
|
353
|
-
|
|
360
|
+
FrozenDataMapping[Key | str, Optional[Value]],
|
|
354
361
|
):
|
|
355
362
|
"""Provide easy abc for custom frozen dict-like."""
|
|
356
363
|
|
|
357
364
|
__slots__ = ()
|
|
358
365
|
|
|
359
|
-
@setdoc.basic
|
|
360
|
-
def __hash__(self: Self) -> int:
|
|
361
|
-
return hash(frozendict(self.__fget__()))
|
|
362
|
-
|
|
363
366
|
|
|
364
367
|
class DataDict[Key: abc.Hashable, Value](
|
|
365
368
|
BaseDataDict[Key, Value],
|
|
@@ -434,6 +437,10 @@ class BaseDataSequence[Item](
|
|
|
434
437
|
self: Self, key: int | Slice[int], /
|
|
435
438
|
) -> DataItem | abc.Sequence[DataItem]: ...
|
|
436
439
|
|
|
440
|
+
@abstractmethod
|
|
441
|
+
@setdoc.basic
|
|
442
|
+
def __fget__(self: Self) -> Data[Item]: ...
|
|
443
|
+
|
|
437
444
|
@overload
|
|
438
445
|
@setdoc.basic
|
|
439
446
|
def __getitem__(self: Self, key: int, /) -> Item: ...
|
|
@@ -446,10 +453,6 @@ class BaseDataSequence[Item](
|
|
|
446
453
|
) -> Item | abc.Sequence[Item]:
|
|
447
454
|
return self.__fget__()[key]
|
|
448
455
|
|
|
449
|
-
@abstractmethod
|
|
450
|
-
@setdoc.basic
|
|
451
|
-
def __fget__(self: Self) -> Data[Item]: ...
|
|
452
|
-
|
|
453
456
|
|
|
454
457
|
### LIST ###
|
|
455
458
|
|
|
@@ -115,6 +115,8 @@ dirData = []
|
|
|
115
115
|
isabstract = true
|
|
116
116
|
|
|
117
117
|
[types.FrozenDataDict.parents]
|
|
118
|
+
BaseDataDict = true
|
|
119
|
+
FrozenDataMapping = true
|
|
118
120
|
|
|
119
121
|
[types.FrozenDataList]
|
|
120
122
|
Data = "tuple"
|
|
@@ -123,6 +125,13 @@ isabstract = true
|
|
|
123
125
|
|
|
124
126
|
[types.FrozenDataList.parents]
|
|
125
127
|
|
|
128
|
+
[types.FrozenDataMapping]
|
|
129
|
+
dirData = []
|
|
130
|
+
|
|
131
|
+
[types.FrozenDataMapping.parents]
|
|
132
|
+
BaseDataMapping = true
|
|
133
|
+
Hashable = true
|
|
134
|
+
|
|
126
135
|
[types.FrozenDataSet]
|
|
127
136
|
Data = "frozenset"
|
|
128
137
|
dirData = []
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|