labfreed 0.2.5a5__tar.gz → 0.2.5a7__tar.gz
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-0.2.5a5 → labfreed-0.2.5a7}/PKG-INFO +1 -1
- {labfreed-0.2.5a5 → labfreed-0.2.5a7}/labfreed/__init__.py +1 -1
- {labfreed-0.2.5a5 → labfreed-0.2.5a7}/labfreed/trex/python_convenience/data_table.py +1 -1
- {labfreed-0.2.5a5 → labfreed-0.2.5a7}/labfreed/trex/python_convenience/quantity.py +7 -3
- {labfreed-0.2.5a5 → labfreed-0.2.5a7}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
- {labfreed-0.2.5a5 → labfreed-0.2.5a7}/.github/workflows/pypi-publish.yml +0 -0
- {labfreed-0.2.5a5 → labfreed-0.2.5a7}/.github/workflows/run-tests.yml +0 -0
- {labfreed-0.2.5a5 → labfreed-0.2.5a7}/CHANGELOG.md +0 -0
- {labfreed-0.2.5a5 → labfreed-0.2.5a7}/LICENSE +0 -0
- {labfreed-0.2.5a5 → labfreed-0.2.5a7}/README.md +0 -0
- {labfreed-0.2.5a5 → labfreed-0.2.5a7}/labfreed/labfreed_infrastructure.py +0 -0
- {labfreed-0.2.5a5 → labfreed-0.2.5a7}/labfreed/pac_cat/__init__.py +0 -0
- {labfreed-0.2.5a5 → labfreed-0.2.5a7}/labfreed/pac_cat/category_base.py +0 -0
- {labfreed-0.2.5a5 → labfreed-0.2.5a7}/labfreed/pac_cat/pac_cat.py +0 -0
- {labfreed-0.2.5a5 → labfreed-0.2.5a7}/labfreed/pac_cat/predefined_categories.py +0 -0
- {labfreed-0.2.5a5 → labfreed-0.2.5a7}/labfreed/pac_id/__init__.py +0 -0
- {labfreed-0.2.5a5 → labfreed-0.2.5a7}/labfreed/pac_id/extension.py +0 -0
- {labfreed-0.2.5a5 → labfreed-0.2.5a7}/labfreed/pac_id/id_segment.py +0 -0
- {labfreed-0.2.5a5 → labfreed-0.2.5a7}/labfreed/pac_id/pac_id.py +0 -0
- {labfreed-0.2.5a5 → labfreed-0.2.5a7}/labfreed/pac_id/url_parser.py +0 -0
- {labfreed-0.2.5a5 → labfreed-0.2.5a7}/labfreed/pac_id/url_serializer.py +0 -0
- {labfreed-0.2.5a5 → labfreed-0.2.5a7}/labfreed/pac_id_resolver/__init__.py +0 -0
- {labfreed-0.2.5a5 → labfreed-0.2.5a7}/labfreed/pac_id_resolver/cit_v1.py +0 -0
- {labfreed-0.2.5a5 → labfreed-0.2.5a7}/labfreed/pac_id_resolver/cit_v2.py +0 -0
- {labfreed-0.2.5a5 → labfreed-0.2.5a7}/labfreed/pac_id_resolver/resolver.py +0 -0
- {labfreed-0.2.5a5 → labfreed-0.2.5a7}/labfreed/pac_id_resolver/services.py +0 -0
- {labfreed-0.2.5a5 → labfreed-0.2.5a7}/labfreed/qr/__init__.py +0 -0
- {labfreed-0.2.5a5 → labfreed-0.2.5a7}/labfreed/qr/generate_qr.py +0 -0
- {labfreed-0.2.5a5 → labfreed-0.2.5a7}/labfreed/trex/__init__.py +0 -0
- {labfreed-0.2.5a5 → labfreed-0.2.5a7}/labfreed/trex/python_convenience/__init__.py +0 -0
- {labfreed-0.2.5a5 → labfreed-0.2.5a7}/labfreed/trex/python_convenience/pyTREX.py +0 -0
- {labfreed-0.2.5a5 → labfreed-0.2.5a7}/labfreed/trex/table_segment.py +0 -0
- {labfreed-0.2.5a5 → labfreed-0.2.5a7}/labfreed/trex/trex.py +0 -0
- {labfreed-0.2.5a5 → labfreed-0.2.5a7}/labfreed/trex/trex_base_models.py +0 -0
- {labfreed-0.2.5a5 → labfreed-0.2.5a7}/labfreed/trex/value_segments.py +0 -0
- {labfreed-0.2.5a5 → labfreed-0.2.5a7}/labfreed/utilities/base36.py +0 -0
- {labfreed-0.2.5a5 → labfreed-0.2.5a7}/labfreed/well_known_extensions/__init__.py +0 -0
- {labfreed-0.2.5a5 → labfreed-0.2.5a7}/labfreed/well_known_extensions/default_extension_interpreters.py +0 -0
- {labfreed-0.2.5a5 → labfreed-0.2.5a7}/labfreed/well_known_extensions/display_name_extension.py +0 -0
- {labfreed-0.2.5a5 → labfreed-0.2.5a7}/labfreed/well_known_extensions/trex_extension.py +0 -0
- {labfreed-0.2.5a5 → labfreed-0.2.5a7}/labfreed/well_known_keys/gs1/__init__.py +0 -0
- {labfreed-0.2.5a5 → labfreed-0.2.5a7}/labfreed/well_known_keys/gs1/gs1.py +0 -0
- {labfreed-0.2.5a5 → labfreed-0.2.5a7}/labfreed/well_known_keys/gs1/gs1_ai_enum_sorted.py +0 -0
- {labfreed-0.2.5a5 → labfreed-0.2.5a7}/labfreed/well_known_keys/labfreed/well_known_keys.py +0 -0
- {labfreed-0.2.5a5 → labfreed-0.2.5a7}/labfreed/well_known_keys/unece/UneceUnits.json +0 -0
- {labfreed-0.2.5a5 → labfreed-0.2.5a7}/labfreed/well_known_keys/unece/__init__.py +0 -0
- {labfreed-0.2.5a5 → labfreed-0.2.5a7}/labfreed/well_known_keys/unece/unece_units.py +0 -0
- {labfreed-0.2.5a5 → labfreed-0.2.5a7}/pyproject.toml +0 -0
|
@@ -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
|
-
|
|
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 {
|
|
47
|
+
raise ValueError(f'No UNECE unit code found for Quantity {q}' )
|
|
44
48
|
return code[0]
|
|
45
49
|
|
|
46
50
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{labfreed-0.2.5a5 → labfreed-0.2.5a7}/labfreed/well_known_extensions/display_name_extension.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|