labfreed 0.0.10__tar.gz → 0.0.11__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.0.10 → labfreed-0.0.11}/PKG-INFO +1 -1
- labfreed-0.0.11/README.md +152 -0
- {labfreed-0.0.10 → labfreed-0.0.11}/labfreed/__init__.py +1 -1
- {labfreed-0.0.10 → labfreed-0.0.11}/publish.ps1 +1 -1
- {labfreed-0.0.10 → labfreed-0.0.11}/pyproject.toml +1 -1
- {labfreed-0.0.10 → labfreed-0.0.11}/update_readme.py +6 -4
- labfreed-0.0.10/README.md +0 -60
- {labfreed-0.0.10 → labfreed-0.0.11}/.vscode/launch.json +0 -0
- {labfreed-0.0.10 → labfreed-0.0.11}/.vscode/settings.json +0 -0
- {labfreed-0.0.10 → labfreed-0.0.11}/LICENSE +0 -0
- {labfreed-0.0.10 → labfreed-0.0.11}/examples.py +0 -0
- {labfreed-0.0.10 → labfreed-0.0.11}/labfreed/DisplayNameExtension/DisplayNameExtension.py +0 -0
- {labfreed-0.0.10 → labfreed-0.0.11}/labfreed/PAC_CAT/__init__.py +0 -0
- {labfreed-0.0.10 → labfreed-0.0.11}/labfreed/PAC_CAT/data_model copy.py +0 -0
- {labfreed-0.0.10 → labfreed-0.0.11}/labfreed/PAC_CAT/data_model.py +0 -0
- {labfreed-0.0.10 → labfreed-0.0.11}/labfreed/PAC_ID/__init__.py +0 -0
- {labfreed-0.0.10 → labfreed-0.0.11}/labfreed/PAC_ID/data_model.py +0 -0
- {labfreed-0.0.10 → labfreed-0.0.11}/labfreed/PAC_ID/extensions.py +0 -0
- {labfreed-0.0.10 → labfreed-0.0.11}/labfreed/TREX/UneceUnits.json +0 -0
- {labfreed-0.0.10 → labfreed-0.0.11}/labfreed/TREX/data_model.py +0 -0
- {labfreed-0.0.10 → labfreed-0.0.11}/labfreed/TREX/parse.py +0 -0
- {labfreed-0.0.10 → labfreed-0.0.11}/labfreed/TREX/unece_units.py +0 -0
- {labfreed-0.0.10 → labfreed-0.0.11}/labfreed/parse_pac.py +0 -0
- {labfreed-0.0.10 → labfreed-0.0.11}/labfreed/utilities/base36.py +0 -0
- {labfreed-0.0.10 → labfreed-0.0.11}/labfreed/utilities/extension_intertpreters.py +0 -0
- {labfreed-0.0.10 → labfreed-0.0.11}/labfreed/utilities/utility_types.py +0 -0
- {labfreed-0.0.10 → labfreed-0.0.11}/labfreed/utilities/well_known_keys.py +0 -0
- {labfreed-0.0.10 → labfreed-0.0.11}/labfreed/validation.py +0 -0
- {labfreed-0.0.10 → labfreed-0.0.11}/main.py +0 -0
- {labfreed-0.0.10 → labfreed-0.0.11}/publish.sh +0 -0
- {labfreed-0.0.10 → labfreed-0.0.11}/publish_commands +0 -0
- {labfreed-0.0.10 → labfreed-0.0.11}/pytest.ini +0 -0
- {labfreed-0.0.10 → labfreed-0.0.11}/tests/test_(de)_serialization_incl_extension/test__parse.py +0 -0
- {labfreed-0.0.10 → labfreed-0.0.11}/tests/test_(de)_serialization_incl_extension/test__serialize.py +0 -0
- {labfreed-0.0.10 → labfreed-0.0.11}/tests/test_PAC_CAT/test_PAC_CAT_parse.py +0 -0
- {labfreed-0.0.10 → labfreed-0.0.11}/tests/test_PAC_CAT/test_PAC_CAT_serialize.py +0 -0
- {labfreed-0.0.10 → labfreed-0.0.11}/tests/test_PAC_ID/test_PAC_ID_serialize.py +0 -0
- {labfreed-0.0.10 → labfreed-0.0.11}/tests/test_PAC_ID/test_pac_id_parse.py +0 -0
- {labfreed-0.0.10 → labfreed-0.0.11}/tests/test_TREX/test_TREX_parse.py +0 -0
- {labfreed-0.0.10 → labfreed-0.0.11}/tests/test_TREX/test_TREX_serialize.py +0 -0
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
# LabFREED for Python
|
|
2
|
+
|
|
3
|
+
[](LICENSE) [](https://pypi.org/project/labfreed/) 
|
|
4
|
+
|
|
5
|
+
<!--
|
|
6
|
+
[](https://github.com/retothuerer/LabFREED/actions/workflows/ci.yml)
|
|
7
|
+
-->
|
|
8
|
+
|
|
9
|
+
This is a Python implementation of [LabFREED](www.labfreed.wega-it.com) building blocks.
|
|
10
|
+
|
|
11
|
+
## Supported Building Blocks
|
|
12
|
+
- PAC-ID
|
|
13
|
+
- PAC-CAT
|
|
14
|
+
- TREX
|
|
15
|
+
- Display Extension
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
You can install LabFREED from [PyPI](https://pypi.org/project/labfreed/) using pip:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
pip install labfreed
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
## Usage Examples
|
|
26
|
+
<!-- BEGIN EXAMPLES -->
|
|
27
|
+
```python
|
|
28
|
+
from datetime import datetime
|
|
29
|
+
from typing import Annotated
|
|
30
|
+
|
|
31
|
+
# Parse a PAC ID
|
|
32
|
+
from labfreed.PAC_ID.data_model import PACID, IDSegment
|
|
33
|
+
from labfreed.parse_pac import PAC_Parser, PACID_With_Extensions
|
|
34
|
+
from utility_types import Quantity
|
|
35
|
+
pac_str = 'HTTPS://PAC.METTORIUS.COM/-MD/BAL500/1234'
|
|
36
|
+
pac = PAC_Parser().parse_pac_id(pac_str)
|
|
37
|
+
|
|
38
|
+
## Check validity
|
|
39
|
+
pac_str = 'HTTPS://PAC.METTORIUS.COM/-MD/bal500/@1234'
|
|
40
|
+
pac = PAC_Parser().parse_pac_id(pac_str)
|
|
41
|
+
is_valid = pac.is_valid()
|
|
42
|
+
print('PAC-ID is valid: {is_valid}')
|
|
43
|
+
|
|
44
|
+
# Show recommendations
|
|
45
|
+
pac.print_validation_messages()
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
## Parse a PAC-ID with extensions
|
|
51
|
+
pac_str = 'HTTPS://PAC.METTORIUS.COM/-MD/BAL500/1234*N$N/WM633OV3E5DGJW2BEG0PDM1EA7*SUM$TREX/WEIGHT$GRM:67.89'
|
|
52
|
+
pac = PAC_Parser().parse_pac_with_extensions(pac_str)
|
|
53
|
+
|
|
54
|
+
# Display Name
|
|
55
|
+
display_names = pac.get_extension('N')
|
|
56
|
+
print(f'\nDisplay names: {display_names}')
|
|
57
|
+
|
|
58
|
+
# TREX
|
|
59
|
+
from labfreed.TREX.data_model import TREX, ColumnHeader, TREX_Table, TableRow
|
|
60
|
+
trexes = pac.get_extension_of_type('TREX')
|
|
61
|
+
trex:TREX = trexes[0]
|
|
62
|
+
v = trex.get_segment('WEIGHT').to_python_type()
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
## Create a PAC-ID
|
|
68
|
+
from labfreed.utilities.well_known_keys import WellKnownKeys
|
|
69
|
+
pac = PACID(issuer='METTORIUS:COM', identifier=[IDSegment(key=WellKnownKeys.SERIAL, value='1234')])
|
|
70
|
+
pac_str = pac.serialize()
|
|
71
|
+
pac_str = pac.serialize()
|
|
72
|
+
print(pac_str)
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
# create a TREX
|
|
78
|
+
from labfreed.TREX.data_model import TREX, DateSegment, NumericSegment, BoolSegment, AlphanumericSegment, TextSegment, BinarySegment
|
|
79
|
+
|
|
80
|
+
trex = TREX(name_='DEMO-TREX')
|
|
81
|
+
|
|
82
|
+
trex.segments.append(DateSegment(key='START',value='20240505T1204'))
|
|
83
|
+
trex.segments.append(DateSegment(key='STOP', value=datetime(year=2024,month=5,day=5,hour=13,minute=6)) )
|
|
84
|
+
|
|
85
|
+
trex.segments.append(NumericSegment(key='TEMP',type='KEL', value=10.15) )
|
|
86
|
+
trex.segments.append(BoolSegment(key='OK', value=False) )
|
|
87
|
+
trex.segments.append(AlphanumericSegment(key='COMMENT', value='FOO') )
|
|
88
|
+
trex.segments.append(TextSegment(key='COMMENT2', value='🐯') )
|
|
89
|
+
trex.segments.append(TextSegment(key='COMMENT2', value='BAR') )
|
|
90
|
+
|
|
91
|
+
# if the sting is already in base36 you have to be explicit
|
|
92
|
+
from labfreed.utilities.base36 import base36
|
|
93
|
+
trex.segments.append(TextSegment(key='COMMENT3', value=base36('1URIOQ7')) )
|
|
94
|
+
|
|
95
|
+
# table
|
|
96
|
+
table = TREX_Table(key='TABLE',
|
|
97
|
+
column_headers=[
|
|
98
|
+
ColumnHeader(key='COL1', type='HUR'),
|
|
99
|
+
ColumnHeader(key='COL2', type='T.A'),
|
|
100
|
+
ColumnHeader(key='COL3', type='T.D'),
|
|
101
|
+
ColumnHeader(key='COL4', type='T.B')
|
|
102
|
+
],
|
|
103
|
+
data=[
|
|
104
|
+
TableRow()
|
|
105
|
+
])
|
|
106
|
+
trex.segments.append(table)
|
|
107
|
+
|
|
108
|
+
if trex.is_valid():
|
|
109
|
+
print(trex.data)
|
|
110
|
+
else:
|
|
111
|
+
trex.print_validation_messages()
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
p = PACID_With_Extensions(pac_id=pac, extensions=[trex])
|
|
115
|
+
print(p.serialize())
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
# for convenience a TREX can be created from a dict
|
|
122
|
+
trex2 = TREX(name_='DEMO-TREX2')
|
|
123
|
+
trex2.update(
|
|
124
|
+
{
|
|
125
|
+
'STOP': datetime(year=2024,month=5,day=5,hour=13,minute=6),
|
|
126
|
+
'TEMP': Quantity(value=10.15, unit_name='meter', unit_symbol='m'),
|
|
127
|
+
'OK':False,
|
|
128
|
+
'COMMENT': 'FOO',
|
|
129
|
+
'COMMENT2':'🐯'
|
|
130
|
+
}
|
|
131
|
+
)
|
|
132
|
+
|
|
133
|
+
d = trex2.dict()
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
```
|
|
144
|
+
<!-- END EXAMPLES -->
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
## Change Log
|
|
149
|
+
|
|
150
|
+
### v0.0.9
|
|
151
|
+
- supports PAC-ID, PAC-CAT, TREX and DisplayName
|
|
152
|
+
- ok-ish test coverage
|
|
@@ -12,7 +12,7 @@ dynamic = ["version", "description"]
|
|
|
12
12
|
[tool.flit.module]
|
|
13
13
|
name = "labfreed"
|
|
14
14
|
|
|
15
|
-
readme = "README.md"
|
|
15
|
+
readme = {file = "README.md", content-type = "text/markdown"}
|
|
16
16
|
requires-python = ">=3.10"
|
|
17
17
|
classifiers = [
|
|
18
18
|
"Programming Language :: Python :: 3",
|
|
@@ -2,15 +2,18 @@
|
|
|
2
2
|
start_marker = "<!-- BEGIN EXAMPLES -->"
|
|
3
3
|
end_marker = "<!-- END EXAMPLES -->"
|
|
4
4
|
|
|
5
|
-
with open("examples.py") as ex_file:
|
|
5
|
+
with open("examples.py", encoding='utf-8') as ex_file:
|
|
6
6
|
example_code = ex_file.read()
|
|
7
7
|
|
|
8
8
|
# Optional: Format as Markdown code block
|
|
9
9
|
example_code_md = f"```python\n{example_code}\n```"
|
|
10
10
|
|
|
11
|
-
with open("README.md") as readme_file:
|
|
11
|
+
with open("README.md", encoding='utf-8') as readme_file:
|
|
12
12
|
readme = readme_file.read()
|
|
13
13
|
|
|
14
|
+
if not readme:
|
|
15
|
+
raise ValueError('README.md is empty')
|
|
16
|
+
|
|
14
17
|
# Replace the section between markers
|
|
15
18
|
new_readme = (
|
|
16
19
|
readme.split(start_marker)[0]
|
|
@@ -19,7 +22,6 @@ new_readme = (
|
|
|
19
22
|
+ end_marker
|
|
20
23
|
+ readme.split(end_marker)[1]
|
|
21
24
|
)
|
|
22
|
-
new_readme.replace
|
|
23
25
|
|
|
24
|
-
with open("README.md", "w") as readme_file:
|
|
26
|
+
with open("README.md", "w", encoding='utf-8') as readme_file:
|
|
25
27
|
readme_file.write(new_readme)
|
labfreed-0.0.10/README.md
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
# LabFREED for Python
|
|
2
|
-
|
|
3
|
-
[](LICENSE) [](https://pypi.org/project/labfreed/) 
|
|
4
|
-
|
|
5
|
-
<!--
|
|
6
|
-
[](https://github.com/retothuerer/LabFREED/actions/workflows/ci.yml)
|
|
7
|
-
-->
|
|
8
|
-
|
|
9
|
-
This is a Python implementation of [LabFREED](www.labfreed.wega-it.com) building blocks.
|
|
10
|
-
|
|
11
|
-
## Supported Building Blocks
|
|
12
|
-
- PAC-ID
|
|
13
|
-
- PAC-CAT
|
|
14
|
-
- TREX
|
|
15
|
-
- Display Extension
|
|
16
|
-
|
|
17
|
-
## Installation
|
|
18
|
-
You can install LabFREED from [PyPI](https://pypi.org/project/labfreed/) using pip:
|
|
19
|
-
|
|
20
|
-
```bash
|
|
21
|
-
pip install labfreed
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
## Usage Examples
|
|
26
|
-
<!-- BEGIN EXAMPLES -->
|
|
27
|
-
```python
|
|
28
|
-
|
|
29
|
-
# Parse a PAC ID
|
|
30
|
-
from labfreed.PAC_ID.parse import PAC_Parser
|
|
31
|
-
pac_str = 'HTTPS://PAC.METTORIUS.COM/-MD/BAL500/1234'
|
|
32
|
-
pac = PAC_Parser().parse_pac_id(pac_str)
|
|
33
|
-
|
|
34
|
-
## Check validity
|
|
35
|
-
pac.is_valid()
|
|
36
|
-
pac.print_validation_messages()
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
## Parse a PAC-ID with extensions
|
|
40
|
-
from labfreed.utilities.extension_intertpreters import well_known_interpreters as extension_interpreters
|
|
41
|
-
pac_str = 'HTTPS://PAC.METTORIUS.COM/-MD/BAL500/1234*NAME$N/WM633OV3E5DGJW2BEG0PDM1EA7*SUM$TREX/WEIGHT$GRM:67.89'
|
|
42
|
-
pac = PAC_Parser(extension_interpreters).parse_pac_id(pac_str)
|
|
43
|
-
|
|
44
|
-
## Create a PAC-ID
|
|
45
|
-
|
|
46
|
-
## Create a PAC-ID and T-REX for a titration curve
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
<!-- END EXAMPLES -->
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
## Change Log
|
|
57
|
-
|
|
58
|
-
### v0.0.9
|
|
59
|
-
- supports PAC-ID, PAC-CAT, TREX and DisplayName
|
|
60
|
-
- ok-ish test coverage
|
|
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.0.10 → labfreed-0.0.11}/tests/test_(de)_serialization_incl_extension/test__parse.py
RENAMED
|
File without changes
|
{labfreed-0.0.10 → labfreed-0.0.11}/tests/test_(de)_serialization_incl_extension/test__serialize.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|