DLMS-SPODES 0.86.14__py3-none-any.whl → 0.86.15__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.
- DLMS_SPODES/cosem_interface_classes/collection.py +16 -13
- DLMS_SPODES/cosem_interface_classes/cosem_interface_class.py +3 -2
- {dlms_spodes-0.86.14.dist-info → dlms_spodes-0.86.15.dist-info}/METADATA +3 -2
- {dlms_spodes-0.86.14.dist-info → dlms_spodes-0.86.15.dist-info}/RECORD +6 -6
- {dlms_spodes-0.86.14.dist-info → dlms_spodes-0.86.15.dist-info}/WHEEL +0 -0
- {dlms_spodes-0.86.14.dist-info → dlms_spodes-0.86.15.dist-info}/top_level.txt +0 -0
|
@@ -669,7 +669,7 @@ class Collection:
|
|
|
669
669
|
spec_map: str
|
|
670
670
|
|
|
671
671
|
def __init__(self,
|
|
672
|
-
id_: ID
|
|
672
|
+
id_: ID,
|
|
673
673
|
dlms_ver: int = 6,
|
|
674
674
|
country: CountrySpecificIdentifiers = None,
|
|
675
675
|
cntr_ver: ParameterValue = None):
|
|
@@ -867,19 +867,22 @@ class Collection:
|
|
|
867
867
|
""" get object, return None if it absence """
|
|
868
868
|
return self.__objs.get(obis, None)
|
|
869
869
|
|
|
870
|
-
def par2obj(self, par: Parameter) -> InterfaceClass:
|
|
870
|
+
def par2obj(self, par: Parameter) -> result.Simple[InterfaceClass] | result.Error:
|
|
871
871
|
"""return: DLMSObject"""
|
|
872
|
-
if
|
|
873
|
-
return
|
|
874
|
-
|
|
872
|
+
if obj := self.__objs.get(par.obis):
|
|
873
|
+
return result.Simple(obj)
|
|
874
|
+
return result.Error.from_e(exc.NoObject(f"with {par=}"))
|
|
875
875
|
|
|
876
|
-
def par2data(self, par: Parameter) ->
|
|
876
|
+
def par2data(self, par: Parameter) -> result.Option[cdt.CommonDataType] | result.Error:
|
|
877
877
|
""":return CDT by Parameter, return None if data wasn't setting"""
|
|
878
|
-
if (
|
|
879
|
-
return
|
|
878
|
+
if isinstance((res1 := self.par2obj(par)), result.Error):
|
|
879
|
+
return res1
|
|
880
|
+
res = result.Option(res1.value.get_attr(par.i))
|
|
881
|
+
if res.value is None:
|
|
882
|
+
return res
|
|
880
883
|
for el in par.elements():
|
|
881
|
-
|
|
882
|
-
return
|
|
884
|
+
res.value = res.value.a_data[el]
|
|
885
|
+
return res
|
|
883
886
|
|
|
884
887
|
def values(self) -> tuple[InterfaceClass]:
|
|
885
888
|
return tuple(self.__objs.values())
|
|
@@ -1009,7 +1012,7 @@ class Collection:
|
|
|
1009
1012
|
else:
|
|
1010
1013
|
rep.log = cdt.Log(logging.ERROR, F"absent script with ID: {data.script_selector}")
|
|
1011
1014
|
else:
|
|
1012
|
-
obj = self.par2obj(par)
|
|
1015
|
+
obj = self.par2obj(par).unwrap()
|
|
1013
1016
|
elements = tuple(par.elements())
|
|
1014
1017
|
if unit := get_unit(obj.CLASS_ID, elements):
|
|
1015
1018
|
rep.unit = cdt.Unit(unit).get_name()
|
|
@@ -1070,7 +1073,7 @@ class Collection:
|
|
|
1070
1073
|
def par2su(self, par: Parameter) -> Optional[cdt.ScalUnitType]:
|
|
1071
1074
|
"""convert Parameter -> Optional[ScalerUnit],
|
|
1072
1075
|
raise: NoObject, EmptyAttribute"""
|
|
1073
|
-
match (obj := self.par2obj(par)).CLASS_ID, par.i:
|
|
1076
|
+
match (obj := self.par2obj(par).unwrap()).CLASS_ID, par.i:
|
|
1074
1077
|
case (exc.NoObject, _):
|
|
1075
1078
|
raise obj
|
|
1076
1079
|
case (ClassID.REGISTER | ClassID.EXT_REGISTER, 2) | (ClassID.DEMAND_REGISTER, 2 | 3):
|
|
@@ -1099,7 +1102,7 @@ class Collection:
|
|
|
1099
1102
|
|
|
1100
1103
|
def par2float(self, par: Parameter) -> float:
|
|
1101
1104
|
"""try convert CDT value according with Parameter to build-in float"""
|
|
1102
|
-
data = self.par2data(par)
|
|
1105
|
+
data = self.par2data(par).unwrap()
|
|
1103
1106
|
if hasattr(data, "__int__"):
|
|
1104
1107
|
value = float(int(data))
|
|
1105
1108
|
elif hasattr(data, "__float__"):
|
|
@@ -6,6 +6,7 @@ from functools import lru_cache
|
|
|
6
6
|
from typing_extensions import deprecated
|
|
7
7
|
from typing import Iterator, Type, TypeAlias, Callable, Any, Self, Literal, Optional, Protocol
|
|
8
8
|
from ..types import cdt, ut, cst
|
|
9
|
+
from StructResult import result
|
|
9
10
|
from ..relation_to_OBIS import get_name
|
|
10
11
|
import logging
|
|
11
12
|
from enum import IntEnum
|
|
@@ -374,10 +375,10 @@ class COSEMInterfaceClasses(Protocol):
|
|
|
374
375
|
# print(cls.__name__)
|
|
375
376
|
|
|
376
377
|
@classmethod
|
|
377
|
-
def
|
|
378
|
+
def getAElement(cls, i: int) -> result.Simple[ICAElement] | result.Error:
|
|
378
379
|
"""return element by order index. Override in each new class"""
|
|
379
380
|
if i == 1:
|
|
380
|
-
return _LN_ELEMENT
|
|
381
|
+
return result.Simple(_LN_ELEMENT)
|
|
381
382
|
elif i > len(cls.A_ELEMENTS) + 1:
|
|
382
383
|
raise exc.DLMSException(F"got attribute index: {i}, expected 1..{len(cls.A_ELEMENTS) + 1}")
|
|
383
384
|
else:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: DLMS_SPODES
|
|
3
|
-
Version: 0.86.
|
|
3
|
+
Version: 0.86.15
|
|
4
4
|
Summary: dlms-spodes
|
|
5
5
|
Author-email: Serj Kotilevski <youserj@outlook.com>
|
|
6
6
|
Project-URL: Source, https://github.com/youserj/DlmsSPODES-project
|
|
@@ -14,7 +14,8 @@ Requires-Dist: pydantic>=2.11
|
|
|
14
14
|
Requires-Dist: cryptography>=45.0
|
|
15
15
|
Requires-Dist: semver>=3.0
|
|
16
16
|
Requires-Dist: typing-extensions>=4.12.2
|
|
17
|
-
Requires-Dist: StructResult>=0.8.
|
|
17
|
+
Requires-Dist: StructResult>=0.8.2
|
|
18
|
+
Requires-Dist: numpy>=2.3.2
|
|
18
19
|
Provides-Extra: dev
|
|
19
20
|
Requires-Dist: mypy>=1.5.0; extra == "dev"
|
|
20
21
|
Requires-Dist: ruff>=0.11; extra == "dev"
|
|
@@ -25,8 +25,8 @@ DLMS_SPODES/cosem_interface_classes/activity_calendar.py,sha256=1kKRxBmMRKaKRYpR
|
|
|
25
25
|
DLMS_SPODES/cosem_interface_classes/arbitrator.py,sha256=CvrYknl6xfg8hZR5RijzWsMh34XBQKsQ0nQp_Jtm__E,3208
|
|
26
26
|
DLMS_SPODES/cosem_interface_classes/attr_indexes.py,sha256=aUSnT-dKoBsDbwLhlgtLIHGRl7PZrT-ld2ThCEUjUeA,328
|
|
27
27
|
DLMS_SPODES/cosem_interface_classes/clock.py,sha256=AQiMtW13_Y74M2kYYfhZsKGPWtHqOkBNvEPX2QCfXfg,4493
|
|
28
|
-
DLMS_SPODES/cosem_interface_classes/collection.py,sha256=
|
|
29
|
-
DLMS_SPODES/cosem_interface_classes/cosem_interface_class.py,sha256=
|
|
28
|
+
DLMS_SPODES/cosem_interface_classes/collection.py,sha256=PwhbNP9_S_Bp1nt3xxza46rvMS4j8WWoml94MCI80nQ,96575
|
|
29
|
+
DLMS_SPODES/cosem_interface_classes/cosem_interface_class.py,sha256=UqU0l2YZbx3WB-ziZyfoPoXtStYPgttAtJKdW0GZYb4,23002
|
|
30
30
|
DLMS_SPODES/cosem_interface_classes/data.py,sha256=ELFfBX_VFsKRpAB7SVUp1sBnhjDgttGXa96jSYYLOH8,734
|
|
31
31
|
DLMS_SPODES/cosem_interface_classes/disconnect_control.py,sha256=21qKu4cpOEeiuhQAk4tGcfsm32ibCgQv8W3vVdOO4Wo,2894
|
|
32
32
|
DLMS_SPODES/cosem_interface_classes/extended_register.py,sha256=myVtqPxCZAm-JlgCB-KQeNrBLLptUXj2Bh9HEIOiHHA,1121
|
|
@@ -112,7 +112,7 @@ DLMS_SPODES/types/implementations/integers.py,sha256=KAcaTY8ZwhBaJThbLSr39Oh_-9h
|
|
|
112
112
|
DLMS_SPODES/types/implementations/long_unsigneds.py,sha256=SxmFvD2moQ03p-KZSBYK1Rv7bQSaywlHVXBfkTZG1OQ,8761
|
|
113
113
|
DLMS_SPODES/types/implementations/octet_string.py,sha256=Jo_sfWcsfstiP4O6mXfBOOQlksx1c2qJMI-vbAOV-yM,294
|
|
114
114
|
DLMS_SPODES/types/implementations/structs.py,sha256=GMOo6Jy8jA9d6KTLs0D-j5t0oSRvxUIwtBr_4UePwbA,2059
|
|
115
|
-
dlms_spodes-0.86.
|
|
116
|
-
dlms_spodes-0.86.
|
|
117
|
-
dlms_spodes-0.86.
|
|
118
|
-
dlms_spodes-0.86.
|
|
115
|
+
dlms_spodes-0.86.15.dist-info/METADATA,sha256=CmQXE_kE5LeR5CBTKbyvW8udIx9XQDrFLnG40mO2Z1c,1028
|
|
116
|
+
dlms_spodes-0.86.15.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
117
|
+
dlms_spodes-0.86.15.dist-info/top_level.txt,sha256=k26SRuRdwBZrSM3NgNZECAUNIDZREbJuLCnPbWtTNak,12
|
|
118
|
+
dlms_spodes-0.86.15.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|