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

@@ -33,7 +33,7 @@
33
33
  import os
34
34
 
35
35
  from .annotations import get_ns_annotations, is_classvar
36
- from ._version import __version__, __version_tuple__
36
+ from ._version import __version__, __version_tuple__ # noqa: F401
37
37
 
38
38
  # Change this name if you make heavy modifications
39
39
  INTERNALS_DICT = "__classbuilder_internals__"
@@ -280,7 +280,7 @@ def get_init_generator(null=NOTHING, extra_code=None):
280
280
 
281
281
  assigns = "\n ".join(assignments) if assignments else "pass\n"
282
282
  code = (
283
- f"def {funcname}(self, {args}):\n"
283
+ f"def {funcname}(self, {args}):\n"
284
284
  f" {assigns}\n"
285
285
  )
286
286
  # Handle additional function calls
@@ -663,10 +663,10 @@ class Field(metaclass=SlotMakerMeta):
663
663
  def from_field(cls, fld, /, **kwargs):
664
664
  """
665
665
  Create an instance of field or subclass from another field.
666
-
667
- This is intended to be used to convert a base
666
+
667
+ This is intended to be used to convert a base
668
668
  Field into a subclass.
669
-
669
+
670
670
  :param fld: field class to convert
671
671
  :param kwargs: Additional keyword arguments for subclasses
672
672
  :return: new field subclass instance
@@ -762,7 +762,9 @@ def make_annotation_gatherer(
762
762
  else:
763
763
  cls_dict = cls_or_ns.__dict__
764
764
 
765
- cls_fields: dict[str, field_type] = {}
765
+ # This should really be dict[str, field_type] but static analysis
766
+ # doesn't understand this.
767
+ cls_fields: dict[str, Field] = {}
766
768
  modifications = {}
767
769
 
768
770
  cls_annotations = get_ns_annotations(cls_dict)
@@ -1,2 +1,2 @@
1
- __version__ = "0.8.3"
2
- __version_tuple__ = (0, 8, 3)
1
+ __version__ = "0.8.4"
2
+ __version_tuple__ = (0, 8, 4)
@@ -25,7 +25,7 @@ import sys
25
25
  class _LazyAnnotationLib:
26
26
  def __getattr__(self, item):
27
27
  global _lazyannotationlib
28
- import annotationlib
28
+ import annotationlib # type: ignore - this is a Python 3.14 library
29
29
  _lazyannotationlib = annotationlib
30
30
  return getattr(annotationlib, item)
31
31
 
@@ -36,7 +36,7 @@ from . import (
36
36
 
37
37
  # These aren't used but are re-exported for ease of use
38
38
  # noinspection PyUnresolvedReferences
39
- from . import SlotFields, KW_ONLY
39
+ from . import SlotFields, KW_ONLY # noqa: F401
40
40
 
41
41
  PREFAB_FIELDS = "PREFAB_FIELDS"
42
42
  PREFAB_INIT_FUNC = "__prefab_init__"
@@ -125,23 +125,56 @@ class Prefab(metaclass=SlotMakerMeta):
125
125
  recursive_repr: bool = False,
126
126
  ) -> None: ...
127
127
 
128
-
129
- # For some reason PyCharm can't see 'attribute'?!?
130
- # noinspection PyUnresolvedReferences
128
+ # As far as I can tell these are the correct types
129
+ # But mypy.stubtest crashes trying to analyse them
130
+ # Due to the combination of overload and dataclass_transform
131
+ # @typing.overload
132
+ # def prefab(
133
+ # cls: None = None,
134
+ # *,
135
+ # init: bool = ...,
136
+ # repr: bool = ...,
137
+ # eq: bool = ...,
138
+ # iter: bool = ...,
139
+ # match_args: bool = ...,
140
+ # kw_only: bool = ...,
141
+ # frozen: bool = ...,
142
+ # dict_method: bool = ...,
143
+ # recursive_repr: bool = ...,
144
+ # ) -> Callable[[type[_T]], type[_T]]: ...
145
+
146
+ # @dataclass_transform(field_specifiers=(Attribute, attribute))
147
+ # @typing.overload
148
+ # def prefab(
149
+ # cls: type[_T],
150
+ # *,
151
+ # init: bool = ...,
152
+ # repr: bool = ...,
153
+ # eq: bool = ...,
154
+ # iter: bool = ...,
155
+ # match_args: bool = ...,
156
+ # kw_only: bool = ...,
157
+ # frozen: bool = ...,
158
+ # dict_method: bool = ...,
159
+ # recursive_repr: bool = ...,
160
+ # ) -> type[_T]: ...
161
+
162
+ # As mypy crashes, and the only difference is the return type
163
+ # just return `Any` for now to avoid the overload.
131
164
  @dataclass_transform(field_specifiers=(Attribute, attribute))
132
165
  def prefab(
133
- cls: type[_T] | None = None,
166
+ cls: type[_T] | None = ...,
134
167
  *,
135
- init: bool = True,
136
- repr: bool = True,
137
- eq: bool = True,
138
- iter: bool = False,
139
- match_args: bool = True,
140
- kw_only: bool = False,
141
- frozen: bool = False,
142
- dict_method: bool = False,
143
- recursive_repr: bool = False,
144
- ) -> type[_T] | Callable[[type[_T]], type[_T]]: ...
168
+ init: bool = ...,
169
+ repr: bool = ...,
170
+ eq: bool = ...,
171
+ iter: bool = ...,
172
+ match_args: bool = ...,
173
+ kw_only: bool = ...,
174
+ frozen: bool = ...,
175
+ dict_method: bool = ...,
176
+ recursive_repr: bool = ...,
177
+ ) -> typing.Any: ...
145
178
 
146
179
  def build_prefab(
147
180
  class_name: str,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ducktools-classbuilder
3
- Version: 0.8.3
3
+ Version: 0.8.4
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=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,,
@@ -1,13 +0,0 @@
1
- ducktools/classbuilder/__init__.py,sha256=6rU3erZbq2eNJ8P1zr948J7aHDFqyS8w5b2mKUEKrj8,32731
2
- ducktools/classbuilder/__init__.pyi,sha256=47rT22Copd8gKiw26sTdAkA99NjMMwX6WsYsN0EEEtY,8060
3
- ducktools/classbuilder/_version.py,sha256=WeYjLPgnZeDbw78yAtmbCWqzpBXhNlopfXe1KzTtm_c,52
4
- ducktools/classbuilder/annotations.py,sha256=tFCuVSjnD8VleA7ytQnHo7PrMdlO1EzuTs-zK6tCQyo,3567
5
- ducktools/classbuilder/annotations.pyi,sha256=c5vYtULdDgMYWtkzeYMsHIbmnEuT2Ru-nNZieWvYuQ4,247
6
- ducktools/classbuilder/prefab.py,sha256=Lg3gBn3-09036vn5PNvbXt4m8srEo0JP3tf7rxdqk1I,24369
7
- ducktools/classbuilder/prefab.pyi,sha256=qHK6KvV4C5fky4KCqskpoTUHKD4wCVxTdyGaydrATOE,4582
8
- ducktools/classbuilder/py.typed,sha256=la67KBlbjXN-_-DfGNcdOcjYumVpKG_Tkw-8n5dnGB4,8
9
- ducktools_classbuilder-0.8.3.dist-info/LICENSE,sha256=6Thz9Dbw8R4fWInl6sGl8Rj3UnKnRbDwrc6jZerpugQ,1070
10
- ducktools_classbuilder-0.8.3.dist-info/METADATA,sha256=4Srcr862qbqjoIY5MpWJoxIK70STNtqqlUVNv0gtp6o,9636
11
- ducktools_classbuilder-0.8.3.dist-info/WHEEL,sha256=iAkIy5fosb7FzIOwONchHf19Qu7_1wCWyFNR5gu9nU0,91
12
- ducktools_classbuilder-0.8.3.dist-info/top_level.txt,sha256=uSDLtio3ZFqdwcsMJ2O5yhjB4Q3ytbBWbA8rJREganc,10
13
- ducktools_classbuilder-0.8.3.dist-info/RECORD,,