labfreed 0.2.5a11__py3-none-any.whl → 0.2.5a13__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.
labfreed/__init__.py CHANGED
@@ -2,7 +2,7 @@
2
2
  Python implementation of LabFREED building blocks
3
3
  '''
4
4
 
5
- __version__ = "0.2.5a11"
5
+ __version__ = "0.2.5a13"
6
6
 
7
7
  from labfreed.pac_id import * # noqa: F403
8
8
  from labfreed.pac_cat import * # noqa: F403
@@ -19,6 +19,9 @@ class DataTable(BaseModel):
19
19
 
20
20
  @model_validator(mode='after')
21
21
  def get_row_template(self):
22
+ if not self.data: # data not initialized during construction. This is valid
23
+ return self
24
+
22
25
  for r in self.data:
23
26
  if all([e is not None for e in r]):
24
27
  self._row_template = r.copy()
@@ -28,7 +31,7 @@ class DataTable(BaseModel):
28
31
  return self
29
32
 
30
33
 
31
- def append(self, row:list):
34
+ def append(self, row:list, validate=True):
32
35
  if not isinstance(row, list):
33
36
  raise ValueError('row must be a list of values')
34
37
  if not self._row_template:
@@ -44,13 +47,16 @@ class DataTable(BaseModel):
44
47
  unit = self._row_template[i].unit
45
48
  row[i] = Quantity(value=e, unit=unit)
46
49
  self.data.append(row)
50
+ if validate:
51
+ self.model_rebuild()
47
52
 
48
53
 
49
54
  def extend(self, iterable):
50
55
  for item in iterable:
51
56
  if not len(item) == len(self._row_template):
52
57
  raise ValueError('row is not of same length as the row template.')
53
- self.data.append(item)
58
+ self.append(item, validate=False)
59
+ self.model_rebuild()
54
60
 
55
61
 
56
62
  def get_column(self, col:str|int) -> list:
@@ -209,7 +209,7 @@ def _trex_value_to_python_type(v):
209
209
  '''Converts a TREX value to the corresponding python type'''
210
210
  if isinstance(v, NumericValue):
211
211
  if '.' not in v.value and 'E' not in v.value:
212
- return int(v)
212
+ return int(v.value)
213
213
  else:
214
214
  return float(v.value)
215
215
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: labfreed
3
- Version: 0.2.5a11
3
+ Version: 0.2.5a13
4
4
  Summary: Python implementation of LabFREED building blocks
5
5
  Author-email: Reto Thürer <thuerer.r@buchi.com>
6
6
  Requires-Python: >=3.11
@@ -1,4 +1,4 @@
1
- labfreed/__init__.py,sha256=wEdznFeY9l8zQjKIU9Vb0IYDOVLGpTkv13urupnfe_U,339
1
+ labfreed/__init__.py,sha256=VM3BQHQMSYtH0ZAIY5fZWj4I7KoABakJMjohkJb9X1A,339
2
2
  labfreed/labfreed_infrastructure.py,sha256=yxZkI0mPrHyeZGWKtgFIV9R54edSUcww-w1ExHt8F-o,9990
3
3
  labfreed/pac_cat/__init__.py,sha256=KNPtQzBD1XVohvG_ucOs7RJj-oi6biUTGB1k-T2o6pk,568
4
4
  labfreed/pac_cat/category_base.py,sha256=lFQNiTUukyhWdaSCAI7CZxLtj6kNtnBCE4UsePwsGqE,1801
@@ -23,8 +23,8 @@ labfreed/trex/trex.py,sha256=WDoPvuhiilLtRSIkntCmDGkFBnD6oRZg0E6hhoV-I2g,2400
23
23
  labfreed/trex/trex_base_models.py,sha256=591559BISc82fyIoEP_dq_GHDbPCVzApx7FM3TRQPlY,7545
24
24
  labfreed/trex/value_segments.py,sha256=qizDsinE-ddta8jzkJbGT3OUjHpYhI2GwxjZ6InzLDs,3712
25
25
  labfreed/trex/python_convenience/__init__.py,sha256=dyAQG7t-uYN6VfGXbWIq2bHxGcGI63l7FS2-VPYs2RQ,137
26
- labfreed/trex/python_convenience/data_table.py,sha256=7iO5ZmIGGAKHR4pkShEG0tH1lj95-D52GhW2bQ1fXx4,2920
27
- labfreed/trex/python_convenience/pyTREX.py,sha256=ZtSH0sQgXkHgFGLRwsZ4QuTu_Vmaruzr1e7Djg2xfr4,10141
26
+ labfreed/trex/python_convenience/data_table.py,sha256=SE1qKJ87XMwwbhcW_sfyZjRxi0QbaFkGpSt_OOJmoNc,3152
27
+ labfreed/trex/python_convenience/pyTREX.py,sha256=U026jtsESo1h2H_EQi11A9AksafjRXgRsbWOwmI9z0E,10147
28
28
  labfreed/trex/python_convenience/quantity.py,sha256=NlbKsXmr-nvN42gLw1gGn7GVRTdaIuYZky7SLekdhI8,1729
29
29
  labfreed/utilities/base36.py,sha256=_yX8aQ1OwrK5tnJU1NUEzQSFGr9xAVnNvPObpNzCPYs,2895
30
30
  labfreed/well_known_extensions/__init__.py,sha256=CjZTjx8Cn8763Hhnv_--Wj1LcFpFs2cyQwWrrzOS4xM,246
@@ -38,7 +38,7 @@ labfreed/well_known_keys/labfreed/well_known_keys.py,sha256=nqk66kHdSwJTJfMKlP-x
38
38
  labfreed/well_known_keys/unece/UneceUnits.json,sha256=kwfQSp_nTuWbADfBBgqTWrvPl6XtM5SedEVLbMJrM7M,898953
39
39
  labfreed/well_known_keys/unece/__init__.py,sha256=MSP9lmjg9_D9iqG9Yq2_ajYfQSNS9wIT7FXA1c--59M,122
40
40
  labfreed/well_known_keys/unece/unece_units.py,sha256=gNDQk6KGl-nGMf9Ycq_fQ8P2xxKITgLkcQWPd4H49gI,1630
41
- labfreed-0.2.5a11.dist-info/licenses/LICENSE,sha256=gHFOv9FRKHxO8cInP3YXyPoJnuNeqrvcHjaE_wPSsQ8,1100
42
- labfreed-0.2.5a11.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
43
- labfreed-0.2.5a11.dist-info/METADATA,sha256=OmMlr8uCF7V3mekOkJgOoRZAybKwFTPQAxtJK9pORrU,18093
44
- labfreed-0.2.5a11.dist-info/RECORD,,
41
+ labfreed-0.2.5a13.dist-info/licenses/LICENSE,sha256=gHFOv9FRKHxO8cInP3YXyPoJnuNeqrvcHjaE_wPSsQ8,1100
42
+ labfreed-0.2.5a13.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
43
+ labfreed-0.2.5a13.dist-info/METADATA,sha256=6ymOp3hKT20wDfTkw09wxl6jNzJQUkI9Qpwok22xh4E,18093
44
+ labfreed-0.2.5a13.dist-info/RECORD,,