atdata 0.1.2a1__py3-none-any.whl → 0.1.2a4__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.
- atdata/dataset.py +14 -3
- {atdata-0.1.2a1.dist-info → atdata-0.1.2a4.dist-info}/METADATA +1 -1
- atdata-0.1.2a4.dist-info/RECORD +8 -0
- atdata-0.1.2a1.dist-info/RECORD +0 -8
- {atdata-0.1.2a1.dist-info → atdata-0.1.2a4.dist-info}/WHEEL +0 -0
- {atdata-0.1.2a1.dist-info → atdata-0.1.2a4.dist-info}/entry_points.txt +0 -0
- {atdata-0.1.2a1.dist-info → atdata-0.1.2a4.dist-info}/licenses/LICENSE +0 -0
atdata/dataset.py
CHANGED
|
@@ -97,7 +97,8 @@ def _make_packable( x ):
|
|
|
97
97
|
class PackableSample( ABC ):
|
|
98
98
|
"""A sample that can be packed and unpacked with msgpack"""
|
|
99
99
|
|
|
100
|
-
def
|
|
100
|
+
def _ensure_good( self ):
|
|
101
|
+
"""TODO Stupid kludge because of __post_init__ nonsense for wrapped classes"""
|
|
101
102
|
|
|
102
103
|
# Auto-convert known types when annotated
|
|
103
104
|
for var_name, var_type in vars( self.__class__ )['__annotations__'].items():
|
|
@@ -121,12 +122,17 @@ class PackableSample( ABC ):
|
|
|
121
122
|
elif isinstance( var_cur_value, bytes ):
|
|
122
123
|
setattr( self, var_name, eh.bytes_to_array( var_cur_value ) )
|
|
123
124
|
|
|
125
|
+
def __post_init__( self ):
|
|
126
|
+
self._ensure_good()
|
|
127
|
+
|
|
124
128
|
##
|
|
125
129
|
|
|
126
130
|
@classmethod
|
|
127
131
|
def from_data( cls, data: MsgpackRawSample ) -> Self:
|
|
128
132
|
"""Create a sample instance from unpacked msgpack data"""
|
|
129
|
-
|
|
133
|
+
ret = cls( **data )
|
|
134
|
+
ret._ensure_good()
|
|
135
|
+
return ret
|
|
130
136
|
|
|
131
137
|
@classmethod
|
|
132
138
|
def from_bytes( cls, bs: bytes ) -> Self:
|
|
@@ -443,12 +449,17 @@ def packable( cls ):
|
|
|
443
449
|
|
|
444
450
|
##
|
|
445
451
|
|
|
452
|
+
# Add in dataclass niceness to original class
|
|
446
453
|
as_dataclass = dataclass( cls )
|
|
447
454
|
|
|
455
|
+
# This triggers a bunch of behind-the-scenes stuff for the newly annotated class
|
|
456
|
+
@dataclass
|
|
448
457
|
class as_packable( as_dataclass, PackableSample ):
|
|
449
|
-
|
|
458
|
+
def __post_init__( self ):
|
|
459
|
+
return PackableSample.__post_init__( self )
|
|
450
460
|
|
|
451
461
|
as_packable.__name__ = cls.__name__
|
|
462
|
+
as_packable.__annotations__ = cls.__annotations__
|
|
452
463
|
|
|
453
464
|
##
|
|
454
465
|
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
atdata/__init__.py,sha256=jPZVd_6UIo0DSbCnXAnYZ2eMwHYzOk--5vtEDTZvwqw,173
|
|
2
|
+
atdata/_helpers.py,sha256=R63JhXewAKZYnZ9Th7R6yZh0IOUPYGBsth3FpRUMD-U,503
|
|
3
|
+
atdata/dataset.py,sha256=4cfxyET8470RGKvHvseH8KZBQvTjevovPr_JGVwj854,13518
|
|
4
|
+
atdata-0.1.2a4.dist-info/METADATA,sha256=igT4Js5SEl5IUhWX6AqDYdROQ022LCx_qfT3PMLifjI,434
|
|
5
|
+
atdata-0.1.2a4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
6
|
+
atdata-0.1.2a4.dist-info/entry_points.txt,sha256=6-iQr1veSTq-ac94bLyfcyGHprrZWevPEd12BWX37tQ,39
|
|
7
|
+
atdata-0.1.2a4.dist-info/licenses/LICENSE,sha256=Pz2eACSxkhsGfW9_iN60pgy-enjnbGTj8df8O3ebnQQ,16726
|
|
8
|
+
atdata-0.1.2a4.dist-info/RECORD,,
|
atdata-0.1.2a1.dist-info/RECORD
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
atdata/__init__.py,sha256=jPZVd_6UIo0DSbCnXAnYZ2eMwHYzOk--5vtEDTZvwqw,173
|
|
2
|
-
atdata/_helpers.py,sha256=R63JhXewAKZYnZ9Th7R6yZh0IOUPYGBsth3FpRUMD-U,503
|
|
3
|
-
atdata/dataset.py,sha256=xPxDkQk1fBkU3sbLMT_Rm4CmvoBXIpEpmRNxrir4nis,13045
|
|
4
|
-
atdata-0.1.2a1.dist-info/METADATA,sha256=8aK-P0A7YZ2Cl6r_GC3Gi1huZRDrcR9zME2gMdT-fFc,434
|
|
5
|
-
atdata-0.1.2a1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
6
|
-
atdata-0.1.2a1.dist-info/entry_points.txt,sha256=6-iQr1veSTq-ac94bLyfcyGHprrZWevPEd12BWX37tQ,39
|
|
7
|
-
atdata-0.1.2a1.dist-info/licenses/LICENSE,sha256=Pz2eACSxkhsGfW9_iN60pgy-enjnbGTj8df8O3ebnQQ,16726
|
|
8
|
-
atdata-0.1.2a1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|