labfreed 1.0.0a2__tar.gz → 1.0.0a3__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.
Files changed (69) hide show
  1. {labfreed-1.0.0a2 → labfreed-1.0.0a3}/PKG-INFO +1 -1
  2. {labfreed-1.0.0a2 → labfreed-1.0.0a3}/labfreed/__init__.py +1 -1
  3. {labfreed-1.0.0a2 → labfreed-1.0.0a3}/labfreed/pac_attributes/client/client.py +9 -6
  4. {labfreed-1.0.0a2 → labfreed-1.0.0a3}/labfreed/pac_attributes/pythonic/excel_attribute_data_source.py +11 -4
  5. {labfreed-1.0.0a2 → labfreed-1.0.0a3}/labfreed/pac_attributes/server/attribute_data_sources.py +10 -4
  6. {labfreed-1.0.0a2 → labfreed-1.0.0a3}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
  7. {labfreed-1.0.0a2 → labfreed-1.0.0a3}/.github/workflows/pypi-publish.yml +0 -0
  8. {labfreed-1.0.0a2 → labfreed-1.0.0a3}/.github/workflows/run-tests.yml +0 -0
  9. {labfreed-1.0.0a2 → labfreed-1.0.0a3}/CHANGELOG.md +0 -0
  10. {labfreed-1.0.0a2 → labfreed-1.0.0a3}/LICENSE +0 -0
  11. {labfreed-1.0.0a2 → labfreed-1.0.0a3}/README.md +0 -0
  12. {labfreed-1.0.0a2 → labfreed-1.0.0a3}/labfreed/labfreed_extended/app/app_infrastructure.py +0 -0
  13. {labfreed-1.0.0a2 → labfreed-1.0.0a3}/labfreed/labfreed_extended/app/formatted_print.py +0 -0
  14. {labfreed-1.0.0a2 → labfreed-1.0.0a3}/labfreed/labfreed_extended/app/pac_info.py +0 -0
  15. {labfreed-1.0.0a2 → labfreed-1.0.0a3}/labfreed/labfreed_infrastructure.py +0 -0
  16. {labfreed-1.0.0a2 → labfreed-1.0.0a3}/labfreed/pac_attributes/__init__.py +0 -0
  17. {labfreed-1.0.0a2 → labfreed-1.0.0a3}/labfreed/pac_attributes/api_data_models/request.py +0 -0
  18. {labfreed-1.0.0a2 → labfreed-1.0.0a3}/labfreed/pac_attributes/api_data_models/response.py +0 -0
  19. {labfreed-1.0.0a2 → labfreed-1.0.0a3}/labfreed/pac_attributes/api_data_models/server_capabilities_response.py +0 -0
  20. {labfreed-1.0.0a2 → labfreed-1.0.0a3}/labfreed/pac_attributes/client/__init__.py +0 -0
  21. {labfreed-1.0.0a2 → labfreed-1.0.0a3}/labfreed/pac_attributes/client/attribute_cache.py +0 -0
  22. {labfreed-1.0.0a2 → labfreed-1.0.0a3}/labfreed/pac_attributes/pythonic/attribute_server_factory.py +0 -0
  23. {labfreed-1.0.0a2 → labfreed-1.0.0a3}/labfreed/pac_attributes/pythonic/py_attributes.py +0 -0
  24. {labfreed-1.0.0a2 → labfreed-1.0.0a3}/labfreed/pac_attributes/pythonic/py_dict_data_source.py +0 -0
  25. {labfreed-1.0.0a2 → labfreed-1.0.0a3}/labfreed/pac_attributes/server/__init__.py +0 -0
  26. {labfreed-1.0.0a2 → labfreed-1.0.0a3}/labfreed/pac_attributes/server/server.py +0 -0
  27. {labfreed-1.0.0a2 → labfreed-1.0.0a3}/labfreed/pac_attributes/server/translation_data_sources.py +0 -0
  28. {labfreed-1.0.0a2 → labfreed-1.0.0a3}/labfreed/pac_attributes/well_knonw_attribute_keys.py +0 -0
  29. {labfreed-1.0.0a2 → labfreed-1.0.0a3}/labfreed/pac_cat/__init__.py +0 -0
  30. {labfreed-1.0.0a2 → labfreed-1.0.0a3}/labfreed/pac_cat/category_base.py +0 -0
  31. {labfreed-1.0.0a2 → labfreed-1.0.0a3}/labfreed/pac_cat/pac_cat.py +0 -0
  32. {labfreed-1.0.0a2 → labfreed-1.0.0a3}/labfreed/pac_cat/predefined_categories.py +0 -0
  33. {labfreed-1.0.0a2 → labfreed-1.0.0a3}/labfreed/pac_id/__init__.py +0 -0
  34. {labfreed-1.0.0a2 → labfreed-1.0.0a3}/labfreed/pac_id/extension.py +0 -0
  35. {labfreed-1.0.0a2 → labfreed-1.0.0a3}/labfreed/pac_id/id_segment.py +0 -0
  36. {labfreed-1.0.0a2 → labfreed-1.0.0a3}/labfreed/pac_id/pac_id.py +0 -0
  37. {labfreed-1.0.0a2 → labfreed-1.0.0a3}/labfreed/pac_id/url_parser.py +0 -0
  38. {labfreed-1.0.0a2 → labfreed-1.0.0a3}/labfreed/pac_id/url_serializer.py +0 -0
  39. {labfreed-1.0.0a2 → labfreed-1.0.0a3}/labfreed/pac_id_resolver/__init__.py +0 -0
  40. {labfreed-1.0.0a2 → labfreed-1.0.0a3}/labfreed/pac_id_resolver/cit_common.py +0 -0
  41. {labfreed-1.0.0a2 → labfreed-1.0.0a3}/labfreed/pac_id_resolver/cit_v1.py +0 -0
  42. {labfreed-1.0.0a2 → labfreed-1.0.0a3}/labfreed/pac_id_resolver/cit_v2.py +0 -0
  43. {labfreed-1.0.0a2 → labfreed-1.0.0a3}/labfreed/pac_id_resolver/resolver.py +0 -0
  44. {labfreed-1.0.0a2 → labfreed-1.0.0a3}/labfreed/pac_id_resolver/services.py +0 -0
  45. {labfreed-1.0.0a2 → labfreed-1.0.0a3}/labfreed/qr/__init__.py +0 -0
  46. {labfreed-1.0.0a2 → labfreed-1.0.0a3}/labfreed/qr/generate_qr.py +0 -0
  47. {labfreed-1.0.0a2 → labfreed-1.0.0a3}/labfreed/trex/__init__.py +0 -0
  48. {labfreed-1.0.0a2 → labfreed-1.0.0a3}/labfreed/trex/pythonic/__init__.py +0 -0
  49. {labfreed-1.0.0a2 → labfreed-1.0.0a3}/labfreed/trex/pythonic/data_table.py +0 -0
  50. {labfreed-1.0.0a2 → labfreed-1.0.0a3}/labfreed/trex/pythonic/pyTREX.py +0 -0
  51. {labfreed-1.0.0a2 → labfreed-1.0.0a3}/labfreed/trex/pythonic/quantity.py +0 -0
  52. {labfreed-1.0.0a2 → labfreed-1.0.0a3}/labfreed/trex/table_segment.py +0 -0
  53. {labfreed-1.0.0a2 → labfreed-1.0.0a3}/labfreed/trex/trex.py +0 -0
  54. {labfreed-1.0.0a2 → labfreed-1.0.0a3}/labfreed/trex/trex_base_models.py +0 -0
  55. {labfreed-1.0.0a2 → labfreed-1.0.0a3}/labfreed/trex/value_segments.py +0 -0
  56. {labfreed-1.0.0a2 → labfreed-1.0.0a3}/labfreed/utilities/base36.py +0 -0
  57. {labfreed-1.0.0a2 → labfreed-1.0.0a3}/labfreed/utilities/ensure_utc_time.py +0 -0
  58. {labfreed-1.0.0a2 → labfreed-1.0.0a3}/labfreed/utilities/translations.py +0 -0
  59. {labfreed-1.0.0a2 → labfreed-1.0.0a3}/labfreed/well_known_extensions/__init__.py +0 -0
  60. {labfreed-1.0.0a2 → labfreed-1.0.0a3}/labfreed/well_known_extensions/default_extension_interpreters.py +0 -0
  61. {labfreed-1.0.0a2 → labfreed-1.0.0a3}/labfreed/well_known_extensions/display_name_extension.py +0 -0
  62. {labfreed-1.0.0a2 → labfreed-1.0.0a3}/labfreed/well_known_extensions/trex_extension.py +0 -0
  63. {labfreed-1.0.0a2 → labfreed-1.0.0a3}/labfreed/well_known_keys/gs1/__init__.py +0 -0
  64. {labfreed-1.0.0a2 → labfreed-1.0.0a3}/labfreed/well_known_keys/gs1/gs1_ai_enum_sorted.py +0 -0
  65. {labfreed-1.0.0a2 → labfreed-1.0.0a3}/labfreed/well_known_keys/labfreed/well_known_keys.py +0 -0
  66. {labfreed-1.0.0a2 → labfreed-1.0.0a3}/labfreed/well_known_keys/unece/UneceUnits.json +0 -0
  67. {labfreed-1.0.0a2 → labfreed-1.0.0a3}/labfreed/well_known_keys/unece/__init__.py +0 -0
  68. {labfreed-1.0.0a2 → labfreed-1.0.0a3}/labfreed/well_known_keys/unece/unece_units.py +0 -0
  69. {labfreed-1.0.0a2 → labfreed-1.0.0a3}/pyproject.toml +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: labfreed
3
- Version: 1.0.0a2
3
+ Version: 1.0.0a3
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
@@ -2,7 +2,7 @@
2
2
  Python implementation of LabFREED building blocks
3
3
  '''
4
4
 
5
- __version__ = "1.0.0a2"
5
+ __version__ = "1.0.0a3"
6
6
 
7
7
  from labfreed.pac_id import * # noqa: F403
8
8
  from labfreed.pac_cat import * # noqa: F403
@@ -144,8 +144,9 @@ class AttributeClient():
144
144
 
145
145
 
146
146
  # update cache
147
+ attribute_groups_out = []
147
148
  for ag_for_pac in r.pac_attributes:
148
- pac = PAC_ID.from_url(ag_for_pac.pac_id)
149
+ pac_from_response = PAC_ID.from_url(ag_for_pac.pac_id)
149
150
  ags = [
150
151
  CacheableAttributeGroup(
151
152
  key= ag.key,
@@ -156,13 +157,15 @@ class AttributeClient():
156
157
  state_of=ag.state_of)
157
158
  for ag in ag_for_pac.attribute_groups
158
159
  ]
159
- self.cache_store.update(server_url, pac, ags)
160
+ self.cache_store.update(server_url, pac_from_response, ags)
160
161
 
161
- if pac_id == pac:
162
+ # compare pac_id from response with pac_id we need attributes for.
163
+ # if identical this is the part of the response we care about. other PAC-ID are just for the cache
164
+ if pac_id.to_url() == pac_from_response.to_url():
162
165
  attribute_groups_out = ags
163
- return attribute_groups_out
164
- else:
165
- return []
166
+
167
+ return attribute_groups_out
168
+
166
169
 
167
170
 
168
171
 
@@ -10,6 +10,7 @@ from cachetools import TTLCache, cached
10
10
  from labfreed.pac_attributes.api_data_models.response import AttributeGroup
11
11
  from labfreed.pac_attributes.pythonic.py_attributes import pyAttribute, pyAttributes
12
12
  from labfreed.pac_attributes.server.server import AttributeGroupDataSource
13
+ from labfreed.pac_cat.pac_cat import PAC_CAT
13
14
 
14
15
  try:
15
16
  from openpyxl import load_workbook
@@ -74,8 +75,9 @@ class _BaseExcelAttributeDataSource(AttributeGroupDataSource):
74
75
  Subclasses implement `_read_rows_and_last_changed()`.
75
76
  """
76
77
 
77
- def __init__(self, *, base_url: str = "", cache_duration_seconds: int = 0, **kwargs):
78
+ def __init__(self, *, base_url: str = "", cache_duration_seconds: int = 0, uses_pac_cat_short_form:bool=True, **kwargs):
78
79
  self._base_url = base_url
80
+ self._uses_pac_cat_short_form = uses_pac_cat_short_form
79
81
  # allow instance-level TTL override
80
82
  try:
81
83
  _cache.ttl = int(cache_duration_seconds)
@@ -96,9 +98,14 @@ class _BaseExcelAttributeDataSource(AttributeGroupDataSource):
96
98
  return []
97
99
  return [self._base_url + r for r in rows[0][1:]]
98
100
 
99
- def attributes(self, pac_url: str) -> Optional[AttributeGroup]:
100
- if not self._include_extensions:
101
- pac_url = pac_url.split('*')[0]
101
+ def attributes(self, pac_url:str) -> Optional[AttributeGroup]:
102
+ try:
103
+ p = PAC_CAT.from_url(pac_url)
104
+ pac_url = p.to_url(use_short_notation=self._uses_pac_cat_short_form, include_extensions=self._include_extensions)
105
+ print(f'Lookup in Excel of {pac_url}')
106
+ except:
107
+ ... # might as well try to match the original input
108
+
102
109
  rows, last_changed = self._read_rows_and_last_changed()
103
110
  d = _get_row_by_first_cell(rows, pac_url, self._base_url)
104
111
  if not d:
@@ -1,6 +1,8 @@
1
1
  from abc import ABC, abstractmethod, abstractproperty
2
2
  from datetime import datetime, timezone
3
3
  from labfreed.pac_attributes.api_data_models.response import VALID_FOREVER, AttributeBase, AttributeGroup
4
+ from labfreed.pac_cat.pac_cat import PAC_CAT
5
+ from labfreed.pac_id.pac_id import PAC_ID
4
6
 
5
7
 
6
8
  class AttributeGroupDataSource(ABC):
@@ -29,12 +31,13 @@ class AttributeGroupDataSource(ABC):
29
31
 
30
32
 
31
33
  class Dict_DataSource(AttributeGroupDataSource):
32
- def __init__(self, data:dict[str, list[AttributeBase]], *args, **kwargs):
34
+ def __init__(self, data:dict[str, list[AttributeBase]], uses_pac_cat_short_form=True, *args, **kwargs):
33
35
  if not all([isinstance(e, list) for e in data.values()]):
34
36
  raise ValueError('Invalid data')
35
37
 
36
38
  self._data = data
37
39
  self._state_of = datetime.now(tz=timezone.utc)
40
+ self.uses_pac_cat_short_form = uses_pac_cat_short_form
38
41
 
39
42
  super().__init__(*args, **kwargs)
40
43
 
@@ -45,9 +48,12 @@ class Dict_DataSource(AttributeGroupDataSource):
45
48
 
46
49
 
47
50
  def attributes(self, pac_url: str) -> AttributeGroup:
48
- if not self._include_extensions:
49
- pac_url = pac_url.split('*')[0]
50
-
51
+ try:
52
+ p = PAC_CAT.from_url(pac_url)
53
+ pac_url = p.to_url(use_short_notation=self.uses_pac_cat_short_form, include_extensions=self._include_extensions)
54
+ except:
55
+ ... # might as well try to match the original input
56
+
51
57
  attributes = self._data.get(pac_url)
52
58
  if not attributes:
53
59
  return None
File without changes
File without changes
File without changes
File without changes