iris-pex-embedded-python 3.4.0b3__py3-none-any.whl → 3.4.0b4__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/_dispatch.py +2 -124
- iop/_serialization.py +1 -3
- {iris_pex_embedded_python-3.4.0b3.dist-info → iris_pex_embedded_python-3.4.0b4.dist-info}/METADATA +1 -1
- {iris_pex_embedded_python-3.4.0b3.dist-info → iris_pex_embedded_python-3.4.0b4.dist-info}/RECORD +8 -8
- {iris_pex_embedded_python-3.4.0b3.dist-info → iris_pex_embedded_python-3.4.0b4.dist-info}/LICENSE +0 -0
- {iris_pex_embedded_python-3.4.0b3.dist-info → iris_pex_embedded_python-3.4.0b4.dist-info}/WHEEL +0 -0
- {iris_pex_embedded_python-3.4.0b3.dist-info → iris_pex_embedded_python-3.4.0b4.dist-info}/entry_points.txt +0 -0
- {iris_pex_embedded_python-3.4.0b3.dist-info → iris_pex_embedded_python-3.4.0b4.dist-info}/top_level.txt +0 -0
iop/_dispatch.py
CHANGED
|
@@ -1,39 +1,9 @@
|
|
|
1
|
-
import codecs
|
|
2
|
-
import importlib
|
|
3
1
|
from inspect import signature
|
|
4
|
-
import
|
|
5
|
-
import pickle
|
|
6
|
-
from typing import Any, Dict, List, Type
|
|
2
|
+
from typing import Any
|
|
7
3
|
|
|
8
|
-
import
|
|
9
|
-
from dacite import Config, from_dict
|
|
10
|
-
from pydantic import BaseModel
|
|
11
|
-
|
|
12
|
-
from iop._utils import _Utils
|
|
13
|
-
from iop._serialization import IrisJSONEncoder, IrisJSONDecoder
|
|
4
|
+
from iop._serialization import serialize_message, serialize_pickle_message, deserialize_message, deserialize_pickle_message
|
|
14
5
|
from iop._message_validator import is_message_instance, is_pickle_message_instance, is_iris_object_instance
|
|
15
6
|
|
|
16
|
-
def serialize_pickle_message(message: Any) -> iris.cls:
|
|
17
|
-
"""Converts a python dataclass message into an iris iop.message.
|
|
18
|
-
|
|
19
|
-
Args:
|
|
20
|
-
message: The message to serialize, an instance of a class that is a subclass of Message.
|
|
21
|
-
|
|
22
|
-
Returns:
|
|
23
|
-
The message in json format.
|
|
24
|
-
"""
|
|
25
|
-
pickle_string = codecs.encode(pickle.dumps(message), "base64").decode()
|
|
26
|
-
module = message.__class__.__module__
|
|
27
|
-
classname = message.__class__.__name__
|
|
28
|
-
|
|
29
|
-
msg = iris.cls('IOP.PickleMessage')._New()
|
|
30
|
-
msg.classname = module + "." + classname
|
|
31
|
-
|
|
32
|
-
stream = _Utils.string_to_stream(pickle_string)
|
|
33
|
-
msg.jstr = stream
|
|
34
|
-
|
|
35
|
-
return msg
|
|
36
|
-
|
|
37
7
|
def dispatch_serializer(message: Any) -> Any:
|
|
38
8
|
"""Serializes the message based on its type.
|
|
39
9
|
|
|
@@ -59,42 +29,6 @@ def dispatch_serializer(message: Any) -> Any:
|
|
|
59
29
|
|
|
60
30
|
raise TypeError("The message must be an instance of a class that is a subclass of Message or IRISObject %Persistent class.")
|
|
61
31
|
|
|
62
|
-
def serialize_message(message: Any) -> iris.cls:
|
|
63
|
-
"""Converts a python dataclass message into an iris iop.message.
|
|
64
|
-
|
|
65
|
-
Args:
|
|
66
|
-
message: The message to serialize, an instance of a class that is a subclass of Message.
|
|
67
|
-
|
|
68
|
-
Returns:
|
|
69
|
-
The message in json format.
|
|
70
|
-
"""
|
|
71
|
-
json_string = json.dumps(message, cls=IrisJSONEncoder, ensure_ascii=False)
|
|
72
|
-
module = message.__class__.__module__
|
|
73
|
-
classname = message.__class__.__name__
|
|
74
|
-
|
|
75
|
-
msg = iris.cls('IOP.Message')._New()
|
|
76
|
-
msg.classname = module + "." + classname
|
|
77
|
-
|
|
78
|
-
if hasattr(msg, 'buffer') and len(json_string) > msg.buffer:
|
|
79
|
-
msg.json = _Utils.string_to_stream(json_string, msg.buffer)
|
|
80
|
-
else:
|
|
81
|
-
msg.json = json_string
|
|
82
|
-
|
|
83
|
-
return msg
|
|
84
|
-
|
|
85
|
-
def deserialize_pickle_message(serial: iris.cls) -> Any:
|
|
86
|
-
"""Converts an iris iop.message into a python dataclass message.
|
|
87
|
-
|
|
88
|
-
Args:
|
|
89
|
-
serial: The serialized message
|
|
90
|
-
|
|
91
|
-
Returns:
|
|
92
|
-
The deserialized message
|
|
93
|
-
"""
|
|
94
|
-
string = _Utils.stream_to_string(serial.jstr)
|
|
95
|
-
msg = pickle.loads(codecs.decode(string.encode(), "base64"))
|
|
96
|
-
return msg
|
|
97
|
-
|
|
98
32
|
def dispatch_deserializer(serial: Any) -> Any:
|
|
99
33
|
"""Deserializes the message based on its type.
|
|
100
34
|
|
|
@@ -125,62 +59,6 @@ def dispatch_deserializer(serial: Any) -> Any:
|
|
|
125
59
|
else:
|
|
126
60
|
return serial
|
|
127
61
|
|
|
128
|
-
def deserialize_message(serial: iris.cls) -> Any:
|
|
129
|
-
"""Converts an iris iop.message into a python dataclass message.
|
|
130
|
-
|
|
131
|
-
Args:
|
|
132
|
-
serial: The serialized message
|
|
133
|
-
|
|
134
|
-
Returns:
|
|
135
|
-
The deserialized message
|
|
136
|
-
"""
|
|
137
|
-
if (serial.classname is None):
|
|
138
|
-
raise ValueError("JSON message malformed, must include classname")
|
|
139
|
-
classname = serial.classname
|
|
140
|
-
|
|
141
|
-
j = classname.rindex(".")
|
|
142
|
-
if (j <= 0):
|
|
143
|
-
raise ValueError("Classname must include a module: " + classname)
|
|
144
|
-
try:
|
|
145
|
-
module = importlib.import_module(classname[:j])
|
|
146
|
-
msg = getattr(module, classname[j+1:])
|
|
147
|
-
except Exception:
|
|
148
|
-
raise ImportError("Class not found: " + classname)
|
|
149
|
-
|
|
150
|
-
string = ""
|
|
151
|
-
if (serial.type == 'Stream'):
|
|
152
|
-
string = _Utils.stream_to_string(serial.json)
|
|
153
|
-
else:
|
|
154
|
-
string = serial.json
|
|
155
|
-
|
|
156
|
-
jdict = json.loads(string, cls=IrisJSONDecoder)
|
|
157
|
-
return dataclass_from_dict(msg, jdict)
|
|
158
|
-
|
|
159
|
-
def dataclass_from_dict(klass: Type, dikt: Dict) -> Any:
|
|
160
|
-
"""Converts a dictionary to a dataclass instance.
|
|
161
|
-
|
|
162
|
-
Args:
|
|
163
|
-
klass: The dataclass to convert to
|
|
164
|
-
dikt: The dictionary to convert to a dataclass
|
|
165
|
-
|
|
166
|
-
Returns:
|
|
167
|
-
A dataclass object with the fields of the dataclass and the fields of the dictionary.
|
|
168
|
-
"""
|
|
169
|
-
if issubclass(klass, BaseModel):
|
|
170
|
-
return klass.model_validate(dikt)
|
|
171
|
-
else:
|
|
172
|
-
ret = from_dict(klass, dikt, Config(check_types=False))
|
|
173
|
-
|
|
174
|
-
try:
|
|
175
|
-
fieldtypes = klass.__annotations__
|
|
176
|
-
except Exception as e:
|
|
177
|
-
fieldtypes = []
|
|
178
|
-
|
|
179
|
-
for key, val in dikt.items():
|
|
180
|
-
if key not in fieldtypes:
|
|
181
|
-
setattr(ret, key, val)
|
|
182
|
-
return ret
|
|
183
|
-
|
|
184
62
|
def dispach_message(host, request: Any) -> Any:
|
|
185
63
|
"""Dispatches the message to the appropriate method.
|
|
186
64
|
|
iop/_serialization.py
CHANGED
|
@@ -7,9 +7,7 @@ import importlib
|
|
|
7
7
|
import json
|
|
8
8
|
import pickle
|
|
9
9
|
import uuid
|
|
10
|
-
from
|
|
11
|
-
from dataclasses import is_dataclass
|
|
12
|
-
from typing import Any, Dict, Type, Optional
|
|
10
|
+
from typing import Any, Dict, Type
|
|
13
11
|
|
|
14
12
|
from dacite import Config, from_dict
|
|
15
13
|
import iris
|
{iris_pex_embedded_python-3.4.0b3.dist-info → iris_pex_embedded_python-3.4.0b4.dist-info}/RECORD
RENAMED
|
@@ -101,7 +101,7 @@ iop/_cli.py,sha256=IwvVxglSTVkCDXwANLMqnd8mfxGtWB6GjBSdEy8EMm0,7551
|
|
|
101
101
|
iop/_common.py,sha256=QT05YtQBzzJOZdrX62j8qJxlmClkzTnl2FisJ12dgU0,12905
|
|
102
102
|
iop/_decorators.py,sha256=ZpgEETLdKWv58AoSMfXnm3_mA-6qPphIegjG-npDgwg,2324
|
|
103
103
|
iop/_director.py,sha256=DrswFoqJ6IG62hkW-0ZffTtZdxw6KNozlZSIq3O6d-o,11629
|
|
104
|
-
iop/_dispatch.py,sha256=
|
|
104
|
+
iop/_dispatch.py,sha256=I3TAhvTuk8j4VcROI9vAitJ0a7Nk1BYAWKRrLeNsjr0,3203
|
|
105
105
|
iop/_inbound_adapter.py,sha256=PS5ToqhrYcXq9ZdLbCBqAfVp8kCeRACm_KF66pwBO9U,1652
|
|
106
106
|
iop/_log_manager.py,sha256=f9T8yhcVJlCVNY7E_tb2e65QB_rJWYNF6J586OV2ukA,3240
|
|
107
107
|
iop/_message.py,sha256=pJQOjRIdw4wSDoJamvItGODMe-UjDU71XihgWdtCAqc,1120
|
|
@@ -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=RIBHjhrkAyfJJC5OXIlrwHcuXvPiDM63PtkVDyVKp1E,8840
|
|
113
113
|
iop/_utils.py,sha256=eNVxKGVQbYMoU43sFPkOjZIilN4OqRzycHV9l6rLDcU,19866
|
|
114
114
|
iop/cls/IOP/BusinessOperation.cls,sha256=lrymqZ8wHl5kJjXwdjbQVs5sScV__yIWGh-oGbiB_X0,914
|
|
115
115
|
iop/cls/IOP/BusinessProcess.cls,sha256=s3t38w1ykHqM26ETcbCYLt0ocjZyVVahm-_USZkuJ1E,2855
|
|
@@ -135,9 +135,9 @@ iop/cls/IOP/Service/WSGI.cls,sha256=VLNCXEwmHW9dBnE51uGE1nvGX6T4HjhqePT3LVhsjAE,
|
|
|
135
135
|
iop/wsgi/handlers.py,sha256=NrFLo_YbAh-x_PlWhAiWkQnUUN2Ss9HoEm63dDWCBpQ,2947
|
|
136
136
|
irisnative/_IRISNative.py,sha256=HQ4nBhc8t8_5OtxdMG-kx1aa-T1znf2I8obZOPLOPzg,665
|
|
137
137
|
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.
|
|
138
|
+
iris_pex_embedded_python-3.4.0b4.dist-info/LICENSE,sha256=rZSiBFId_sfbJ6RL0GjjPX-InNLkNS9ou7eQsikciI8,1089
|
|
139
|
+
iris_pex_embedded_python-3.4.0b4.dist-info/METADATA,sha256=SFK1Eke3STnTMMddK-npyOBkuEnajg-TJ0zY6McqHSA,4458
|
|
140
|
+
iris_pex_embedded_python-3.4.0b4.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
|
141
|
+
iris_pex_embedded_python-3.4.0b4.dist-info/entry_points.txt,sha256=pj-i4LSDyiSP6xpHlVjMCbg1Pik7dC3_sdGY3Yp9Vhk,38
|
|
142
|
+
iris_pex_embedded_python-3.4.0b4.dist-info/top_level.txt,sha256=VWDlX4YF4qFVRGrG3-Gs0kgREol02i8gIpsHNbhfFPw,42
|
|
143
|
+
iris_pex_embedded_python-3.4.0b4.dist-info/RECORD,,
|
{iris_pex_embedded_python-3.4.0b3.dist-info → iris_pex_embedded_python-3.4.0b4.dist-info}/LICENSE
RENAMED
|
File without changes
|
{iris_pex_embedded_python-3.4.0b3.dist-info → iris_pex_embedded_python-3.4.0b4.dist-info}/WHEEL
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|