atdata 0.1.2a1__py3-none-any.whl → 0.1.2a3__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 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 __post_init__( self ):
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
- return cls( **data )
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:
@@ -445,11 +451,13 @@ def packable( cls ):
445
451
 
446
452
  as_dataclass = dataclass( cls )
447
453
 
448
- class as_packable( as_dataclass, PackableSample ):
449
- pass
454
+ class as_packable( PackableSample, as_dataclass ):
455
+ def __post_init__( self ):
456
+ return PackableSample.__post_init__( self )
450
457
 
451
458
  as_packable.__name__ = cls.__name__
459
+ as_packable.__annotations__ = cls.__annotations__
452
460
 
453
461
  ##
454
-
462
+
455
463
  return as_packable
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: atdata
3
- Version: 0.1.2a1
3
+ Version: 0.1.2a3
4
4
  Summary: A loose federation of distributed, typed datasets
5
5
  Author-email: Maxine Levesque <hello@maxine.science>
6
6
  License-File: LICENSE
@@ -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=HXctGwIbU5kr2pqiQCYDyGP1mkph1gIt-x1_PRtWyew,13372
4
+ atdata-0.1.2a3.dist-info/METADATA,sha256=Jj5vP4NW-HtckIsPRzzpXVQXgcQ8HaFSGehdAu4Vfbo,434
5
+ atdata-0.1.2a3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
6
+ atdata-0.1.2a3.dist-info/entry_points.txt,sha256=6-iQr1veSTq-ac94bLyfcyGHprrZWevPEd12BWX37tQ,39
7
+ atdata-0.1.2a3.dist-info/licenses/LICENSE,sha256=Pz2eACSxkhsGfW9_iN60pgy-enjnbGTj8df8O3ebnQQ,16726
8
+ atdata-0.1.2a3.dist-info/RECORD,,
@@ -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,,