labfreed 0.2.5a6__py3-none-any.whl → 0.2.5a7__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 labfreed might be problematic. Click here for more details.

labfreed/__init__.py CHANGED
@@ -2,7 +2,7 @@
2
2
  Python implementation of LabFREED building blocks
3
3
  '''
4
4
 
5
- __version__ = "0.2.5a6"
5
+ __version__ = "0.2.5a7"
6
6
 
7
7
  from labfreed.pac_id import * # noqa: F403
8
8
  from labfreed.pac_cat import * # noqa: F403
@@ -5,7 +5,8 @@ from labfreed.well_known_keys.unece.unece_units import unece_units
5
5
  class Quantity(BaseModel):
6
6
  ''' Represents a quantity'''
7
7
  value: float|int
8
- unit: str
8
+ unit: str | None
9
+ '''unit. Use SI symbols. Set to None of the Quantity is dimensionless'''
9
10
  significant_digits: int|None = None
10
11
 
11
12
  @model_validator(mode='after')
@@ -36,11 +37,14 @@ class Quantity(BaseModel):
36
37
 
37
38
 
38
39
  def unece_unit_code_from_quantity(q:Quantity):
40
+ if not q.unit:
41
+ return 'C63' # dimensionless
39
42
  by_name = [ u['commonCode'] for u in unece_units() if u.get('name','') == q.unit]
40
43
  by_symbol = [ u['commonCode'] for u in unece_units() if u.get('symbol','') == q.unit]
41
- code = list(set(by_name) | set(by_symbol))
44
+ by_code = [ u['commonCode'] for u in unece_units() if u.get('commonCode','') == q.unit]
45
+ code = list(set(by_name) | set(by_symbol) | set(by_code))
42
46
  if len(code) != 1:
43
- raise ValueError(f'No UNECE unit code found for Quantity {str(q)}' )
47
+ raise ValueError(f'No UNECE unit code found for Quantity {q}' )
44
48
  return code[0]
45
49
 
46
50
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: labfreed
3
- Version: 0.2.5a6
3
+ Version: 0.2.5a7
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=28q0FQKA2E7uyqB3WPSWRlSLGP3T1NKOnkgRH0slyfA,338
1
+ labfreed/__init__.py,sha256=TkoJKnHrT7gKiqc6QyDOcZFaDZSyQg9fJElU9o0YjZ8,338
2
2
  labfreed/labfreed_infrastructure.py,sha256=yxZkI0mPrHyeZGWKtgFIV9R54edSUcww-w1ExHt8F-o,9990
3
3
  labfreed/pac_cat/__init__.py,sha256=S4T-QgzcEDjup44WvHCY3_K30B6_e8ducR--DxBb_DM,554
4
4
  labfreed/pac_cat/category_base.py,sha256=lFQNiTUukyhWdaSCAI7CZxLtj6kNtnBCE4UsePwsGqE,1801
@@ -25,7 +25,7 @@ labfreed/trex/value_segments.py,sha256=mmjyEKWLlDIoiFlk2wKELOfWn2_0xwreNEBTs8Rgj
25
25
  labfreed/trex/python_convenience/__init__.py,sha256=dyAQG7t-uYN6VfGXbWIq2bHxGcGI63l7FS2-VPYs2RQ,137
26
26
  labfreed/trex/python_convenience/data_table.py,sha256=zUPD9lDzF6eeiys3YYf16M3g8wPYE2kBLAk1l8zZ6Do,2157
27
27
  labfreed/trex/python_convenience/pyTREX.py,sha256=7L1K1sLajl8yE-i1NIjVGnxx1SZJDNDM4pvK9fXK4iQ,10147
28
- labfreed/trex/python_convenience/quantity.py,sha256=d3w-ThY4Cp7n3fde8pct-X5kHc7vbVe1xsJQKROnLks,1470
28
+ labfreed/trex/python_convenience/quantity.py,sha256=j-E5rioQKs6COPMtn5J8bZmbwEF0RBkFxYmHJZaT2Q0,1729
29
29
  labfreed/utilities/base36.py,sha256=_yX8aQ1OwrK5tnJU1NUEzQSFGr9xAVnNvPObpNzCPYs,2895
30
30
  labfreed/well_known_extensions/__init__.py,sha256=CjZTjx8Cn8763Hhnv_--Wj1LcFpFs2cyQwWrrzOS4xM,246
31
31
  labfreed/well_known_extensions/default_extension_interpreters.py,sha256=3-BkJrAyBa99NN5Q2QPAm59CcWmPket-rvLzgltp8KY,201
@@ -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.5a6.dist-info/licenses/LICENSE,sha256=gHFOv9FRKHxO8cInP3YXyPoJnuNeqrvcHjaE_wPSsQ8,1100
42
- labfreed-0.2.5a6.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
43
- labfreed-0.2.5a6.dist-info/METADATA,sha256=LhcmS7tR0oRdE2FbyGtvTA3h2_TwqUId3vJcSz9TFVc,18092
44
- labfreed-0.2.5a6.dist-info/RECORD,,
41
+ labfreed-0.2.5a7.dist-info/licenses/LICENSE,sha256=gHFOv9FRKHxO8cInP3YXyPoJnuNeqrvcHjaE_wPSsQ8,1100
42
+ labfreed-0.2.5a7.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
43
+ labfreed-0.2.5a7.dist-info/METADATA,sha256=nUK-qzSAxAYxwXKjk0Ypqa9sN1d32Ql-EJyKUg-xzyA,18092
44
+ labfreed-0.2.5a7.dist-info/RECORD,,