labfreed 1.0.0a22__py3-none-any.whl → 1.0.0a24__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__ = "1.0.0a22"
5
+ __version__ = "1.0.0a24"
6
6
 
7
7
  from labfreed.pac_id import * # noqa: F403
8
8
  from labfreed.pac_cat import * # noqa: F403
@@ -82,10 +82,13 @@ class IssuerFlaskAppFactory():
82
82
  app_secret:str|None = None,
83
83
  pac_info_extender:PacInfoExtender|None = None,
84
84
  resolver_macros:dict[str, str] = None,
85
- use_issuer_resolver_config=True,
85
+ use_issuer_resolver_config=False,
86
86
  feature_flags:dict|None = None):
87
87
 
88
88
  app = Flask(__name__, static_folder=None, static_url_path='/static')
89
+
90
+ if not feature_flags:
91
+ feature_flags = dict()
89
92
  app.config['feature_flags'] = feature_flags
90
93
 
91
94
  app.wsgi_app = ProxyFix(app.wsgi_app, x_proto=1, x_host=1)
@@ -115,7 +118,7 @@ class IssuerFlaskAppFactory():
115
118
  path_to_custom_resources:str|None = None,
116
119
  pac_info_extender:PacInfoExtender|None = None,
117
120
  resolver_macros:dict[str, str] = None,
118
- use_issuer_resolver_config=True):
121
+ use_issuer_resolver_config=False):
119
122
 
120
123
  logging.info('initializing Blueprint')
121
124
 
@@ -112,7 +112,7 @@ class pyAttributes(RootModel[list[pyAttribute]]):
112
112
 
113
113
  elif isinstance(first_value, str):
114
114
  # capture quantities in the form of "100.0e5 g/L"
115
- if Quantity.from_str_with_unit(first_value):
115
+ if Quantity.can_convert_to_quantity(first_value):
116
116
  values = []
117
117
  for v in value_list:
118
118
  q = Quantity.from_str_with_unit(v)
@@ -65,9 +65,19 @@ class Quantity(BaseModel):
65
65
  q = Quantity(value = num_val, unit=unit, log_least_significant_digit=log_least_significant_digit)
66
66
  return q
67
67
 
68
+ @classmethod
69
+ def can_convert_to_quantity(cls, value:str):
70
+ ''' assumes value and unit are separated by " " '''
71
+ m = re.match(r'^\s*(?P<mantissa>-?\d+(\.\d+)?)([Ee]-?(?P<exponent>\d+))?\s+(?P<unit>\S+)\s*$', value)
72
+ return bool(m)
73
+
68
74
  @classmethod
69
75
  def from_str_with_unit(cls, value:str):
70
76
  ''' assumes value and unit are separated by " " '''
77
+ m = re.match(r'^\s*(?P<mantissa>-?\d+(\.\d+)?)([Ee]-?(?P<exponent>\d+))?\s+(?P<unit>\S+)\s*$', value)
78
+ if not m:
79
+ print(f'{value} cannot be converted to Quantity')
80
+ return None
71
81
  try:
72
82
  parts = value.strip().split(' ', 1)
73
83
  if len(parts) == 2:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: labfreed
3
- Version: 1.0.0a22
3
+ Version: 1.0.0a24
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=ms99ZcsB1o6YUpXuP8IiPF0GLSYyATYh_lx8NuJXGfo,339
1
+ labfreed/__init__.py,sha256=YJ0OVJt08uSlo0RzxUJM71nyql81qOyOpLqVVSxh_o4,339
2
2
  labfreed/labfreed_infrastructure.py,sha256=ss1PyJl-7Es-lEcxptmdYI9kDAHmh7HB_tAGkPC6UVs,10173
3
3
  labfreed/labfreed_extended/app/app_infrastructure.py,sha256=z3pxqYPgH8MFZJB2pR2mblpB7VrawQbXWJmz2nrZ6ZA,4581
4
4
  labfreed/labfreed_extended/app/formatted_print.py,sha256=DcwWP0ix1e_wYNIdceIp6cETkJdG2DqpU8Gs3aZAL40,1930
@@ -8,7 +8,7 @@ labfreed/labfreed_extended/app/pac_info/html_renderer/macros.jinja.html,sha256=1
8
8
  labfreed/labfreed_extended/app/pac_info/html_renderer/pac-info-style.css,sha256=C5pyD956fd6pJgUBjGxvxgL0Wbgq0v7ZLY4Vr-sJZ7A,4169
9
9
  labfreed/labfreed_extended/app/pac_info/html_renderer/pac_info.jinja.html,sha256=njXE9xexFdMlX65eDiwqE8PzbMATUOJAbwBCh5JvahY,1293
10
10
  labfreed/labfreed_extended/app/pac_info/html_renderer/pac_info_card.jinja.html,sha256=6UdsZtqJ3soSAYTKN43OB1Onm93WYz23TfM2GBYzJ-U,152
11
- labfreed/labfreed_extended/pac_issuer_lib/app_factory.py,sha256=Ezk32_YBdWOABMaSvnz0weP6aVSy-yxG1XhBdkofFQk,19993
11
+ labfreed/labfreed_extended/pac_issuer_lib/app_factory.py,sha256=eeIaiCTXV7_aWwDgWhGVjDY4O9uSQoyDQl7YSXVhmA0,20072
12
12
  labfreed/labfreed_extended/pac_issuer_lib/lib/attribute.py,sha256=BH6yJNFrfEK6dcn7GSPKbfz-0wcJ0NEXrku1e18hVuQ,6797
13
13
  labfreed/labfreed_extended/pac_issuer_lib/lib/bp_landing_page.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
14
  labfreed/labfreed_extended/pac_issuer_lib/lib/utils.py,sha256=aUdJGFLx1HDDXGRqMVJuGn7uqzNXHrEb7cCA-nX920Y,651
@@ -49,7 +49,7 @@ labfreed/pac_attributes/client/attribute_cache.py,sha256=ThUadWqQ5oM8DnAnvZuY4je
49
49
  labfreed/pac_attributes/client/client.py,sha256=AgOrk4tnn5txO50LCmJlhniazxkfeH8U-8yytGB58AM,7527
50
50
  labfreed/pac_attributes/pythonic/attribute_server_factory.py,sha256=t3ARmsXdbdQ0QAgRkdHT_ScmpZhXzz3lZkN0WovzygQ,6174
51
51
  labfreed/pac_attributes/pythonic/excel_attribute_data_source.py,sha256=VEYrSb2r62GJeECc42ppTwZXsYJ-1oHoHQz7HbcM-_Y,8461
52
- labfreed/pac_attributes/pythonic/py_attributes.py,sha256=nhFGg7VPNI9ksNsbkSU6AzhuEf0GdFTIOxtPBZRjr9w,8707
52
+ labfreed/pac_attributes/pythonic/py_attributes.py,sha256=SsZfrCjd6FJFDe_pmpKJQ2PGrpDfNacHlUzFDBxjWwc,8712
53
53
  labfreed/pac_attributes/pythonic/py_dict_data_source.py,sha256=nAz6GA7Xx_0IORPPpt_Wl3sFJa1Q5Fnq5vdf1uQiJF8,531
54
54
  labfreed/pac_attributes/server/__init__.py,sha256=JvQ2kpQx62OUwP18bGhOWYU9an_nQW59Y8Lh7HyfVxY,301
55
55
  labfreed/pac_attributes/server/attribute_data_sources.py,sha256=Jx7hFFoiMZmGcSHMEYv5PVf7PFn6iiGIz6uAAjsxswI,2348
@@ -81,7 +81,7 @@ labfreed/trex/value_segments.py,sha256=_fbDHDRfo7pxIWpzcbyjppv1VNd8Tnd-VXhbd6igI
81
81
  labfreed/trex/pythonic/__init__.py,sha256=dyAQG7t-uYN6VfGXbWIq2bHxGcGI63l7FS2-VPYs2RQ,137
82
82
  labfreed/trex/pythonic/data_table.py,sha256=KGyA5hRdDOOkJB0EOyjmzbbMusgYkBB_2SIFzrJ25yI,3148
83
83
  labfreed/trex/pythonic/pyTREX.py,sha256=wWYYb9pyZB01ObGOHf8gXzvMyAGzuCTduHzP03yvKj8,10157
84
- labfreed/trex/pythonic/quantity.py,sha256=jmhHfmEclYBQ1cLmOtmV7Ull4S0qHKIYVE0uhtNFFz0,5441
84
+ labfreed/trex/pythonic/quantity.py,sha256=8WpJ73EgOdWin25R-zx8y_Tumt1sbYHFmx0dGES41Ew,5930
85
85
  labfreed/utilities/base36.py,sha256=_yX8aQ1OwrK5tnJU1NUEzQSFGr9xAVnNvPObpNzCPYs,2895
86
86
  labfreed/utilities/ensure_utc_time.py,sha256=1ZTTzyIt7IimQ4ArTzdgw5hxiabkkplltbQe3Wdt2ZQ,307
87
87
  labfreed/utilities/translations.py,sha256=XY4Wud_BfXswUOpebdh0U_D2bMzb2vqluuGWzFK-3uU,1851
@@ -96,7 +96,7 @@ labfreed/well_known_keys/labfreed/well_known_keys.py,sha256=p-hXwEEIs7p2SKn9DQeL
96
96
  labfreed/well_known_keys/unece/UneceUnits.json,sha256=kwfQSp_nTuWbADfBBgqTWrvPl6XtM5SedEVLbMJrM7M,898953
97
97
  labfreed/well_known_keys/unece/__init__.py,sha256=MSP9lmjg9_D9iqG9Yq2_ajYfQSNS9wIT7FXA1c--59M,122
98
98
  labfreed/well_known_keys/unece/unece_units.py,sha256=J20d64H69qKDE3XlGdJoXIIh0G-d0jKoiIDsg9an5pk,1655
99
- labfreed-1.0.0a22.dist-info/licenses/LICENSE,sha256=gHFOv9FRKHxO8cInP3YXyPoJnuNeqrvcHjaE_wPSsQ8,1100
100
- labfreed-1.0.0a22.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
101
- labfreed-1.0.0a22.dist-info/METADATA,sha256=DcbGgkdbyV63M41BScw5aTLXaqe896ASS0RJoy_I33w,19858
102
- labfreed-1.0.0a22.dist-info/RECORD,,
99
+ labfreed-1.0.0a24.dist-info/licenses/LICENSE,sha256=gHFOv9FRKHxO8cInP3YXyPoJnuNeqrvcHjaE_wPSsQ8,1100
100
+ labfreed-1.0.0a24.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
101
+ labfreed-1.0.0a24.dist-info/METADATA,sha256=EczsCKycg7KL5b5uX61-3KzgTpZl_bg1hkn2gb1GLL0,19858
102
+ labfreed-1.0.0a24.dist-info/RECORD,,