ducktools-classbuilder 0.9.1__py3-none-any.whl → 0.10.0__py3-none-any.whl
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.
Potentially problematic release.
This version of ducktools-classbuilder might be problematic. Click here for more details.
- ducktools/classbuilder/__init__.py +160 -67
- ducktools/classbuilder/__init__.pyi +16 -9
- ducktools/classbuilder/_version.py +2 -2
- ducktools/classbuilder/annotations.py +2 -13
- ducktools/classbuilder/prefab.py +1 -2
- ducktools/classbuilder/prefab.pyi +1 -0
- {ducktools_classbuilder-0.9.1.dist-info → ducktools_classbuilder-0.10.0.dist-info}/METADATA +7 -17
- ducktools_classbuilder-0.10.0.dist-info/RECORD +13 -0
- {ducktools_classbuilder-0.9.1.dist-info → ducktools_classbuilder-0.10.0.dist-info}/WHEEL +1 -1
- ducktools_classbuilder-0.9.1.dist-info/RECORD +0 -13
- {ducktools_classbuilder-0.9.1.dist-info → ducktools_classbuilder-0.10.0.dist-info/licenses}/LICENSE +0 -0
- {ducktools_classbuilder-0.9.1.dist-info → ducktools_classbuilder-0.10.0.dist-info}/top_level.txt +0 -0
|
@@ -38,7 +38,7 @@ from ._version import __version__, __version_tuple__ # noqa: F401
|
|
|
38
38
|
# Change this name if you make heavy modifications
|
|
39
39
|
INTERNALS_DICT = "__classbuilder_internals__"
|
|
40
40
|
META_GATHERER_NAME = "_meta_gatherer"
|
|
41
|
-
|
|
41
|
+
GATHERED_DATA = "__classbuilder_gathered_fields__"
|
|
42
42
|
|
|
43
43
|
# If testing, make Field classes frozen to make sure attributes are not
|
|
44
44
|
# overwritten. When running this is a performance penalty so it is not required.
|
|
@@ -114,12 +114,16 @@ FIELD_NOTHING = _NothingType("FIELD")
|
|
|
114
114
|
# KW_ONLY sentinel 'type' to use to indicate all subsequent attributes are
|
|
115
115
|
# keyword only
|
|
116
116
|
# noinspection PyPep8Naming
|
|
117
|
-
class
|
|
117
|
+
class _KW_ONLY_META(type):
|
|
118
118
|
def __repr__(self):
|
|
119
|
-
return "<KW_ONLY Sentinel
|
|
119
|
+
return "<KW_ONLY Sentinel>"
|
|
120
120
|
|
|
121
121
|
|
|
122
|
-
KW_ONLY
|
|
122
|
+
class KW_ONLY(metaclass=_KW_ONLY_META):
|
|
123
|
+
"""
|
|
124
|
+
Sentinel Class to indicate that variables declared after
|
|
125
|
+
this sentinel are to be converted to KW_ONLY arguments.
|
|
126
|
+
"""
|
|
123
127
|
|
|
124
128
|
|
|
125
129
|
class GeneratedCode:
|
|
@@ -571,21 +575,25 @@ class SlotMakerMeta(type):
|
|
|
571
575
|
|
|
572
576
|
Will not convert `ClassVar` hinted values.
|
|
573
577
|
"""
|
|
574
|
-
def __new__(cls, name, bases, ns, slots=True, **kwargs):
|
|
578
|
+
def __new__(cls, name, bases, ns, slots=True, gatherer=None, **kwargs):
|
|
575
579
|
# This should only run if slots=True is declared
|
|
576
580
|
# and __slots__ have not already been defined
|
|
577
|
-
if slots and "__slots__" not in ns:
|
|
581
|
+
if slots and "__slots__" not in ns:
|
|
578
582
|
# Check if a different gatherer has been set in any base classes
|
|
579
583
|
# Default to unified gatherer
|
|
580
|
-
gatherer
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
584
|
+
if gatherer is None:
|
|
585
|
+
gatherer = ns.get(META_GATHERER_NAME, None)
|
|
586
|
+
if not gatherer:
|
|
587
|
+
for base in bases:
|
|
588
|
+
if g := getattr(base, META_GATHERER_NAME, None):
|
|
589
|
+
gatherer = g
|
|
590
|
+
break
|
|
591
|
+
|
|
592
|
+
if not gatherer:
|
|
593
|
+
gatherer = unified_gatherer
|
|
586
594
|
|
|
587
|
-
|
|
588
|
-
|
|
595
|
+
# Set the gatherer in the namespace
|
|
596
|
+
ns[META_GATHERER_NAME] = gatherer
|
|
589
597
|
|
|
590
598
|
# Obtain slots from annotations or attributes
|
|
591
599
|
cls_fields, cls_modifications = gatherer(ns)
|
|
@@ -595,14 +603,54 @@ class SlotMakerMeta(type):
|
|
|
595
603
|
else:
|
|
596
604
|
ns[k] = v
|
|
597
605
|
|
|
606
|
+
slots = {}
|
|
607
|
+
fields = {}
|
|
608
|
+
|
|
609
|
+
for k, v in cls_fields.items():
|
|
610
|
+
slots[k] = v.doc
|
|
611
|
+
if k not in {"__weakref__", "__dict__"}:
|
|
612
|
+
fields[k] = v
|
|
613
|
+
|
|
598
614
|
# Place slots *after* everything else to be safe
|
|
599
|
-
ns["__slots__"] =
|
|
615
|
+
ns["__slots__"] = slots
|
|
616
|
+
|
|
617
|
+
# Place pre-gathered field data - modifications are already applied
|
|
618
|
+
modifications = {}
|
|
619
|
+
ns[GATHERED_DATA] = fields, modifications
|
|
620
|
+
|
|
621
|
+
else:
|
|
622
|
+
if gatherer is not None:
|
|
623
|
+
ns[META_GATHERER_NAME] = gatherer
|
|
600
624
|
|
|
601
625
|
new_cls = super().__new__(cls, name, bases, ns, **kwargs)
|
|
602
626
|
|
|
603
627
|
return new_cls
|
|
604
628
|
|
|
605
629
|
|
|
630
|
+
# This class is set up before fields as it will be used to generate the Fields
|
|
631
|
+
# for Field itself so Field can have generated __eq__, __repr__ and other methods
|
|
632
|
+
class GatheredFields:
|
|
633
|
+
"""
|
|
634
|
+
Helper class to store gathered field data
|
|
635
|
+
"""
|
|
636
|
+
__slots__ = ("fields", "modifications")
|
|
637
|
+
|
|
638
|
+
def __init__(self, fields, modifications):
|
|
639
|
+
self.fields = fields
|
|
640
|
+
self.modifications = modifications
|
|
641
|
+
|
|
642
|
+
def __eq__(self, other):
|
|
643
|
+
if type(self) is type(other):
|
|
644
|
+
return self.fields == other.fields and self.modifications == other.modifications
|
|
645
|
+
|
|
646
|
+
def __repr__(self):
|
|
647
|
+
return f"{type(self).__name__}(fields={self.fields!r}, modifications={self.modifications!r})"
|
|
648
|
+
|
|
649
|
+
def __call__(self, cls_dict):
|
|
650
|
+
# cls_dict will be provided, but isn't needed
|
|
651
|
+
return self.fields, self.modifications
|
|
652
|
+
|
|
653
|
+
|
|
606
654
|
# The Field class can finally be defined.
|
|
607
655
|
# The __init__ method has to be written manually so Fields can be created
|
|
608
656
|
# However after this, the other methods can be generated.
|
|
@@ -628,17 +676,18 @@ class Field(metaclass=SlotMakerMeta):
|
|
|
628
676
|
:param compare: Include in the class __eq__.
|
|
629
677
|
:param kw_only: Make this a keyword only parameter in __init__.
|
|
630
678
|
"""
|
|
631
|
-
|
|
632
|
-
#
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
679
|
+
|
|
680
|
+
# Plain slots are required as part of bootstrapping
|
|
681
|
+
# This prevents SlotMakerMeta from trying to generate 'Field's
|
|
682
|
+
__slots__ = (
|
|
683
|
+
"default",
|
|
684
|
+
"default_factory",
|
|
685
|
+
"type",
|
|
686
|
+
"doc",
|
|
687
|
+
"init",
|
|
688
|
+
"repr",
|
|
689
|
+
"compare",
|
|
690
|
+
"kw_only",
|
|
642
691
|
)
|
|
643
692
|
|
|
644
693
|
# noinspection PyShadowingBuiltins
|
|
@@ -672,6 +721,7 @@ class Field(metaclass=SlotMakerMeta):
|
|
|
672
721
|
self.validate_field()
|
|
673
722
|
|
|
674
723
|
def __init_subclass__(cls, frozen=False):
|
|
724
|
+
# Subclasses of Field can be created as if they are dataclasses
|
|
675
725
|
field_methods = {_field_init_maker, repr_maker, eq_maker}
|
|
676
726
|
if frozen or _UNDER_TESTING:
|
|
677
727
|
field_methods.update({frozen_setattr_maker, frozen_delattr_maker})
|
|
@@ -707,6 +757,66 @@ class Field(metaclass=SlotMakerMeta):
|
|
|
707
757
|
return cls(**argument_dict)
|
|
708
758
|
|
|
709
759
|
|
|
760
|
+
def _build_field():
|
|
761
|
+
# Complete the construction of the Field class
|
|
762
|
+
field_docs = {
|
|
763
|
+
"default": "Standard default value to be used for attributes with this field.",
|
|
764
|
+
"default_factory":
|
|
765
|
+
"A zero-argument function to be called to generate a default value, "
|
|
766
|
+
"useful for mutable obects like lists.",
|
|
767
|
+
"type": "The type of the attribute to be assigned by this field.",
|
|
768
|
+
"doc":
|
|
769
|
+
"The documentation for the attribute that appears when calling "
|
|
770
|
+
"help(...) on the class. (Only in slotted classes).",
|
|
771
|
+
"init": "Include this attribute in the class __init__ parameters.",
|
|
772
|
+
"repr": "Include this attribute in the class __repr__",
|
|
773
|
+
"compare": "Include this attribute in the class __eq__ method",
|
|
774
|
+
"kw_only": "Make this a keyword only parameter in __init__",
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
fields = {
|
|
778
|
+
"default": Field(default=NOTHING, doc=field_docs["default"]),
|
|
779
|
+
"default_factory": Field(default=NOTHING, doc=field_docs["default_factory"]),
|
|
780
|
+
"type": Field(default=NOTHING, doc=field_docs["type"]),
|
|
781
|
+
"doc": Field(default=None, doc=field_docs["doc"]),
|
|
782
|
+
"init": Field(default=True, doc=field_docs["init"]),
|
|
783
|
+
"repr": Field(default=True, doc=field_docs["repr"]),
|
|
784
|
+
"compare": Field(default=True, doc=field_docs["compare"]),
|
|
785
|
+
"kw_only": Field(default=False, doc=field_docs["kw_only"])
|
|
786
|
+
}
|
|
787
|
+
modifications = {"__slots__": field_docs}
|
|
788
|
+
|
|
789
|
+
field_methods = {repr_maker, eq_maker}
|
|
790
|
+
if _UNDER_TESTING:
|
|
791
|
+
field_methods.update({frozen_setattr_maker, frozen_delattr_maker})
|
|
792
|
+
|
|
793
|
+
builder(
|
|
794
|
+
Field,
|
|
795
|
+
gatherer=GatheredFields(fields, modifications),
|
|
796
|
+
methods=field_methods,
|
|
797
|
+
flags={"slotted": True, "kw_only": True},
|
|
798
|
+
)
|
|
799
|
+
|
|
800
|
+
|
|
801
|
+
_build_field()
|
|
802
|
+
del _build_field
|
|
803
|
+
|
|
804
|
+
|
|
805
|
+
def pre_gathered_gatherer(cls_or_ns):
|
|
806
|
+
"""
|
|
807
|
+
Retrieve fields previously gathered by SlotMakerMeta
|
|
808
|
+
|
|
809
|
+
:param cls_or_ns: Class to gather field information from (or class namespace)
|
|
810
|
+
:return: dict of field_name: Field(...) and modifications to be performed by the builder
|
|
811
|
+
"""
|
|
812
|
+
if isinstance(cls_or_ns, (_MappingProxyType, dict)):
|
|
813
|
+
cls_dict = cls_or_ns
|
|
814
|
+
else:
|
|
815
|
+
cls_dict = cls_or_ns.__dict__
|
|
816
|
+
|
|
817
|
+
return cls_dict[GATHERED_DATA]
|
|
818
|
+
|
|
819
|
+
|
|
710
820
|
def make_slot_gatherer(field_type=Field):
|
|
711
821
|
"""
|
|
712
822
|
Create a new annotation gatherer that will work with `Field` instances
|
|
@@ -721,7 +831,7 @@ def make_slot_gatherer(field_type=Field):
|
|
|
721
831
|
Gather field information for class generation based on __slots__
|
|
722
832
|
|
|
723
833
|
:param cls_or_ns: Class to gather field information from (or class namespace)
|
|
724
|
-
:return: dict of field_name: Field(...)
|
|
834
|
+
:return: dict of field_name: Field(...) and modifications to be performed by the builder
|
|
725
835
|
"""
|
|
726
836
|
if isinstance(cls_or_ns, (_MappingProxyType, dict)):
|
|
727
837
|
cls_dict = cls_or_ns
|
|
@@ -883,6 +993,7 @@ def make_field_gatherer(
|
|
|
883
993
|
def make_unified_gatherer(
|
|
884
994
|
field_type=Field,
|
|
885
995
|
leave_default_values=False,
|
|
996
|
+
ignore_annotations=False,
|
|
886
997
|
):
|
|
887
998
|
"""
|
|
888
999
|
Create a gatherer that will work via first slots, then
|
|
@@ -891,6 +1002,7 @@ def make_unified_gatherer(
|
|
|
891
1002
|
|
|
892
1003
|
:param field_type: The field class to use for gathering
|
|
893
1004
|
:param leave_default_values: leave default values in place
|
|
1005
|
+
:param ignore_annotations: don't attempt to read annotations
|
|
894
1006
|
:return: gatherer function
|
|
895
1007
|
"""
|
|
896
1008
|
slot_g = make_slot_gatherer(field_type)
|
|
@@ -903,27 +1015,35 @@ def make_unified_gatherer(
|
|
|
903
1015
|
else:
|
|
904
1016
|
cls_dict = cls_or_ns.__dict__
|
|
905
1017
|
|
|
1018
|
+
cls_gathered = cls_dict.get(GATHERED_DATA)
|
|
1019
|
+
if cls_gathered:
|
|
1020
|
+
return pre_gathered_gatherer(cls_dict)
|
|
1021
|
+
|
|
906
1022
|
cls_slots = cls_dict.get("__slots__")
|
|
907
1023
|
|
|
908
1024
|
if isinstance(cls_slots, SlotFields):
|
|
909
1025
|
return slot_g(cls_dict)
|
|
910
1026
|
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
1027
|
+
if ignore_annotations:
|
|
1028
|
+
return attrib_g(cls_dict)
|
|
1029
|
+
else:
|
|
1030
|
+
# To choose between annotation and attribute gatherers
|
|
1031
|
+
# compare sets of names.
|
|
1032
|
+
# Don't bother evaluating string annotations, as we only need names
|
|
1033
|
+
cls_annotations = get_ns_annotations(cls_dict)
|
|
1034
|
+
cls_attributes = {
|
|
1035
|
+
k: v for k, v in cls_dict.items() if isinstance(v, field_type)
|
|
1036
|
+
}
|
|
918
1037
|
|
|
919
|
-
|
|
920
|
-
|
|
1038
|
+
cls_annotation_names = cls_annotations.keys()
|
|
1039
|
+
cls_attribute_names = cls_attributes.keys()
|
|
921
1040
|
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
1041
|
+
if set(cls_annotation_names).issuperset(set(cls_attribute_names)):
|
|
1042
|
+
# All `Field` values have annotations, so use annotation gatherer
|
|
1043
|
+
return anno_g(cls_dict)
|
|
925
1044
|
|
|
926
|
-
|
|
1045
|
+
return attrib_g(cls_dict)
|
|
1046
|
+
|
|
927
1047
|
return field_unified_gatherer
|
|
928
1048
|
|
|
929
1049
|
|
|
@@ -935,19 +1055,6 @@ annotation_gatherer = make_annotation_gatherer()
|
|
|
935
1055
|
unified_gatherer = make_unified_gatherer()
|
|
936
1056
|
|
|
937
1057
|
|
|
938
|
-
# Now the gatherers have been defined, add __repr__ and __eq__ to Field.
|
|
939
|
-
_field_methods = {repr_maker, eq_maker}
|
|
940
|
-
if _UNDER_TESTING:
|
|
941
|
-
_field_methods.update({frozen_setattr_maker, frozen_delattr_maker})
|
|
942
|
-
|
|
943
|
-
builder(
|
|
944
|
-
Field,
|
|
945
|
-
gatherer=slot_gatherer,
|
|
946
|
-
methods=_field_methods,
|
|
947
|
-
flags={"slotted": True, "kw_only": True},
|
|
948
|
-
)
|
|
949
|
-
|
|
950
|
-
|
|
951
1058
|
def check_argument_order(cls):
|
|
952
1059
|
"""
|
|
953
1060
|
Raise a SyntaxError if the argument order will be invalid for a generated
|
|
@@ -990,17 +1097,3 @@ def slotclass(cls=None, /, *, methods=default_methods, syntax_check=True):
|
|
|
990
1097
|
check_argument_order(cls)
|
|
991
1098
|
|
|
992
1099
|
return cls
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
@slotclass
|
|
996
|
-
class GatheredFields:
|
|
997
|
-
"""
|
|
998
|
-
A helper gatherer for fields that have been gathered externally.
|
|
999
|
-
"""
|
|
1000
|
-
__slots__ = SlotFields(
|
|
1001
|
-
fields=Field(),
|
|
1002
|
-
modifications=Field(),
|
|
1003
|
-
)
|
|
1004
|
-
|
|
1005
|
-
def __call__(self, cls):
|
|
1006
|
-
return self.fields, self.modifications
|
|
@@ -13,6 +13,7 @@ __version__: str
|
|
|
13
13
|
__version_tuple__: tuple[str | int, ...]
|
|
14
14
|
INTERNALS_DICT: str
|
|
15
15
|
META_GATHERER_NAME: str
|
|
16
|
+
GATHERED_DATA: str
|
|
16
17
|
|
|
17
18
|
def get_fields(cls: type, *, local: bool = False) -> dict[str, Field]: ...
|
|
18
19
|
|
|
@@ -28,11 +29,11 @@ class _NothingType:
|
|
|
28
29
|
NOTHING: _NothingType
|
|
29
30
|
FIELD_NOTHING: _NothingType
|
|
30
31
|
|
|
31
|
-
|
|
32
|
-
class _KW_ONLY_TYPE:
|
|
32
|
+
class _KW_ONLY_META(type):
|
|
33
33
|
def __repr__(self) -> str: ...
|
|
34
34
|
|
|
35
|
-
KW_ONLY:
|
|
35
|
+
class KW_ONLY(metaclass=_KW_ONLY_META): ...
|
|
36
|
+
|
|
36
37
|
# Stub Only
|
|
37
38
|
@typing.type_check_only
|
|
38
39
|
class _CodegenType(typing.Protocol):
|
|
@@ -122,7 +123,8 @@ class SlotMakerMeta(type):
|
|
|
122
123
|
name: str,
|
|
123
124
|
bases: tuple[type, ...],
|
|
124
125
|
ns: dict[str, typing.Any],
|
|
125
|
-
slots: bool =
|
|
126
|
+
slots: bool = ...,
|
|
127
|
+
gatherer: Callable[[type], tuple[dict[str, Field], dict[str, typing.Any]]] | None = ...,
|
|
126
128
|
**kwargs: typing.Any,
|
|
127
129
|
) -> _T: ...
|
|
128
130
|
|
|
@@ -167,6 +169,9 @@ class Field(metaclass=SlotMakerMeta):
|
|
|
167
169
|
_ReturnsField = Callable[..., Field]
|
|
168
170
|
_FieldType = typing.TypeVar("_FieldType", bound=Field)
|
|
169
171
|
|
|
172
|
+
def pre_gathered_gatherer(
|
|
173
|
+
cls_or_ns: type | _CopiableMappings
|
|
174
|
+
) -> tuple[dict[str, Field | _FieldType], dict[str, typing.Any]]: ...
|
|
170
175
|
|
|
171
176
|
@typing.overload
|
|
172
177
|
def make_slot_gatherer(
|
|
@@ -206,13 +211,15 @@ def make_field_gatherer(
|
|
|
206
211
|
@typing.overload
|
|
207
212
|
def make_unified_gatherer(
|
|
208
213
|
field_type: type[_FieldType],
|
|
209
|
-
leave_default_values: bool =
|
|
214
|
+
leave_default_values: bool = ...,
|
|
215
|
+
ignore_annotations: bool = ...,
|
|
210
216
|
) -> Callable[[type | _CopiableMappings], tuple[dict[str, _FieldType], dict[str, typing.Any]]]: ...
|
|
211
217
|
|
|
212
218
|
@typing.overload
|
|
213
219
|
def make_unified_gatherer(
|
|
214
|
-
field_type: _ReturnsField =
|
|
215
|
-
leave_default_values: bool =
|
|
220
|
+
field_type: _ReturnsField = ...,
|
|
221
|
+
leave_default_values: bool = ...,
|
|
222
|
+
ignore_annotations: bool = ...,
|
|
216
223
|
) -> Callable[[type | _CopiableMappings], tuple[dict[str, Field], dict[str, typing.Any]]]: ...
|
|
217
224
|
|
|
218
225
|
|
|
@@ -246,7 +253,7 @@ def slotclass(
|
|
|
246
253
|
_gatherer_type = Callable[[type | _CopiableMappings], tuple[dict[str, Field], dict[str, typing.Any]]]
|
|
247
254
|
|
|
248
255
|
class GatheredFields:
|
|
249
|
-
__slots__:
|
|
256
|
+
__slots__: tuple[str, ...]
|
|
250
257
|
|
|
251
258
|
fields: dict[str, Field]
|
|
252
259
|
modifications: dict[str, typing.Any]
|
|
@@ -262,4 +269,4 @@ class GatheredFields:
|
|
|
262
269
|
|
|
263
270
|
def __repr__(self) -> str: ...
|
|
264
271
|
def __eq__(self, other) -> bool: ...
|
|
265
|
-
def __call__(self,
|
|
272
|
+
def __call__(self, cls_dict: type | dict[str, typing.Any]) -> tuple[dict[str, Field], dict[str, typing.Any]]: ...
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
__version__ = "0.
|
|
2
|
-
__version_tuple__ = (0,
|
|
1
|
+
__version__ = "0.10.0"
|
|
2
|
+
__version_tuple__ = (0, 10, 0)
|
|
@@ -70,19 +70,8 @@ def is_classvar(hint):
|
|
|
70
70
|
else:
|
|
71
71
|
_typing = sys.modules.get("typing")
|
|
72
72
|
if _typing:
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
# 3.8 also needs get_origin from typing_extensions
|
|
76
|
-
if sys.version_info < (3, 10):
|
|
77
|
-
_typing_extensions = sys.modules.get("typing_extensions")
|
|
78
|
-
if _typing_extensions:
|
|
79
|
-
_Annotated = _typing_extensions.Annotated
|
|
80
|
-
_get_origin = _typing_extensions.get_origin
|
|
81
|
-
else:
|
|
82
|
-
_Annotated, _get_origin = None, None
|
|
83
|
-
else:
|
|
84
|
-
_Annotated = _typing.Annotated
|
|
85
|
-
_get_origin = _typing.get_origin
|
|
73
|
+
_Annotated = _typing.Annotated
|
|
74
|
+
_get_origin = _typing.get_origin
|
|
86
75
|
|
|
87
76
|
if _Annotated and _get_origin(hint) is _Annotated:
|
|
88
77
|
hint = getattr(hint, "__origin__", None)
|
ducktools/classbuilder/prefab.py
CHANGED
|
@@ -551,8 +551,7 @@ def _make_prefab(
|
|
|
551
551
|
return cls
|
|
552
552
|
|
|
553
553
|
|
|
554
|
-
class Prefab(metaclass=SlotMakerMeta):
|
|
555
|
-
_meta_gatherer = prefab_gatherer
|
|
554
|
+
class Prefab(metaclass=SlotMakerMeta, gatherer=prefab_gatherer):
|
|
556
555
|
__slots__ = {} # type: ignore
|
|
557
556
|
|
|
558
557
|
# noinspection PyShadowingBuiltins
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: ducktools-classbuilder
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.10.0
|
|
4
4
|
Summary: Toolkit for creating class boilerplate generators
|
|
5
5
|
Author: David C Ellis
|
|
6
6
|
Project-URL: Homepage, https://github.com/davidcellis/ducktools-classbuilder
|
|
7
7
|
Classifier: Development Status :: 4 - Beta
|
|
8
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
9
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
10
8
|
Classifier: Programming Language :: Python :: 3.10
|
|
11
9
|
Classifier: Programming Language :: Python :: 3.11
|
|
12
10
|
Classifier: Programming Language :: Python :: 3.12
|
|
@@ -14,22 +12,14 @@ Classifier: Programming Language :: Python :: 3.13
|
|
|
14
12
|
Classifier: Programming Language :: Python :: 3.14
|
|
15
13
|
Classifier: Operating System :: OS Independent
|
|
16
14
|
Classifier: License :: OSI Approved :: MIT License
|
|
17
|
-
Requires-Python: >=3.
|
|
15
|
+
Requires-Python: >=3.10
|
|
18
16
|
Description-Content-Type: text/markdown
|
|
19
17
|
License-File: LICENSE
|
|
20
18
|
Provides-Extra: docs
|
|
21
|
-
Requires-Dist: sphinx
|
|
22
|
-
Requires-Dist: myst-parser
|
|
23
|
-
Requires-Dist:
|
|
24
|
-
|
|
25
|
-
Requires-Dist: attrs ; extra == 'performance_tests'
|
|
26
|
-
Requires-Dist: pydantic ; extra == 'performance_tests'
|
|
27
|
-
Provides-Extra: testing
|
|
28
|
-
Requires-Dist: pytest >=8.2 ; extra == 'testing'
|
|
29
|
-
Requires-Dist: pytest-cov ; extra == 'testing'
|
|
30
|
-
Requires-Dist: typing-extensions ; extra == 'testing'
|
|
31
|
-
Provides-Extra: type_checking
|
|
32
|
-
Requires-Dist: mypy ; extra == 'type_checking'
|
|
19
|
+
Requires-Dist: sphinx>=8.1; extra == "docs"
|
|
20
|
+
Requires-Dist: myst-parser>=4.0; extra == "docs"
|
|
21
|
+
Requires-Dist: sphinx_rtd_theme>=3.0; extra == "docs"
|
|
22
|
+
Dynamic: license-file
|
|
33
23
|
|
|
34
24
|
# Ducktools: Class Builder #
|
|
35
25
|
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
ducktools/classbuilder/__init__.py,sha256=nZz_pQM6CN7yCT71oOclih4uls73a6SlW-HY2gxzYIs,37244
|
|
2
|
+
ducktools/classbuilder/__init__.pyi,sha256=v9QDO8A0AdPlAPNOXZGYXu1FaAq3yelwWNucdfWudrs,8143
|
|
3
|
+
ducktools/classbuilder/_version.py,sha256=MdjuHfU3W8hJQpD3kGrPvowqtRDz5JMifDCCjNbrskE,54
|
|
4
|
+
ducktools/classbuilder/annotations.py,sha256=GgBvNthDSRvKKZ9R_qxEVtCV3_vGuEBfuqQJFcDAe1s,3005
|
|
5
|
+
ducktools/classbuilder/annotations.pyi,sha256=c5vYtULdDgMYWtkzeYMsHIbmnEuT2Ru-nNZieWvYuQ4,247
|
|
6
|
+
ducktools/classbuilder/prefab.py,sha256=2GldQTRvOcFzB68qXbymeHKiXoyHx7eOjGxeilFIcn0,24632
|
|
7
|
+
ducktools/classbuilder/prefab.pyi,sha256=q5Zca5wAN80GE4uICY6v3EIB6LvIcjOEhzD1pVDK44U,6507
|
|
8
|
+
ducktools/classbuilder/py.typed,sha256=la67KBlbjXN-_-DfGNcdOcjYumVpKG_Tkw-8n5dnGB4,8
|
|
9
|
+
ducktools_classbuilder-0.10.0.dist-info/licenses/LICENSE,sha256=6Thz9Dbw8R4fWInl6sGl8Rj3UnKnRbDwrc6jZerpugQ,1070
|
|
10
|
+
ducktools_classbuilder-0.10.0.dist-info/METADATA,sha256=zrp9Q-klxkuTdsGSGz87rEZ7nxM8FCEppJfiGwqRh-0,9231
|
|
11
|
+
ducktools_classbuilder-0.10.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
12
|
+
ducktools_classbuilder-0.10.0.dist-info/top_level.txt,sha256=uSDLtio3ZFqdwcsMJ2O5yhjB4Q3ytbBWbA8rJREganc,10
|
|
13
|
+
ducktools_classbuilder-0.10.0.dist-info/RECORD,,
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
ducktools/classbuilder/__init__.py,sha256=5vagbDiErapPudNG5-gP3yarlA6-q8IriMcRrAzBBr4,33433
|
|
2
|
-
ducktools/classbuilder/__init__.pyi,sha256=6nEfVyeF1HE4YlvcNkFetACqMd1EObu3hYwoLYBbRNo,7796
|
|
3
|
-
ducktools/classbuilder/_version.py,sha256=Ti7IekFg9SsQHXFYa9yzblMN29C0yL2OG6aLOfnSQOc,52
|
|
4
|
-
ducktools/classbuilder/annotations.py,sha256=VEZsCM8lwfhaWrQi8dUOAkicYHxUHaSAyM-FzL34wXI,3583
|
|
5
|
-
ducktools/classbuilder/annotations.pyi,sha256=c5vYtULdDgMYWtkzeYMsHIbmnEuT2Ru-nNZieWvYuQ4,247
|
|
6
|
-
ducktools/classbuilder/prefab.py,sha256=RiVbESwFiPv3Y4PpclSZAwdwBomILbhGEF8XHAaDzW4,24643
|
|
7
|
-
ducktools/classbuilder/prefab.pyi,sha256=_Tm2V97Udt3-WlbBRuOSt11PPYdw1TrFeSd4Mcs2EKM,6422
|
|
8
|
-
ducktools/classbuilder/py.typed,sha256=la67KBlbjXN-_-DfGNcdOcjYumVpKG_Tkw-8n5dnGB4,8
|
|
9
|
-
ducktools_classbuilder-0.9.1.dist-info/LICENSE,sha256=6Thz9Dbw8R4fWInl6sGl8Rj3UnKnRbDwrc6jZerpugQ,1070
|
|
10
|
-
ducktools_classbuilder-0.9.1.dist-info/METADATA,sha256=45E7CeSoBEii1Tra1U16WUvcBepEQ4vCsay_y_2UinY,9687
|
|
11
|
-
ducktools_classbuilder-0.9.1.dist-info/WHEEL,sha256=iAkIy5fosb7FzIOwONchHf19Qu7_1wCWyFNR5gu9nU0,91
|
|
12
|
-
ducktools_classbuilder-0.9.1.dist-info/top_level.txt,sha256=uSDLtio3ZFqdwcsMJ2O5yhjB4Q3ytbBWbA8rJREganc,10
|
|
13
|
-
ducktools_classbuilder-0.9.1.dist-info/RECORD,,
|
{ducktools_classbuilder-0.9.1.dist-info → ducktools_classbuilder-0.10.0.dist-info/licenses}/LICENSE
RENAMED
|
File without changes
|
{ducktools_classbuilder-0.9.1.dist-info → ducktools_classbuilder-0.10.0.dist-info}/top_level.txt
RENAMED
|
File without changes
|