iris-pex-embedded-python 3.4.0b12__py3-none-any.whl → 3.4.0b14__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 iris-pex-embedded-python might be problematic. Click here for more details.
- iop/_serialization.py +35 -31
- {iris_pex_embedded_python-3.4.0b12.dist-info → iris_pex_embedded_python-3.4.0b14.dist-info}/METADATA +3 -2
- {iris_pex_embedded_python-3.4.0b12.dist-info → iris_pex_embedded_python-3.4.0b14.dist-info}/RECORD +7 -7
- {iris_pex_embedded_python-3.4.0b12.dist-info → iris_pex_embedded_python-3.4.0b14.dist-info}/WHEEL +1 -1
- {iris_pex_embedded_python-3.4.0b12.dist-info → iris_pex_embedded_python-3.4.0b14.dist-info}/entry_points.txt +0 -0
- {iris_pex_embedded_python-3.4.0b12.dist-info → iris_pex_embedded_python-3.4.0b14.dist-info/licenses}/LICENSE +0 -0
- {iris_pex_embedded_python-3.4.0b12.dist-info → iris_pex_embedded_python-3.4.0b14.dist-info}/top_level.txt +0 -0
iop/_serialization.py
CHANGED
|
@@ -8,7 +8,7 @@ from dataclasses import asdict, is_dataclass
|
|
|
8
8
|
from typing import Any, Dict, Type
|
|
9
9
|
|
|
10
10
|
import iris
|
|
11
|
-
from pydantic import BaseModel, TypeAdapter
|
|
11
|
+
from pydantic import BaseModel, TypeAdapter, ValidationError
|
|
12
12
|
|
|
13
13
|
from iop._message import _PydanticPickleMessage
|
|
14
14
|
from iop._utils import _Utils
|
|
@@ -108,38 +108,42 @@ class MessageSerializer:
|
|
|
108
108
|
return classname[:j], classname[j+1:]
|
|
109
109
|
|
|
110
110
|
def dataclass_from_dict(klass: Type, dikt: Dict) -> Any:
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
processed_dict = {}
|
|
116
|
-
for key, val in inspect.signature(klass).parameters.items():
|
|
117
|
-
if key not in dikt and val.default != val.empty:
|
|
118
|
-
processed_dict[key] = val.default
|
|
119
|
-
continue
|
|
120
|
-
|
|
121
|
-
value = dikt.get(key)
|
|
111
|
+
"""Converts a dictionary to a dataclass instance.
|
|
112
|
+
Handles non attended fields and nested dataclasses."""
|
|
113
|
+
|
|
114
|
+
def process_field(value: Any, field_type: Type) -> Any:
|
|
122
115
|
if value is None:
|
|
123
|
-
|
|
116
|
+
return None
|
|
117
|
+
if is_dataclass(field_type):
|
|
118
|
+
return dataclass_from_dict(field_type, value)
|
|
119
|
+
if field_type != inspect.Parameter.empty:
|
|
120
|
+
try:
|
|
121
|
+
return TypeAdapter(field_type).validate_python(value)
|
|
122
|
+
except ValidationError:
|
|
123
|
+
return value
|
|
124
|
+
return value
|
|
125
|
+
|
|
126
|
+
# Get field definitions from class signature
|
|
127
|
+
fields = inspect.signature(klass).parameters
|
|
128
|
+
field_dict = {}
|
|
129
|
+
|
|
130
|
+
# Process each field
|
|
131
|
+
for field_name, field_info in fields.items():
|
|
132
|
+
if field_name not in dikt:
|
|
133
|
+
if field_info.default != field_info.empty:
|
|
134
|
+
field_dict[field_name] = field_info.default
|
|
124
135
|
continue
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
instance = klass(
|
|
137
|
-
**processed_dict
|
|
138
|
-
)
|
|
139
|
-
# handle any extra fields
|
|
140
|
-
for k, v in dikt.items():
|
|
141
|
-
if k not in processed_dict:
|
|
142
|
-
setattr(instance, k, v)
|
|
136
|
+
|
|
137
|
+
field_dict[field_name] = process_field(dikt[field_name], field_info.annotation)
|
|
138
|
+
|
|
139
|
+
# Create instance
|
|
140
|
+
instance = klass(**field_dict)
|
|
141
|
+
|
|
142
|
+
# Add any extra fields not in the dataclass definition
|
|
143
|
+
for key, value in dikt.items():
|
|
144
|
+
if key not in field_dict:
|
|
145
|
+
setattr(instance, key, value)
|
|
146
|
+
|
|
143
147
|
return instance
|
|
144
148
|
|
|
145
149
|
def dataclass_to_dict(instance: Any) -> Dict:
|
{iris_pex_embedded_python-3.4.0b12.dist-info → iris_pex_embedded_python-3.4.0b14.dist-info}/METADATA
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: iris_pex_embedded_python
|
|
3
|
-
Version: 3.4.
|
|
3
|
+
Version: 3.4.0b14
|
|
4
4
|
Summary: Iris Interoperability based on Embedded Python
|
|
5
5
|
Author-email: grongier <guillaume.rongier@intersystems.com>
|
|
6
6
|
License: MIT License
|
|
@@ -49,6 +49,7 @@ Requires-Dist: xmltodict>=0.12.0
|
|
|
49
49
|
Requires-Dist: iris-embedded-python-wrapper>=0.0.6
|
|
50
50
|
Requires-Dist: setuptools>=40.8.0
|
|
51
51
|
Requires-Dist: jsonpath-ng>=1.7.0
|
|
52
|
+
Dynamic: license-file
|
|
52
53
|
|
|
53
54
|
# IoP (Interoperability On Python)
|
|
54
55
|
|
{iris_pex_embedded_python-3.4.0b12.dist-info → iris_pex_embedded_python-3.4.0b14.dist-info}/RECORD
RENAMED
|
@@ -109,7 +109,7 @@ iop/_message_validator.py,sha256=K6FxLe72gBHQXZTLVrFw87rABGM0F6CTaNtZ2MqJoss,140
|
|
|
109
109
|
iop/_outbound_adapter.py,sha256=YTAhLrRf9chEAd53mV6KKbpaHOKNOKJHoGgj5wakRR0,726
|
|
110
110
|
iop/_private_session_duplex.py,sha256=mzlFABh-ly51X1uSWw9YwQbktfMvuNdp2ALlRvlDow4,5152
|
|
111
111
|
iop/_private_session_process.py,sha256=todprfYFSDr-h-BMvWL_IGC6wbQqkMy3mPHWEWCUSE0,1686
|
|
112
|
-
iop/_serialization.py,sha256=
|
|
112
|
+
iop/_serialization.py,sha256=EEhPbRpgODsGEt3RMiThr5g7Ox6lOT28XFQeAQq2eik,6162
|
|
113
113
|
iop/_utils.py,sha256=jj1UZHVXYg5uB08E0ETKfpmXQX-TWYSdPl4BO43k2RY,19976
|
|
114
114
|
iop/cls/IOP/BusinessOperation.cls,sha256=lrymqZ8wHl5kJjXwdjbQVs5sScV__yIWGh-oGbiB_X0,914
|
|
115
115
|
iop/cls/IOP/BusinessProcess.cls,sha256=s3t38w1ykHqM26ETcbCYLt0ocjZyVVahm-_USZkuJ1E,2855
|
|
@@ -133,11 +133,11 @@ iop/cls/IOP/PrivateSession/Message/Start.cls,sha256=uk-WTe66GicCshgmVy3F5ugHiAyP
|
|
|
133
133
|
iop/cls/IOP/PrivateSession/Message/Stop.cls,sha256=7g3gKFUjNg0WXBLuWnj-VnCs5G6hSE09YTzGEp0zbGc,1390
|
|
134
134
|
iop/cls/IOP/Service/WSGI.cls,sha256=VLNCXEwmHW9dBnE51uGE1nvGX6T4HjhqePT3LVhsjAE,10440
|
|
135
135
|
iop/wsgi/handlers.py,sha256=NrFLo_YbAh-x_PlWhAiWkQnUUN2Ss9HoEm63dDWCBpQ,2947
|
|
136
|
+
iris_pex_embedded_python-3.4.0b14.dist-info/licenses/LICENSE,sha256=rZSiBFId_sfbJ6RL0GjjPX-InNLkNS9ou7eQsikciI8,1089
|
|
136
137
|
irisnative/_IRISNative.py,sha256=HQ4nBhc8t8_5OtxdMG-kx1aa-T1znf2I8obZOPLOPzg,665
|
|
137
138
|
irisnative/__init__.py,sha256=6YmvBLQSURsCPKaNg7LK-xpo4ipDjrlhKuwdfdNb3Kg,341
|
|
138
|
-
iris_pex_embedded_python-3.4.
|
|
139
|
-
iris_pex_embedded_python-3.4.
|
|
140
|
-
iris_pex_embedded_python-3.4.
|
|
141
|
-
iris_pex_embedded_python-3.4.
|
|
142
|
-
iris_pex_embedded_python-3.4.
|
|
143
|
-
iris_pex_embedded_python-3.4.0b12.dist-info/RECORD,,
|
|
139
|
+
iris_pex_embedded_python-3.4.0b14.dist-info/METADATA,sha256=5V_wbU1xuYzxYqKuGcIT-fpGh6he_9n7b0uWwCeQ9JQ,4420
|
|
140
|
+
iris_pex_embedded_python-3.4.0b14.dist-info/WHEEL,sha256=1tXe9gY0PYatrMPMDd6jXqjfpz_B-Wqm32CPfRC58XU,91
|
|
141
|
+
iris_pex_embedded_python-3.4.0b14.dist-info/entry_points.txt,sha256=pj-i4LSDyiSP6xpHlVjMCbg1Pik7dC3_sdGY3Yp9Vhk,38
|
|
142
|
+
iris_pex_embedded_python-3.4.0b14.dist-info/top_level.txt,sha256=VWDlX4YF4qFVRGrG3-Gs0kgREol02i8gIpsHNbhfFPw,42
|
|
143
|
+
iris_pex_embedded_python-3.4.0b14.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|