ducktools-classbuilder 0.2.0__py3-none-any.whl → 0.2.1__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 +1 -1
- ducktools/classbuilder/prefab.py +7 -7
- ducktools/classbuilder/prefab.pyi +3 -3
- {ducktools_classbuilder-0.2.0.dist-info → ducktools_classbuilder-0.2.1.dist-info}/METADATA +1 -1
- ducktools_classbuilder-0.2.1.dist-info/RECORD +10 -0
- ducktools_classbuilder-0.2.0.dist-info/RECORD +0 -10
- {ducktools_classbuilder-0.2.0.dist-info → ducktools_classbuilder-0.2.1.dist-info}/LICENSE.md +0 -0
- {ducktools_classbuilder-0.2.0.dist-info → ducktools_classbuilder-0.2.1.dist-info}/WHEEL +0 -0
- {ducktools_classbuilder-0.2.0.dist-info → ducktools_classbuilder-0.2.1.dist-info}/top_level.txt +0 -0
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
20
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
21
|
# SOFTWARE.
|
|
22
|
-
__version__ = "v0.2.
|
|
22
|
+
__version__ = "v0.2.1"
|
|
23
23
|
|
|
24
24
|
# Change this name if you make heavy modifications
|
|
25
25
|
INTERNALS_DICT = "__classbuilder_internals__"
|
ducktools/classbuilder/prefab.py
CHANGED
|
@@ -398,7 +398,7 @@ def get_asdict_maker():
|
|
|
398
398
|
vals = ", ".join(
|
|
399
399
|
f"'{name}': self.{name}"
|
|
400
400
|
for name, attrib in fields.items()
|
|
401
|
-
if attrib.
|
|
401
|
+
if attrib.serialize and not attrib.exclude_field
|
|
402
402
|
)
|
|
403
403
|
out_dict = f"{{{vals}}}"
|
|
404
404
|
code = f"def as_dict(self): return {out_dict}"
|
|
@@ -428,7 +428,7 @@ class Attribute(Field):
|
|
|
428
428
|
compare=True,
|
|
429
429
|
iter=True,
|
|
430
430
|
kw_only=False,
|
|
431
|
-
|
|
431
|
+
serialize=True,
|
|
432
432
|
exclude_field=False,
|
|
433
433
|
)
|
|
434
434
|
|
|
@@ -450,7 +450,7 @@ def attribute(
|
|
|
450
450
|
compare=True,
|
|
451
451
|
iter=True,
|
|
452
452
|
kw_only=False,
|
|
453
|
-
|
|
453
|
+
serialize=True,
|
|
454
454
|
exclude_field=False,
|
|
455
455
|
doc=None,
|
|
456
456
|
type=NOTHING,
|
|
@@ -466,7 +466,7 @@ def attribute(
|
|
|
466
466
|
:param compare: Include this attribute in the class __eq__
|
|
467
467
|
:param iter: Include this attribute in the class __iter__ if generated
|
|
468
468
|
:param kw_only: Make this argument keyword only in init
|
|
469
|
-
:param
|
|
469
|
+
:param serialize: Include this attribute in methods that serialize to dict
|
|
470
470
|
:param exclude_field: Exclude this field from all magic method generation
|
|
471
471
|
apart from __init__ signature
|
|
472
472
|
and do not include it in PREFAB_FIELDS
|
|
@@ -484,7 +484,7 @@ def attribute(
|
|
|
484
484
|
compare=compare,
|
|
485
485
|
iter=iter,
|
|
486
486
|
kw_only=kw_only,
|
|
487
|
-
|
|
487
|
+
serialize=serialize,
|
|
488
488
|
exclude_field=exclude_field,
|
|
489
489
|
doc=doc,
|
|
490
490
|
type=type,
|
|
@@ -906,7 +906,7 @@ def is_prefab_instance(o):
|
|
|
906
906
|
|
|
907
907
|
def as_dict(o):
|
|
908
908
|
"""
|
|
909
|
-
Get the valid fields from a prefab respecting the
|
|
909
|
+
Get the valid fields from a prefab respecting the serialize
|
|
910
910
|
values of attributes
|
|
911
911
|
|
|
912
912
|
:param o: instance of a prefab class
|
|
@@ -927,5 +927,5 @@ def as_dict(o):
|
|
|
927
927
|
return {
|
|
928
928
|
name: getattr(o, name)
|
|
929
929
|
for name, attrib in flds.items()
|
|
930
|
-
if attrib.
|
|
930
|
+
if attrib.serialize and not attrib.exclude_field
|
|
931
931
|
}
|
|
@@ -63,7 +63,7 @@ class Attribute(Field):
|
|
|
63
63
|
compare: bool
|
|
64
64
|
iter: bool
|
|
65
65
|
kw_only: bool
|
|
66
|
-
|
|
66
|
+
serialize: bool
|
|
67
67
|
exclude_field: bool
|
|
68
68
|
|
|
69
69
|
def __init__(
|
|
@@ -78,7 +78,7 @@ class Attribute(Field):
|
|
|
78
78
|
compare: bool = True,
|
|
79
79
|
iter: bool = True,
|
|
80
80
|
kw_only: bool = False,
|
|
81
|
-
|
|
81
|
+
serialize: bool = True,
|
|
82
82
|
exclude_field: bool = False,
|
|
83
83
|
) -> None: ...
|
|
84
84
|
|
|
@@ -97,7 +97,7 @@ def attribute(
|
|
|
97
97
|
compare: bool = True,
|
|
98
98
|
iter: bool = True,
|
|
99
99
|
kw_only: bool = False,
|
|
100
|
-
|
|
100
|
+
serialize: bool = True,
|
|
101
101
|
exclude_field: bool = False,
|
|
102
102
|
) -> Attribute: ...
|
|
103
103
|
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
ducktools/classbuilder/__init__.py,sha256=yZOiy84vo8z0iotOgY1rFwBBngveh1cwoWjcQdRndpw,13747
|
|
2
|
+
ducktools/classbuilder/__init__.pyi,sha256=-QHJhPn4EjI4XW4OI74MKNg2tGKJiM3w0ELSOvPstAw,2877
|
|
3
|
+
ducktools/classbuilder/prefab.py,sha256=gJJCtTAbQLgIoo79jRWVp09r3u8kJjcqXp4G4FTu9j8,29887
|
|
4
|
+
ducktools/classbuilder/prefab.pyi,sha256=GsllqqZ_Wz6i_DenKv-pAbtES3sPanC0g8O7fkNTnvs,3969
|
|
5
|
+
ducktools/classbuilder/py.typed,sha256=la67KBlbjXN-_-DfGNcdOcjYumVpKG_Tkw-8n5dnGB4,8
|
|
6
|
+
ducktools_classbuilder-0.2.1.dist-info/LICENSE.md,sha256=6Thz9Dbw8R4fWInl6sGl8Rj3UnKnRbDwrc6jZerpugQ,1070
|
|
7
|
+
ducktools_classbuilder-0.2.1.dist-info/METADATA,sha256=kV--mUdR1y0NmszwMobZdnNvigtepG_WF_axupjf6_4,9280
|
|
8
|
+
ducktools_classbuilder-0.2.1.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
9
|
+
ducktools_classbuilder-0.2.1.dist-info/top_level.txt,sha256=uSDLtio3ZFqdwcsMJ2O5yhjB4Q3ytbBWbA8rJREganc,10
|
|
10
|
+
ducktools_classbuilder-0.2.1.dist-info/RECORD,,
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
ducktools/classbuilder/__init__.py,sha256=OOVk-E6UBi8-68bEy9pqCiKbn9oQ1y4tRGnZ3LGsGYg,13747
|
|
2
|
-
ducktools/classbuilder/__init__.pyi,sha256=-QHJhPn4EjI4XW4OI74MKNg2tGKJiM3w0ELSOvPstAw,2877
|
|
3
|
-
ducktools/classbuilder/prefab.py,sha256=yUa_yoPKU1hzI4klqWJOwTZEXtNOmUU1fQnLuHkVACw,29871
|
|
4
|
-
ducktools/classbuilder/prefab.pyi,sha256=4cyXYqTXtCJv4gPOSNtkBrjORj2jt1bvX6p_sCOzoXw,3963
|
|
5
|
-
ducktools/classbuilder/py.typed,sha256=la67KBlbjXN-_-DfGNcdOcjYumVpKG_Tkw-8n5dnGB4,8
|
|
6
|
-
ducktools_classbuilder-0.2.0.dist-info/LICENSE.md,sha256=6Thz9Dbw8R4fWInl6sGl8Rj3UnKnRbDwrc6jZerpugQ,1070
|
|
7
|
-
ducktools_classbuilder-0.2.0.dist-info/METADATA,sha256=LmHMIhj4jJ9WlmHOac4lBVgW4l6cdNUjG8cEvIULVko,9280
|
|
8
|
-
ducktools_classbuilder-0.2.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
9
|
-
ducktools_classbuilder-0.2.0.dist-info/top_level.txt,sha256=uSDLtio3ZFqdwcsMJ2O5yhjB4Q3ytbBWbA8rJREganc,10
|
|
10
|
-
ducktools_classbuilder-0.2.0.dist-info/RECORD,,
|
{ducktools_classbuilder-0.2.0.dist-info → ducktools_classbuilder-0.2.1.dist-info}/LICENSE.md
RENAMED
|
File without changes
|
|
File without changes
|
{ducktools_classbuilder-0.2.0.dist-info → ducktools_classbuilder-0.2.1.dist-info}/top_level.txt
RENAMED
|
File without changes
|