datahold 4.0.0.dev30__tar.gz → 4.0.0.dev32__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.dev30 → datahold-4.0.0.dev32}/PKG-INFO +1 -1
- {datahold-4.0.0.dev30 → datahold-4.0.0.dev32}/pyproject.toml +1 -1
- {datahold-4.0.0.dev30 → datahold-4.0.0.dev32}/src/datahold/__init__.py +61 -29
- {datahold-4.0.0.dev30 → datahold-4.0.0.dev32}/src/datahold.egg-info/PKG-INFO +1 -1
- datahold-4.0.0.dev32/tests/test_FrozenDictSlot.py +585 -0
- {datahold-4.0.0.dev30 → datahold-4.0.0.dev32}/tests/test_FrozenListSlot.py +160 -133
- {datahold-4.0.0.dev30 → datahold-4.0.0.dev32}/tests/test_FrozenSetSlot.py +136 -108
- datahold-4.0.0.dev32/tests/test_MutableDictSlot.py +713 -0
- {datahold-4.0.0.dev30 → datahold-4.0.0.dev32}/tests/test_MutableListSlot.py +333 -292
- datahold-4.0.0.dev32/tests/test_MutableSetSlot.py +824 -0
- {datahold-4.0.0.dev30 → datahold-4.0.0.dev32}/tests/test_abstractmethods.py +1 -1
- {datahold-4.0.0.dev30 → datahold-4.0.0.dev32}/tests/test_all.py +10 -0
- {datahold-4.0.0.dev30 → datahold-4.0.0.dev32}/tests/test_attributes.py +2 -0
- {datahold-4.0.0.dev30 → datahold-4.0.0.dev32}/tests/test_docs.py +4 -0
- {datahold-4.0.0.dev30 → datahold-4.0.0.dev32}/tests/test_generic.py +2 -0
- {datahold-4.0.0.dev30 → datahold-4.0.0.dev32}/tests/test_issubclass.py +8 -1
- {datahold-4.0.0.dev30 → datahold-4.0.0.dev32}/tests/test_metaclass.py +1 -0
- {datahold-4.0.0.dev30 → datahold-4.0.0.dev32}/tests/test_name.py +4 -1
- {datahold-4.0.0.dev30 → datahold-4.0.0.dev32}/tests/test_nested.py +16 -2
- {datahold-4.0.0.dev30 → datahold-4.0.0.dev32}/tests/test_sorted.py +2 -0
- {datahold-4.0.0.dev30 → datahold-4.0.0.dev32}/tests/test_variance.py +7 -1
- {datahold-4.0.0.dev30 → datahold-4.0.0.dev32}/tests/testdata.toml +20 -0
- datahold-4.0.0.dev30/tests/test_FrozenDictSlot.py +0 -271
- datahold-4.0.0.dev30/tests/test_MutableDictSlot.py +0 -402
- datahold-4.0.0.dev30/tests/test_MutableSetSlot.py +0 -477
- {datahold-4.0.0.dev30 → datahold-4.0.0.dev32}/LICENSE.txt +0 -0
- {datahold-4.0.0.dev30 → datahold-4.0.0.dev32}/MANIFEST.in +0 -0
- {datahold-4.0.0.dev30 → datahold-4.0.0.dev32}/README.rst +0 -0
- {datahold-4.0.0.dev30 → datahold-4.0.0.dev32}/docs/v1.1.rst +0 -0
- {datahold-4.0.0.dev30 → datahold-4.0.0.dev32}/docs/v1.2.rst +0 -0
- {datahold-4.0.0.dev30 → datahold-4.0.0.dev32}/docs/v2.0.rst +0 -0
- {datahold-4.0.0.dev30 → datahold-4.0.0.dev32}/docs/v2.1.rst +0 -0
- {datahold-4.0.0.dev30 → datahold-4.0.0.dev32}/docs/v2.2.rst +0 -0
- {datahold-4.0.0.dev30 → datahold-4.0.0.dev32}/docs/v2.3.rst +0 -0
- {datahold-4.0.0.dev30 → datahold-4.0.0.dev32}/docs/v3.0.rst +0 -0
- {datahold-4.0.0.dev30 → datahold-4.0.0.dev32}/docs/v4.0.rst +0 -0
- {datahold-4.0.0.dev30 → datahold-4.0.0.dev32}/run_tests.py +0 -0
- {datahold-4.0.0.dev30 → datahold-4.0.0.dev32}/setup.cfg +0 -0
- {datahold-4.0.0.dev30 → datahold-4.0.0.dev32}/src/datahold/py.typed +0 -0
- {datahold-4.0.0.dev30 → datahold-4.0.0.dev32}/src/datahold.egg-info/SOURCES.txt +0 -0
- {datahold-4.0.0.dev30 → datahold-4.0.0.dev32}/src/datahold.egg-info/dependency_links.txt +0 -0
- {datahold-4.0.0.dev30 → datahold-4.0.0.dev32}/src/datahold.egg-info/requires.txt +0 -0
- {datahold-4.0.0.dev30 → datahold-4.0.0.dev32}/src/datahold.egg-info/top_level.txt +0 -0
|
@@ -89,15 +89,17 @@ class SupportsAddAndDiscard[Item: abc.Hashable](Protocol):
|
|
|
89
89
|
class Mapping_Frozen[Key, Value](Collection_Frozen[Key], Protocol):
|
|
90
90
|
@setdoc.basic
|
|
91
91
|
def __getitem__(self: Self, key: Never, /) -> Value: ...
|
|
92
|
+
|
|
93
|
+
|
|
92
94
|
class SupportsDelitemAndSetitem[Key, Value](
|
|
93
95
|
Protocol,
|
|
94
96
|
):
|
|
95
97
|
@setdoc.basic
|
|
96
|
-
def __delitem__(self: Self, key: Key
|
|
98
|
+
def __delitem__(self: Self, key: Key, /) -> object: ...
|
|
97
99
|
@setdoc.basic
|
|
98
|
-
def __setitem__(
|
|
99
|
-
|
|
100
|
-
|
|
100
|
+
def __setitem__(self: Self, key: Key, value: Value, /) -> object: ...
|
|
101
|
+
|
|
102
|
+
|
|
101
103
|
class Sequence_Frozen[Item](
|
|
102
104
|
Collection_Frozen[Item],
|
|
103
105
|
Protocol,
|
|
@@ -165,7 +167,8 @@ class MutableSequence_Mutable[Item](Protocol):
|
|
|
165
167
|
type Dict[Key, Value] = dict[Key | str, Value | None]
|
|
166
168
|
|
|
167
169
|
type Dict_Init[Key, Value] = (
|
|
168
|
-
SupportsKeysAndGetitem[Key
|
|
170
|
+
SupportsKeysAndGetitem[Key, Value | None]
|
|
171
|
+
| SupportsKeysAndGetitem[Key | str, Value | None]
|
|
169
172
|
| abc.Iterable[tuple[Key | str, Value | None]]
|
|
170
173
|
)
|
|
171
174
|
|
|
@@ -462,9 +465,11 @@ class Mapping[Key: abc.Hashable, Value](
|
|
|
462
465
|
raise KeyError(key) from None
|
|
463
466
|
|
|
464
467
|
@overload
|
|
465
|
-
def get(self, key: object) -> Value | None: ...
|
|
468
|
+
def get(self, key: object, /) -> Value | None: ...
|
|
466
469
|
@overload
|
|
467
|
-
def get[Value_](
|
|
470
|
+
def get[Value_](
|
|
471
|
+
self, key: object, default: Value_, /
|
|
472
|
+
) -> Value | Value_: ...
|
|
468
473
|
@setdoc.basic
|
|
469
474
|
def get[Value_](
|
|
470
475
|
self: Self, key: object, default: Value_ | None = None
|
|
@@ -478,7 +483,7 @@ class Mapping[Key: abc.Hashable, Value](
|
|
|
478
483
|
|
|
479
484
|
|
|
480
485
|
class MutableMapping[Key: abc.Hashable, Value](
|
|
481
|
-
Mapping[Key, Value],
|
|
486
|
+
Mapping[Key | str, Value | None],
|
|
482
487
|
abc.MutableMapping[Key | str, Value | None],
|
|
483
488
|
MutableObject[
|
|
484
489
|
Mapping_Frozen[Key | str, Value | None],
|
|
@@ -506,7 +511,8 @@ class MutableMapping[Key: abc.Hashable, Value](
|
|
|
506
511
|
|
|
507
512
|
|
|
508
513
|
class DictLike[Key: abc.Hashable, Value](
|
|
509
|
-
Mapping[Key
|
|
514
|
+
Mapping[Key, Value],
|
|
515
|
+
abc.Reversible[Key],
|
|
510
516
|
):
|
|
511
517
|
"""Provide abc for custom dict-like."""
|
|
512
518
|
|
|
@@ -514,7 +520,7 @@ class DictLike[Key: abc.Hashable, Value](
|
|
|
514
520
|
|
|
515
521
|
@abstractmethod
|
|
516
522
|
@setdoc.basic
|
|
517
|
-
def __frozen__(self: Self, /) ->
|
|
523
|
+
def __frozen__(self: Self, /) -> frozendict[Key, Value]: ...
|
|
518
524
|
|
|
519
525
|
@abstractmethod
|
|
520
526
|
@setdoc.basic
|
|
@@ -524,34 +530,54 @@ class DictLike[Key: abc.Hashable, Value](
|
|
|
524
530
|
/,
|
|
525
531
|
**kwargs: Value,
|
|
526
532
|
): ...
|
|
533
|
+
|
|
527
534
|
@setdoc.basic
|
|
528
|
-
def __or__[Key_, Value_](
|
|
535
|
+
def __or__[Key_: abc.Hashable, Value_](
|
|
529
536
|
self: Self,
|
|
530
|
-
other:
|
|
537
|
+
other: DictLike[Key_, Value_],
|
|
531
538
|
/,
|
|
532
539
|
) -> DictLike[Key | Key_, Value | Value_]:
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
540
|
+
if isinstance(other, DictLike):
|
|
541
|
+
return type(self)( # type: ignore[return-value]
|
|
542
|
+
self.__frozen__() | other # type: ignore[arg-type]
|
|
543
|
+
)
|
|
544
|
+
else:
|
|
537
545
|
return NotImplemented
|
|
538
|
-
return type(self)( # type: ignore[return-value]
|
|
539
|
-
self.__frozen__() | data
|
|
540
|
-
)
|
|
541
546
|
|
|
547
|
+
@setdoc.basic
|
|
548
|
+
def __reversed__(self: Self, /) -> abc.Iterator[Key]:
|
|
549
|
+
yield from reversed(self.__frozen__())
|
|
550
|
+
|
|
551
|
+
@overload
|
|
542
552
|
@classmethod
|
|
543
553
|
@setdoc.basic
|
|
544
554
|
def fromkeys(
|
|
545
555
|
cls: type[Self],
|
|
546
|
-
iterable: abc.Iterable[Key
|
|
547
|
-
value: Value | None = None,
|
|
556
|
+
iterable: abc.Iterable[Key],
|
|
548
557
|
/,
|
|
549
|
-
) ->
|
|
558
|
+
) -> DictLike[Key, None]: ...
|
|
559
|
+
@overload
|
|
560
|
+
@classmethod
|
|
561
|
+
@setdoc.basic
|
|
562
|
+
def fromkeys(
|
|
563
|
+
cls: type[Self],
|
|
564
|
+
iterable: abc.Iterable[Key],
|
|
565
|
+
value: Value,
|
|
566
|
+
/,
|
|
567
|
+
) -> Self: ...
|
|
568
|
+
@classmethod
|
|
569
|
+
@setdoc.basic
|
|
570
|
+
def fromkeys(
|
|
571
|
+
cls: type[Self],
|
|
572
|
+
iterable: abc.Iterable[Key],
|
|
573
|
+
value: Any = None,
|
|
574
|
+
/,
|
|
575
|
+
) -> Any:
|
|
550
576
|
return cls(dict.fromkeys(iterable, value))
|
|
551
577
|
|
|
552
578
|
|
|
553
579
|
class FrozenDictLike[Key: abc.Hashable, Value](
|
|
554
|
-
FrozenObjectLike[
|
|
580
|
+
FrozenObjectLike[frozendict[Key, Value]],
|
|
555
581
|
DictLike[Key, Value],
|
|
556
582
|
):
|
|
557
583
|
"""Provide abc for custom frozen dict-like."""
|
|
@@ -560,7 +586,7 @@ class FrozenDictLike[Key: abc.Hashable, Value](
|
|
|
560
586
|
|
|
561
587
|
|
|
562
588
|
class MutableDictLike[Key: abc.Hashable, Value](
|
|
563
|
-
DictLike[Key, Value],
|
|
589
|
+
DictLike[Key | str, Value | None],
|
|
564
590
|
MutableObjectLike[FrozenDict[Key, Value], Dict[Key, Value]],
|
|
565
591
|
MutableMapping[Key, Value],
|
|
566
592
|
):
|
|
@@ -582,8 +608,11 @@ class MutableDictLike[Key: abc.Hashable, Value](
|
|
|
582
608
|
other: Dict_Init[Key, Value] = (),
|
|
583
609
|
/,
|
|
584
610
|
**kwargs: Value | None,
|
|
585
|
-
):
|
|
586
|
-
self.update(
|
|
611
|
+
) -> None:
|
|
612
|
+
self.update(
|
|
613
|
+
other, # type: ignore[arg-type]
|
|
614
|
+
**kwargs,
|
|
615
|
+
)
|
|
587
616
|
|
|
588
617
|
@setdoc.basic
|
|
589
618
|
def __ior__( # type: ignore[override]
|
|
@@ -592,7 +621,7 @@ class MutableDictLike[Key: abc.Hashable, Value](
|
|
|
592
621
|
/,
|
|
593
622
|
) -> Self:
|
|
594
623
|
with self.__mutate__() as mutable:
|
|
595
|
-
mutable |= other
|
|
624
|
+
mutable |= other # type: ignore[arg-type]
|
|
596
625
|
return self
|
|
597
626
|
|
|
598
627
|
@setdoc.basic
|
|
@@ -608,7 +637,7 @@ class MutableDictLike[Key: abc.Hashable, Value](
|
|
|
608
637
|
|
|
609
638
|
|
|
610
639
|
class FrozenDictSlot[Key: abc.Hashable, Value](
|
|
611
|
-
FrozenObjectSlot[
|
|
640
|
+
FrozenObjectSlot[frozendict[Key, Value]],
|
|
612
641
|
FrozenDictLike[Key, Value],
|
|
613
642
|
):
|
|
614
643
|
"""Provide slotted frozen dict-like."""
|
|
@@ -622,7 +651,10 @@ class FrozenDictSlot[Key: abc.Hashable, Value](
|
|
|
622
651
|
/,
|
|
623
652
|
**kwargs: Value | None,
|
|
624
653
|
) -> None:
|
|
625
|
-
self._slot = frozendict(
|
|
654
|
+
self._slot = frozendict(
|
|
655
|
+
other, # type: ignore[arg-type]
|
|
656
|
+
**kwargs,
|
|
657
|
+
)
|
|
626
658
|
|
|
627
659
|
|
|
628
660
|
class MutableDictSlot[Key: abc.Hashable, Value](
|