iris-pex-embedded-python 3.4.0b3__py3-none-any.whl → 3.4.0b5__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 +87 -164
- iop/_utils.py +3 -2
- {iris_pex_embedded_python-3.4.0b3.dist-info → iris_pex_embedded_python-3.4.0b5.dist-info}/METADATA +1 -3
- {iris_pex_embedded_python-3.4.0b3.dist-info → iris_pex_embedded_python-3.4.0b5.dist-info}/RECORD +9 -9
- {iris_pex_embedded_python-3.4.0b3.dist-info → iris_pex_embedded_python-3.4.0b5.dist-info}/LICENSE +0 -0
- {iris_pex_embedded_python-3.4.0b3.dist-info → iris_pex_embedded_python-3.4.0b5.dist-info}/WHEEL +0 -0
- {iris_pex_embedded_python-3.4.0b3.dist-info → iris_pex_embedded_python-3.4.0b5.dist-info}/entry_points.txt +0 -0
- {iris_pex_embedded_python-3.4.0b3.dist-info → iris_pex_embedded_python-3.4.0b5.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
|
@@ -1,175 +1,52 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
|
-
import base64
|
|
3
2
|
import codecs
|
|
4
|
-
import datetime
|
|
5
|
-
import decimal
|
|
6
3
|
import importlib
|
|
7
|
-
import
|
|
4
|
+
import inspect
|
|
8
5
|
import pickle
|
|
9
|
-
import
|
|
10
|
-
from
|
|
11
|
-
from
|
|
12
|
-
from typing import Any, Dict, Type, Optional
|
|
6
|
+
import json
|
|
7
|
+
from dataclasses import asdict, is_dataclass
|
|
8
|
+
from typing import Any, Dict, Type
|
|
13
9
|
|
|
14
|
-
from dacite import Config, from_dict
|
|
15
10
|
import iris
|
|
11
|
+
from pydantic import BaseModel, TypeAdapter
|
|
16
12
|
|
|
17
13
|
from iop._message import _PydanticPickleMessage
|
|
18
14
|
from iop._utils import _Utils
|
|
19
|
-
from pydantic import BaseModel
|
|
20
|
-
|
|
21
|
-
# Constants
|
|
22
|
-
DATETIME_FORMAT_LENGTH = 23
|
|
23
|
-
TIME_FORMAT_LENGTH = 12
|
|
24
|
-
TYPE_SEPARATOR = ':'
|
|
25
|
-
SUPPORTED_TYPES = {
|
|
26
|
-
'datetime', 'date', 'time', 'dataframe',
|
|
27
|
-
'decimal', 'uuid', 'bytes'
|
|
28
|
-
}
|
|
29
15
|
|
|
30
16
|
class SerializationError(Exception):
|
|
31
|
-
"""
|
|
17
|
+
"""Exception raised for serialization errors."""
|
|
32
18
|
pass
|
|
33
19
|
|
|
34
|
-
class
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
if typ == 'dataframe':
|
|
40
|
-
return obj.to_json(orient="table")
|
|
41
|
-
elif typ == 'datetime':
|
|
42
|
-
return TypeConverter._format_datetime(obj)
|
|
43
|
-
elif typ == 'date':
|
|
44
|
-
return obj.isoformat()
|
|
45
|
-
elif typ == 'time':
|
|
46
|
-
return TypeConverter._format_time(obj)
|
|
47
|
-
elif typ == 'bytes':
|
|
48
|
-
return base64.b64encode(obj).decode("UTF-8")
|
|
49
|
-
return str(obj)
|
|
50
|
-
|
|
51
|
-
@staticmethod
|
|
52
|
-
def convert_from_string(typ: str, val: str) -> Any:
|
|
53
|
-
try:
|
|
54
|
-
if typ == 'datetime':
|
|
55
|
-
return datetime.datetime.fromisoformat(val)
|
|
56
|
-
elif typ == 'date':
|
|
57
|
-
return datetime.date.fromisoformat(val)
|
|
58
|
-
elif typ == 'time':
|
|
59
|
-
return datetime.time.fromisoformat(val)
|
|
60
|
-
elif typ == 'dataframe':
|
|
61
|
-
try:
|
|
62
|
-
import pandas as pd
|
|
63
|
-
except ImportError:
|
|
64
|
-
raise SerializationError("Failed to load pandas module")
|
|
65
|
-
return pd.read_json(val, orient="table")
|
|
66
|
-
elif typ == 'decimal':
|
|
67
|
-
return decimal.Decimal(val)
|
|
68
|
-
elif typ == 'uuid':
|
|
69
|
-
return uuid.UUID(val)
|
|
70
|
-
elif typ == 'bytes':
|
|
71
|
-
return base64.b64decode(val.encode("UTF-8"))
|
|
72
|
-
return val
|
|
73
|
-
except Exception as e:
|
|
74
|
-
raise SerializationError(f"Failed to convert type {typ}: {str(e)}")
|
|
20
|
+
class TempPydanticModel(BaseModel):
|
|
21
|
+
model_config = {
|
|
22
|
+
'arbitrary_types_allowed' : True,
|
|
23
|
+
'extra' : 'allow'
|
|
24
|
+
}
|
|
75
25
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
r = dt.isoformat()
|
|
79
|
-
if dt.microsecond:
|
|
80
|
-
r = r[:DATETIME_FORMAT_LENGTH] + r[26:]
|
|
81
|
-
if r.endswith("+00:00"):
|
|
82
|
-
r = r[:-6] + "Z"
|
|
83
|
-
return r
|
|
26
|
+
class MessageSerializer:
|
|
27
|
+
"""Handles message serialization and deserialization."""
|
|
84
28
|
|
|
85
29
|
@staticmethod
|
|
86
|
-
def
|
|
87
|
-
|
|
88
|
-
if t.microsecond:
|
|
89
|
-
r = r[:TIME_FORMAT_LENGTH]
|
|
90
|
-
return r
|
|
91
|
-
|
|
92
|
-
class IrisJSONEncoder(json.JSONEncoder):
|
|
93
|
-
"""JSONEncoder that handles dates, decimals, UUIDs, etc."""
|
|
94
|
-
|
|
95
|
-
def default(self, obj: Any) -> Any:
|
|
30
|
+
def _convert_to_json_safe(obj: Any) -> Any:
|
|
31
|
+
"""Convert objects to JSON-safe format."""
|
|
96
32
|
if isinstance(obj, BaseModel):
|
|
97
|
-
return obj.
|
|
98
|
-
|
|
99
|
-
return
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
elif isinstance(obj, datetime.date):
|
|
103
|
-
return f'date:{TypeConverter.convert_to_string("date", obj)}'
|
|
104
|
-
elif isinstance(obj, datetime.time):
|
|
105
|
-
return f'time:{TypeConverter.convert_to_string("time", obj)}'
|
|
106
|
-
elif isinstance(obj, decimal.Decimal):
|
|
107
|
-
return f'decimal:{obj}'
|
|
108
|
-
elif isinstance(obj, uuid.UUID):
|
|
109
|
-
return f'uuid:{obj}'
|
|
110
|
-
elif isinstance(obj, bytes):
|
|
111
|
-
return f'bytes:{TypeConverter.convert_to_string("bytes", obj)}'
|
|
112
|
-
elif hasattr(obj, '__dict__'):
|
|
113
|
-
return obj.__dict__
|
|
114
|
-
return super().default(obj)
|
|
115
|
-
|
|
116
|
-
class IrisJSONDecoder(json.JSONDecoder):
|
|
117
|
-
"""JSONDecoder that handles special type annotations."""
|
|
118
|
-
|
|
119
|
-
def __init__(self, *args: Any, **kwargs: Any) -> None:
|
|
120
|
-
super().__init__(object_hook=self.object_hook, *args, **kwargs)
|
|
121
|
-
|
|
122
|
-
def object_hook(self, obj: Dict) -> Dict:
|
|
123
|
-
return {
|
|
124
|
-
key: self._process_value(value)
|
|
125
|
-
for key, value in obj.items()
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
def _process_value(self, value: Any) -> Any:
|
|
129
|
-
if isinstance(value, str) and TYPE_SEPARATOR in value:
|
|
130
|
-
typ, val = value.split(TYPE_SEPARATOR, 1)
|
|
131
|
-
if typ in SUPPORTED_TYPES:
|
|
132
|
-
return TypeConverter.convert_from_string(typ, val)
|
|
133
|
-
return value
|
|
134
|
-
|
|
135
|
-
class MessageSerializer:
|
|
136
|
-
"""Handles message serialization and deserialization."""
|
|
33
|
+
return obj.model_dump_json()
|
|
34
|
+
elif is_dataclass(obj):
|
|
35
|
+
return TempPydanticModel.model_validate(dataclass_to_dict(obj)).model_dump_json()
|
|
36
|
+
else:
|
|
37
|
+
raise SerializationError(f"Object {obj} must be a Pydantic model or dataclass")
|
|
137
38
|
|
|
138
39
|
@staticmethod
|
|
139
40
|
def serialize(message: Any, use_pickle: bool = False) -> iris.cls:
|
|
140
41
|
"""Serializes a message to IRIS format."""
|
|
141
|
-
|
|
142
|
-
if isinstance(message, _PydanticPickleMessage):
|
|
143
|
-
return MessageSerializer._serialize_pickle(message)
|
|
144
|
-
if isinstance(message, BaseModel):
|
|
145
|
-
return (MessageSerializer._serialize_pickle(message)
|
|
146
|
-
if use_pickle else MessageSerializer._serialize_json(message))
|
|
147
|
-
if use_pickle:
|
|
42
|
+
if isinstance(message, _PydanticPickleMessage) or use_pickle:
|
|
148
43
|
return MessageSerializer._serialize_pickle(message)
|
|
149
44
|
return MessageSerializer._serialize_json(message)
|
|
150
45
|
|
|
151
|
-
@staticmethod
|
|
152
|
-
def deserialize(serial: iris.cls, use_pickle: bool = False) -> Any:
|
|
153
|
-
"""Deserializes a message from IRIS format."""
|
|
154
|
-
if use_pickle:
|
|
155
|
-
return MessageSerializer._deserialize_pickle(serial)
|
|
156
|
-
return MessageSerializer._deserialize_json(serial)
|
|
157
|
-
|
|
158
|
-
@staticmethod
|
|
159
|
-
def _serialize_pickle(message: Any) -> iris.cls:
|
|
160
|
-
pickle_string = codecs.encode(pickle.dumps(message), "base64").decode()
|
|
161
|
-
msg = iris.cls('IOP.PickleMessage')._New()
|
|
162
|
-
msg.classname = f"{message.__class__.__module__}.{message.__class__.__name__}"
|
|
163
|
-
msg.jstr = _Utils.string_to_stream(pickle_string)
|
|
164
|
-
return msg
|
|
165
|
-
|
|
166
46
|
@staticmethod
|
|
167
47
|
def _serialize_json(message: Any) -> iris.cls:
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
else:
|
|
171
|
-
json_string = json.dumps(message, cls=IrisJSONEncoder, ensure_ascii=False)
|
|
172
|
-
|
|
48
|
+
json_string = MessageSerializer._convert_to_json_safe(message)
|
|
49
|
+
|
|
173
50
|
msg = iris.cls('IOP.Message')._New()
|
|
174
51
|
msg.classname = f"{message.__class__.__module__}.{message.__class__.__name__}"
|
|
175
52
|
|
|
@@ -180,9 +57,10 @@ class MessageSerializer:
|
|
|
180
57
|
return msg
|
|
181
58
|
|
|
182
59
|
@staticmethod
|
|
183
|
-
def
|
|
184
|
-
|
|
185
|
-
|
|
60
|
+
def deserialize(serial: iris.cls, use_pickle: bool = False) -> Any:
|
|
61
|
+
if use_pickle:
|
|
62
|
+
return MessageSerializer._deserialize_pickle(serial)
|
|
63
|
+
return MessageSerializer._deserialize_json(serial)
|
|
186
64
|
|
|
187
65
|
@staticmethod
|
|
188
66
|
def _deserialize_json(serial: iris.cls) -> Any:
|
|
@@ -200,14 +78,28 @@ class MessageSerializer:
|
|
|
200
78
|
if serial.type == 'Stream' else serial.json)
|
|
201
79
|
|
|
202
80
|
try:
|
|
203
|
-
json_dict = json.loads(json_string, cls=IrisJSONDecoder)
|
|
204
81
|
if issubclass(msg_class, BaseModel):
|
|
205
|
-
return msg_class.
|
|
82
|
+
return msg_class.model_validate_json(json_string)
|
|
83
|
+
elif is_dataclass(msg_class):
|
|
84
|
+
return dataclass_from_dict(msg_class, json.loads(json_string))
|
|
206
85
|
else:
|
|
207
|
-
|
|
86
|
+
raise SerializationError(f"Class {msg_class} must be a Pydantic model or dataclass")
|
|
208
87
|
except Exception as e:
|
|
209
88
|
raise SerializationError(f"Failed to deserialize JSON: {str(e)}")
|
|
210
89
|
|
|
90
|
+
@staticmethod
|
|
91
|
+
def _serialize_pickle(message: Any) -> iris.cls:
|
|
92
|
+
pickle_string = codecs.encode(pickle.dumps(message), "base64").decode()
|
|
93
|
+
msg = iris.cls('IOP.PickleMessage')._New()
|
|
94
|
+
msg.classname = f"{message.__class__.__module__}.{message.__class__.__name__}"
|
|
95
|
+
msg.jstr = _Utils.string_to_stream(pickle_string)
|
|
96
|
+
return msg
|
|
97
|
+
|
|
98
|
+
@staticmethod
|
|
99
|
+
def _deserialize_pickle(serial: iris.cls) -> Any:
|
|
100
|
+
string = _Utils.stream_to_string(serial.jstr)
|
|
101
|
+
return pickle.loads(codecs.decode(string.encode(), "base64"))
|
|
102
|
+
|
|
211
103
|
@staticmethod
|
|
212
104
|
def _parse_classname(classname: str) -> tuple[str, str]:
|
|
213
105
|
j = classname.rindex(".")
|
|
@@ -216,18 +108,49 @@ class MessageSerializer:
|
|
|
216
108
|
return classname[:j], classname[j+1:]
|
|
217
109
|
|
|
218
110
|
def dataclass_from_dict(klass: Type, dikt: Dict) -> Any:
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
111
|
+
field_types = {
|
|
112
|
+
key: val.annotation
|
|
113
|
+
for key, val in inspect.signature(klass).parameters.items()
|
|
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)
|
|
122
|
+
if value is None:
|
|
123
|
+
processed_dict[key] = None
|
|
124
|
+
continue
|
|
125
|
+
|
|
126
|
+
try:
|
|
127
|
+
field_type = field_types[key]
|
|
128
|
+
if field_type != inspect.Parameter.empty:
|
|
129
|
+
adapter = TypeAdapter(field_type)
|
|
130
|
+
processed_dict[key] = adapter.validate_python(value)
|
|
131
|
+
else:
|
|
132
|
+
processed_dict[key] = value
|
|
133
|
+
except Exception:
|
|
134
|
+
processed_dict[key] = value
|
|
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)
|
|
143
|
+
return instance
|
|
144
|
+
|
|
145
|
+
def dataclass_to_dict(instance: Any) -> Dict:
|
|
146
|
+
"""Converts a class instance to a dictionary.
|
|
147
|
+
Handles non attended fields."""
|
|
148
|
+
dikt = asdict(instance)
|
|
149
|
+
# assign any extra fields
|
|
150
|
+
for k, v in vars(instance).items():
|
|
151
|
+
if k not in dikt:
|
|
152
|
+
dikt[k] = v
|
|
153
|
+
return dikt
|
|
231
154
|
|
|
232
155
|
# Maintain backwards compatibility
|
|
233
156
|
serialize_pickle_message = lambda msg: MessageSerializer.serialize(msg, use_pickle=True)
|
iop/_utils.py
CHANGED
|
@@ -8,7 +8,7 @@ import pkg_resources
|
|
|
8
8
|
import importlib
|
|
9
9
|
import json
|
|
10
10
|
from iop._message import _Message, _PydanticMessage
|
|
11
|
-
from
|
|
11
|
+
from pydantic import TypeAdapter
|
|
12
12
|
|
|
13
13
|
class _Utils():
|
|
14
14
|
@staticmethod
|
|
@@ -46,7 +46,8 @@ class _Utils():
|
|
|
46
46
|
if issubclass(cls,_PydanticMessage):
|
|
47
47
|
schema = cls.model_json_schema()
|
|
48
48
|
elif issubclass(cls,_Message):
|
|
49
|
-
|
|
49
|
+
type_adapter = TypeAdapter(cls)
|
|
50
|
+
schema = type_adapter.json_schema()
|
|
50
51
|
else:
|
|
51
52
|
raise ValueError("The class must be a subclass of _Message or _PydanticMessage")
|
|
52
53
|
schema_name = cls.__module__ + '.' + cls.__name__
|
{iris_pex_embedded_python-3.4.0b3.dist-info → iris_pex_embedded_python-3.4.0b5.dist-info}/METADATA
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: iris_pex_embedded_python
|
|
3
|
-
Version: 3.4.
|
|
3
|
+
Version: 3.4.0b5
|
|
4
4
|
Summary: Iris Interoperability based on Embedded Python
|
|
5
5
|
Author-email: grongier <guillaume.rongier@intersystems.com>
|
|
6
6
|
License: MIT License
|
|
@@ -44,12 +44,10 @@ Classifier: Programming Language :: Python :: 3.12
|
|
|
44
44
|
Classifier: Topic :: Utilities
|
|
45
45
|
Description-Content-Type: text/markdown
|
|
46
46
|
License-File: LICENSE
|
|
47
|
-
Requires-Dist: dacite>=1.6.0
|
|
48
47
|
Requires-Dist: pydantic>=2.0.0
|
|
49
48
|
Requires-Dist: xmltodict>=0.12.0
|
|
50
49
|
Requires-Dist: iris-embedded-python-wrapper>=0.0.6
|
|
51
50
|
Requires-Dist: setuptools>=40.8.0
|
|
52
|
-
Requires-Dist: dc-schema>=0.0.8
|
|
53
51
|
Requires-Dist: jsonpath-ng>=1.7.0
|
|
54
52
|
|
|
55
53
|
# IoP (Interoperability On Python)
|
{iris_pex_embedded_python-3.4.0b3.dist-info → iris_pex_embedded_python-3.4.0b5.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,8 +109,8 @@ 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=
|
|
113
|
-
iop/_utils.py,sha256=
|
|
112
|
+
iop/_serialization.py,sha256=Uf6PzvOGuzzr3_29KkFpvU_NooVx6unkU6EqHMx7r3A,5900
|
|
113
|
+
iop/_utils.py,sha256=CUqxhjaOdAG8IuPnk0j7L__qlj0JhR5Ajhf3Lm5omzA,19921
|
|
114
114
|
iop/cls/IOP/BusinessOperation.cls,sha256=lrymqZ8wHl5kJjXwdjbQVs5sScV__yIWGh-oGbiB_X0,914
|
|
115
115
|
iop/cls/IOP/BusinessProcess.cls,sha256=s3t38w1ykHqM26ETcbCYLt0ocjZyVVahm-_USZkuJ1E,2855
|
|
116
116
|
iop/cls/IOP/BusinessService.cls,sha256=7ebn32J9PiZXUgXuh5Xxm_7X6zHBiqkJr9c_dWxbPO8,1021
|
|
@@ -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.0b5.dist-info/LICENSE,sha256=rZSiBFId_sfbJ6RL0GjjPX-InNLkNS9ou7eQsikciI8,1089
|
|
139
|
+
iris_pex_embedded_python-3.4.0b5.dist-info/METADATA,sha256=F_CE19w_JUMNyQJkm_AJQQ5yElTMRZwL7ge38hA6Dyk,4397
|
|
140
|
+
iris_pex_embedded_python-3.4.0b5.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
|
141
|
+
iris_pex_embedded_python-3.4.0b5.dist-info/entry_points.txt,sha256=pj-i4LSDyiSP6xpHlVjMCbg1Pik7dC3_sdGY3Yp9Vhk,38
|
|
142
|
+
iris_pex_embedded_python-3.4.0b5.dist-info/top_level.txt,sha256=VWDlX4YF4qFVRGrG3-Gs0kgREol02i8gIpsHNbhfFPw,42
|
|
143
|
+
iris_pex_embedded_python-3.4.0b5.dist-info/RECORD,,
|
{iris_pex_embedded_python-3.4.0b3.dist-info → iris_pex_embedded_python-3.4.0b5.dist-info}/LICENSE
RENAMED
|
File without changes
|
{iris_pex_embedded_python-3.4.0b3.dist-info → iris_pex_embedded_python-3.4.0b5.dist-info}/WHEEL
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|