labfreed 0.2.6a5__py3-none-any.whl → 0.2.6a6__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 +1 -1
- labfreed/pac_id_resolver/cit_v2.py +6 -1
- labfreed/pac_id_resolver/resolver.py +9 -5
- {labfreed-0.2.6a5.dist-info → labfreed-0.2.6a6.dist-info}/METADATA +1 -1
- {labfreed-0.2.6a5.dist-info → labfreed-0.2.6a6.dist-info}/RECORD +7 -7
- {labfreed-0.2.6a5.dist-info → labfreed-0.2.6a6.dist-info}/WHEEL +0 -0
- {labfreed-0.2.6a5.dist-info → labfreed-0.2.6a6.dist-info}/licenses/LICENSE +0 -0
labfreed/__init__.py
CHANGED
|
@@ -130,7 +130,12 @@ class CIT_v2(LabFREED_BaseModel):
|
|
|
130
130
|
|
|
131
131
|
@classmethod
|
|
132
132
|
def from_yaml(cls, yml:str) -> Self:
|
|
133
|
-
|
|
133
|
+
try:
|
|
134
|
+
d = yaml.safe_load(yml)
|
|
135
|
+
except yaml.YAMLError as e:
|
|
136
|
+
# not a valid yaml
|
|
137
|
+
raise ValueError("This is not a valid yaml") from e
|
|
138
|
+
return cls.model_validate(d)
|
|
134
139
|
|
|
135
140
|
def __str__(self):
|
|
136
141
|
yml = yaml.dump(self.model_dump() )
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
from functools import lru_cache
|
|
1
2
|
import logging
|
|
3
|
+
import traceback
|
|
2
4
|
from typing import Self
|
|
3
5
|
import yaml
|
|
4
6
|
from requests import get
|
|
@@ -24,11 +26,11 @@ def load_cit(path):
|
|
|
24
26
|
|
|
25
27
|
def cit_from_str(s:str, origin:str='') -> CIT_v1|CIT_v2:
|
|
26
28
|
try:
|
|
27
|
-
|
|
28
|
-
cit2 = CIT_v2.from_yaml(cit_yml)
|
|
29
|
+
cit2 = CIT_v2.from_yaml(s)
|
|
29
30
|
cit_version = 'v2'
|
|
30
31
|
except Exception:
|
|
31
32
|
cit2 = None
|
|
33
|
+
traceback.print_exc()
|
|
32
34
|
try:
|
|
33
35
|
cit1 = CIT_v1.from_csv(s, origin)
|
|
34
36
|
cit_version = 'v1'
|
|
@@ -38,6 +40,7 @@ def cit_from_str(s:str, origin:str='') -> CIT_v1|CIT_v2:
|
|
|
38
40
|
cit = cit2 or cit1 or None
|
|
39
41
|
return cit
|
|
40
42
|
|
|
43
|
+
@lru_cache
|
|
41
44
|
def _get_issuer_cit(issuer:str):
|
|
42
45
|
'''Gets the issuer's cit.'''
|
|
43
46
|
url = 'HTTPS://PAC.' + issuer + '/coupling-information-table'
|
|
@@ -64,15 +67,16 @@ class PAC_ID_Resolver():
|
|
|
64
67
|
self._cits = cits
|
|
65
68
|
|
|
66
69
|
|
|
67
|
-
def resolve(self, pac_url:PAC_ID|str, check_service_status=True) -> list[ServiceGroup]:
|
|
70
|
+
def resolve(self, pac_url:PAC_ID|str, check_service_status=True, use_issuer_cit=True) -> list[ServiceGroup]:
|
|
68
71
|
'''Resolve a PAC-ID'''
|
|
69
72
|
if isinstance(pac_url, str):
|
|
70
73
|
pac_id = PAC_CAT.from_url(pac_url)
|
|
71
74
|
pac_id_catless = PAC_ID.from_url(pac_url, try_pac_cat=False)
|
|
72
75
|
|
|
73
76
|
cits = self._cits.copy()
|
|
74
|
-
if
|
|
75
|
-
|
|
77
|
+
if use_issuer_cit:
|
|
78
|
+
if issuer_cit := _get_issuer_cit(pac_id.issuer):
|
|
79
|
+
cits.append(issuer_cit)
|
|
76
80
|
|
|
77
81
|
matches = []
|
|
78
82
|
for cit in cits:
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
labfreed/__init__.py,sha256=
|
|
1
|
+
labfreed/__init__.py,sha256=VzBgiJzKQujiC6y6Ge0JHS7huonkWqJ4725faVGhlvI,338
|
|
2
2
|
labfreed/labfreed_infrastructure.py,sha256=EPDSCaGxWakAoPpHyc6ltf-pOuKyS5829lj_EG6wa74,10072
|
|
3
3
|
labfreed/pac_cat/__init__.py,sha256=KNPtQzBD1XVohvG_ucOs7RJj-oi6biUTGB1k-T2o6pk,568
|
|
4
4
|
labfreed/pac_cat/category_base.py,sha256=lFQNiTUukyhWdaSCAI7CZxLtj6kNtnBCE4UsePwsGqE,1801
|
|
@@ -13,8 +13,8 @@ labfreed/pac_id/url_serializer.py,sha256=3D5pwcAP4ZrCQ22BRtxIwqWrFtZuY9913hCLPJN
|
|
|
13
13
|
labfreed/pac_id_resolver/__init__.py,sha256=RNBlrDOSR42gmSNH9wJVhK_xwEX45cvTKVgWW2bjh7Q,113
|
|
14
14
|
labfreed/pac_id_resolver/cit_common.py,sha256=xEkSSumj_IYgnXn3yKvoTBbgExnIfPY7E-RHU-7pcX8,2905
|
|
15
15
|
labfreed/pac_id_resolver/cit_v1.py,sha256=1dx0zqJfzFOE4kP8_i8EJSLhvjVovc_i9Bazb53B0fU,9548
|
|
16
|
-
labfreed/pac_id_resolver/cit_v2.py,sha256=
|
|
17
|
-
labfreed/pac_id_resolver/resolver.py,sha256=
|
|
16
|
+
labfreed/pac_id_resolver/cit_v2.py,sha256=wM1wf8UWbepatWNgkJ3l0l-HNJHqsqqPMql5k8fkVso,12127
|
|
17
|
+
labfreed/pac_id_resolver/resolver.py,sha256=qYL0FMsbvOU9Y6pUgialY9dWmBvCd_aSpX7ZQk3pDUM,2848
|
|
18
18
|
labfreed/pac_id_resolver/services.py,sha256=TPoH6YlSwa0hmawHpOiMwIpBAinhoRhMSoexop0YscI,2462
|
|
19
19
|
labfreed/qr/__init__.py,sha256=fdKwP6W2Js--yMbBUdn-g_2uq2VqPpfQJeDLHsMDO-Y,61
|
|
20
20
|
labfreed/qr/generate_qr.py,sha256=mSt-U872O3ReHB_UdS-MzYu0wRgdlKcAOEfTxg5CLRk,16616
|
|
@@ -39,7 +39,7 @@ labfreed/well_known_keys/labfreed/well_known_keys.py,sha256=nqk66kHdSwJTJfMKlP-x
|
|
|
39
39
|
labfreed/well_known_keys/unece/UneceUnits.json,sha256=kwfQSp_nTuWbADfBBgqTWrvPl6XtM5SedEVLbMJrM7M,898953
|
|
40
40
|
labfreed/well_known_keys/unece/__init__.py,sha256=MSP9lmjg9_D9iqG9Yq2_ajYfQSNS9wIT7FXA1c--59M,122
|
|
41
41
|
labfreed/well_known_keys/unece/unece_units.py,sha256=gNDQk6KGl-nGMf9Ycq_fQ8P2xxKITgLkcQWPd4H49gI,1630
|
|
42
|
-
labfreed-0.2.
|
|
43
|
-
labfreed-0.2.
|
|
44
|
-
labfreed-0.2.
|
|
45
|
-
labfreed-0.2.
|
|
42
|
+
labfreed-0.2.6a6.dist-info/licenses/LICENSE,sha256=gHFOv9FRKHxO8cInP3YXyPoJnuNeqrvcHjaE_wPSsQ8,1100
|
|
43
|
+
labfreed-0.2.6a6.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
|
|
44
|
+
labfreed-0.2.6a6.dist-info/METADATA,sha256=FuVqznBpKwp-zhER_-PH4NILKLXCe7CFX5rm3s3rGUU,18616
|
|
45
|
+
labfreed-0.2.6a6.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|