ducktools-classbuilder 0.8.4__py3-none-any.whl → 0.9.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.

@@ -47,7 +47,7 @@ _UNDER_TESTING = os.environ.get("PYTEST_VERSION") is not None
47
47
  # Obtain types the same way types.py does in pypy
48
48
  # See: https://github.com/pypy/pypy/blob/19d9fa6be11165116dd0839b9144d969ab426ae7/lib-python/3/types.py#L61-L73
49
49
  class _C: __slots__ = 's' # noqa
50
- _MemberDescriptorType = type(_C.s) # noqa
50
+ _MemberDescriptorType = type(_C.s) # type: ignore
51
51
  _MappingProxyType = type(type.__dict__)
52
52
  del _C
53
53
 
@@ -961,24 +961,6 @@ def slotclass(cls=None, /, *, methods=default_methods, syntax_check=True):
961
961
  return cls
962
962
 
963
963
 
964
- class AnnotationClass(metaclass=SlotMakerMeta):
965
- __slots__ = {}
966
-
967
- def __init_subclass__(
968
- cls,
969
- methods=default_methods,
970
- gatherer=unified_gatherer,
971
- **kwargs
972
- ):
973
- # Check class dict otherwise this will always be True as this base
974
- # class uses slots.
975
- slots = "__slots__" in cls.__dict__
976
-
977
- builder(cls, gatherer=gatherer, methods=methods, flags={"slotted": slots})
978
- check_argument_order(cls)
979
- super().__init_subclass__(**kwargs)
980
-
981
-
982
964
  @slotclass
983
965
  class GatheredFields:
984
966
  """
@@ -5,7 +5,6 @@ import inspect
5
5
 
6
6
  from collections.abc import Callable
7
7
  from types import MappingProxyType
8
- from typing_extensions import dataclass_transform
9
8
 
10
9
  _py_type = type | str # Alias for type hint values
11
10
  _CopiableMappings = dict[str, typing.Any] | MappingProxyType[str, typing.Any]
@@ -244,18 +243,6 @@ def slotclass(
244
243
 
245
244
  _gatherer_type = Callable[[type | _CopiableMappings], tuple[dict[str, Field], dict[str, typing.Any]]]
246
245
 
247
-
248
- @dataclass_transform(field_specifiers=(Field,))
249
- class AnnotationClass(metaclass=SlotMakerMeta):
250
- __slots__: dict
251
-
252
- def __init_subclass__(
253
- cls,
254
- methods: frozenset[MethodMaker] | set[MethodMaker] = default_methods,
255
- gatherer: _gatherer_type = unified_gatherer,
256
- **kwargs,
257
- ) -> None: ...
258
-
259
246
  class GatheredFields:
260
247
  __slots__: dict[str, None]
261
248
 
@@ -1,2 +1,2 @@
1
- __version__ = "0.8.4"
2
- __version_tuple__ = (0, 8, 4)
1
+ __version__ = "0.9.0"
2
+ __version_tuple__ = (0, 9, 0)
@@ -25,7 +25,7 @@ import sys
25
25
  class _LazyAnnotationLib:
26
26
  def __getattr__(self, item):
27
27
  global _lazyannotationlib
28
- import annotationlib # type: ignore - this is a Python 3.14 library
28
+ import annotationlib # type: ignore
29
29
  _lazyannotationlib = annotationlib
30
30
  return getattr(annotationlib, item)
31
31
 
@@ -294,7 +294,7 @@ class Attribute(Field):
294
294
  """
295
295
  iter: bool = True
296
296
  serialize: bool = True
297
- metadata: dict = Field(default=FIELD_NOTHING, default_factory=dict)
297
+ metadata: dict = Field(default=FIELD_NOTHING, default_factory=dict) # type: ignore
298
298
 
299
299
 
300
300
  # noinspection PyShadowingBuiltins
@@ -551,7 +551,7 @@ def _make_prefab(
551
551
 
552
552
  class Prefab(metaclass=SlotMakerMeta):
553
553
  _meta_gatherer = prefab_gatherer
554
- __slots__ = {}
554
+ __slots__ = {} # type: ignore
555
555
 
556
556
  # noinspection PyShadowingBuiltins
557
557
  def __init_subclass__(
@@ -4,7 +4,8 @@ from typing_extensions import dataclass_transform
4
4
 
5
5
  import inspect
6
6
 
7
- from collections.abc import Callable
7
+ # Suppress weird pylance error
8
+ from collections.abc import Callable # type: ignore
8
9
 
9
10
  from . import (
10
11
  NOTHING,
@@ -58,36 +59,73 @@ class Attribute(Field):
58
59
  default: typing.Any | _NothingType = NOTHING,
59
60
  default_factory: typing.Any | _NothingType = NOTHING,
60
61
  type: type | _NothingType = NOTHING,
61
- doc: str | None = None,
62
- init: bool = True,
63
- repr: bool = True,
64
- compare: bool = True,
65
- iter: bool = True,
66
- kw_only: bool = False,
67
- serialize: bool = True,
68
- metadata: dict | None = None,
62
+ doc: str | None = ...,
63
+ init: bool = ...,
64
+ repr: bool = ...,
65
+ compare: bool = ...,
66
+ iter: bool = ...,
67
+ kw_only: bool = ...,
68
+ serialize: bool = ...,
69
+ metadata: dict | None = ...,
69
70
  ) -> None: ...
70
71
 
71
72
  def __repr__(self) -> str: ...
72
73
  def __eq__(self, other: Attribute | object) -> bool: ...
73
74
  def validate_field(self) -> None: ...
74
75
 
76
+ @typing.overload
75
77
  def attribute(
76
78
  *,
77
- default: typing.Any | _NothingType = NOTHING,
78
- default_factory: typing.Any | _NothingType = NOTHING,
79
- init: bool = True,
80
- repr: bool = True,
81
- compare: bool = True,
82
- iter: bool = True,
83
- kw_only: bool = False,
84
- serialize: bool = True,
85
- exclude_field: bool = False,
86
- private: bool = False,
87
- doc: str | None = None,
88
- metadata: dict | None = None,
89
- type: type | _NothingType = NOTHING,
90
- ) -> Attribute: ...
79
+ default: _T,
80
+ default_factory: _NothingType = NOTHING,
81
+ init: bool = ...,
82
+ repr: bool = ...,
83
+ compare: bool = ...,
84
+ iter: bool = ...,
85
+ kw_only: bool = ...,
86
+ serialize: bool = ...,
87
+ exclude_field: bool = ...,
88
+ private: bool = ...,
89
+ doc: str | None = ...,
90
+ metadata: dict | None = ...,
91
+ type: type | _NothingType = ...,
92
+ ) -> _T: ...
93
+
94
+ @typing.overload
95
+ def attribute(
96
+ *,
97
+ default: _NothingType = NOTHING,
98
+ default_factory: Callable[[], _T],
99
+ init: bool = ...,
100
+ repr: bool = ...,
101
+ compare: bool = ...,
102
+ iter: bool = ...,
103
+ kw_only: bool = ...,
104
+ serialize: bool = ...,
105
+ exclude_field: bool = ...,
106
+ private: bool = ...,
107
+ doc: str | None = ...,
108
+ metadata: dict | None = ...,
109
+ type: type | _NothingType = ...,
110
+ ) -> _T: ...
111
+
112
+ @typing.overload
113
+ def attribute(
114
+ *,
115
+ default: _NothingType = NOTHING,
116
+ default_factory: _NothingType = NOTHING,
117
+ init: bool = ...,
118
+ repr: bool = ...,
119
+ compare: bool = ...,
120
+ iter: bool = ...,
121
+ kw_only: bool = ...,
122
+ serialize: bool = ...,
123
+ exclude_field: bool = ...,
124
+ private: bool = ...,
125
+ doc: str | None = ...,
126
+ metadata: dict | None = ...,
127
+ type: type | _NothingType = ...,
128
+ ) -> typing.Any: ...
91
129
 
92
130
  def prefab_gatherer(cls_or_ns: type | MappingProxyType) -> tuple[dict[str, Attribute], dict[str, typing.Any]]: ...
93
131
 
@@ -111,7 +149,8 @@ _T = typing.TypeVar("_T")
111
149
  # noinspection PyUnresolvedReferences
112
150
  @dataclass_transform(field_specifiers=(Attribute, attribute))
113
151
  class Prefab(metaclass=SlotMakerMeta):
114
- _meta_gatherer: Callable[[type | _CopiableMappings], tuple[dict[str, Field], dict[str, typing.Any]]]
152
+ _meta_gatherer: Callable[[type | _CopiableMappings], tuple[dict[str, Field], dict[str, typing.Any]]] = ...
153
+ __slots__: dict[str, typing.Any] = ...
115
154
  def __init_subclass__(
116
155
  cls,
117
156
  init: bool = True,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ducktools-classbuilder
3
- Version: 0.8.4
3
+ Version: 0.9.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
@@ -0,0 +1,13 @@
1
+ ducktools/classbuilder/__init__.py,sha256=IfMN45iuJJ0BadtmjwjoYhXCLw6WOSQTMk9s_cxGT0M,32312
2
+ ducktools/classbuilder/__init__.pyi,sha256=66VOHYndP7z83Bl7QzTOyoF8j2nLFRRFfaQ6-mTdnmo,7683
3
+ ducktools/classbuilder/_version.py,sha256=RJaQx44-8b_pifglxqeP0c25pHPZ-Zu98duqjj_ZSOg,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=I1FRb1avVp6u1TPJgEs5QB1pnRH0xh8PQoI3oF8su5Q,24415
7
+ ducktools/classbuilder/prefab.pyi,sha256=sd800Hx2jf3CIaIfcurzanKGV-7-Km6_dY8JrM2FRHw,6363
8
+ ducktools/classbuilder/py.typed,sha256=la67KBlbjXN-_-DfGNcdOcjYumVpKG_Tkw-8n5dnGB4,8
9
+ ducktools_classbuilder-0.9.0.dist-info/LICENSE,sha256=6Thz9Dbw8R4fWInl6sGl8Rj3UnKnRbDwrc6jZerpugQ,1070
10
+ ducktools_classbuilder-0.9.0.dist-info/METADATA,sha256=l6eUeDAEMjJKTInGL2Q7oXGSfj0ur0sKy8UWdbtB15c,9636
11
+ ducktools_classbuilder-0.9.0.dist-info/WHEEL,sha256=iAkIy5fosb7FzIOwONchHf19Qu7_1wCWyFNR5gu9nU0,91
12
+ ducktools_classbuilder-0.9.0.dist-info/top_level.txt,sha256=uSDLtio3ZFqdwcsMJ2O5yhjB4Q3ytbBWbA8rJREganc,10
13
+ ducktools_classbuilder-0.9.0.dist-info/RECORD,,
@@ -1,13 +0,0 @@
1
- ducktools/classbuilder/__init__.py,sha256=J0Tyf-IS7fCuNhccsVnLqnId83hHqffw5CW-gbHJza4,32831
2
- ducktools/classbuilder/__init__.pyi,sha256=47rT22Copd8gKiw26sTdAkA99NjMMwX6WsYsN0EEEtY,8060
3
- ducktools/classbuilder/_version.py,sha256=1lfD4M7j7FGjNEGzWx3WAlgJCS0G0L-UuzDObMBwmDo,52
4
- ducktools/classbuilder/annotations.py,sha256=kuL2ZJR3-mrN9XnWx88FC0rXgSwtT-C1EKbdZ_ijNzg,3615
5
- ducktools/classbuilder/annotations.pyi,sha256=c5vYtULdDgMYWtkzeYMsHIbmnEuT2Ru-nNZieWvYuQ4,247
6
- ducktools/classbuilder/prefab.py,sha256=GVoYmMVEBXWTwJRQsEUG1VfP_Kc3neHYFdwi7OCyOtg,24383
7
- ducktools/classbuilder/prefab.pyi,sha256=NoGeBiPvm3VismyOyVsz1mrKFUex90BU3fRcxh6o76E,5465
8
- ducktools/classbuilder/py.typed,sha256=la67KBlbjXN-_-DfGNcdOcjYumVpKG_Tkw-8n5dnGB4,8
9
- ducktools_classbuilder-0.8.4.dist-info/LICENSE,sha256=6Thz9Dbw8R4fWInl6sGl8Rj3UnKnRbDwrc6jZerpugQ,1070
10
- ducktools_classbuilder-0.8.4.dist-info/METADATA,sha256=4M21VREGfntX2daQyaalQBrehQIuSsOwsJwlRR_geYE,9636
11
- ducktools_classbuilder-0.8.4.dist-info/WHEEL,sha256=iAkIy5fosb7FzIOwONchHf19Qu7_1wCWyFNR5gu9nU0,91
12
- ducktools_classbuilder-0.8.4.dist-info/top_level.txt,sha256=uSDLtio3ZFqdwcsMJ2O5yhjB4Q3ytbBWbA8rJREganc,10
13
- ducktools_classbuilder-0.8.4.dist-info/RECORD,,