iris-pex-embedded-python 4.0.0b2__py3-none-any.whl → 4.0.0b3__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.
@@ -22,6 +22,12 @@ class SerializationError(Exception):
22
22
  pass
23
23
 
24
24
 
25
+ class MessageClassImportError(SerializationError, ImportError):
26
+ """Raised when a JSON message's Python class cannot be imported."""
27
+
28
+ pass
29
+
30
+
25
31
  class TempPydanticModel(BaseModel):
26
32
  model_config = {"arbitrary_types_allowed": True, "extra": "allow"}
27
33
 
@@ -93,8 +99,8 @@ class MessageSerializer:
93
99
  )
94
100
  module = importlib.import_module(module_name)
95
101
  msg_class = getattr(module, class_name)
96
- except Exception as e:
97
- raise SerializationError(
102
+ except (ModuleNotFoundError, AttributeError, ValueError) as e:
103
+ raise MessageClassImportError(
98
104
  f"Failed to load class {serial.classname}: {str(e)}"
99
105
  ) from e
100
106
 
@@ -130,9 +136,12 @@ class MessageSerializer:
130
136
 
131
137
  @staticmethod
132
138
  def _parse_classname(classname: str) -> tuple[str, str]:
133
- j = classname.rindex(".")
139
+ try:
140
+ j = classname.rindex(".")
141
+ except ValueError as e:
142
+ raise ValueError(f"Classname must include a module: {classname}") from e
134
143
  if j <= 0:
135
- raise SerializationError(f"Classname must include a module: {classname}")
144
+ raise ValueError(f"Classname must include a module: {classname}")
136
145
  return classname[:j], classname[j + 1 :]
137
146
 
138
147
  @staticmethod
iop/runtime/director.py CHANGED
@@ -9,6 +9,7 @@ from dataclasses import dataclass
9
9
  from functools import wraps
10
10
 
11
11
  from ..messages.dispatch import dispatch_deserializer, dispatch_serializer
12
+ from ..messages.serialization import MessageClassImportError
12
13
  from ..migration import utils as _migration_utils
13
14
  from ..runtime import iris as _iris
14
15
 
@@ -327,11 +328,20 @@ def test_component(target, message=None, classname=None, body=None):
327
328
  response = iris.cls("IOP.Utils").dispatchTestComponent(target, serial_message)
328
329
  try:
329
330
  deserialized_response = dispatch_deserializer(response)
330
- except ImportError:
331
- # can't import the class, return the string
332
- deserialized_response = (
333
- f"{response.classname} : {_migration_utils.stream_to_string(response.jstr)}"
334
- )
331
+ except MessageClassImportError:
332
+ if response._IsA("IOP.Message"):
333
+ body = (
334
+ _migration_utils.stream_to_string(response.json)
335
+ if response.type == "Stream"
336
+ else response.json
337
+ )
338
+ deserialized_response = {
339
+ "classname": response.classname,
340
+ "body": body,
341
+ "truncated": False,
342
+ }
343
+ else:
344
+ raise
335
345
  return deserialized_response
336
346
 
337
347
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: iris_pex_embedded_python
3
- Version: 4.0.0b2
3
+ Version: 4.0.0b3
4
4
  Summary: Iris Interoperability based on Embedded Python
5
5
  Author-email: grongier <guillaume.rongier@intersystems.com>
6
6
  License: MIT License
@@ -55,7 +55,7 @@ iop/messages/base.py,sha256=2DBU8CzKLXVYUT3Vp6QeL6QHJbbfOGfoE4Kmkrq8Hpg,1183
55
55
  iop/messages/decorators.py,sha256=jOjMllMHaDzS3Apo1h68LIn87boGfDnsQ1OhyyuReA0,2363
56
56
  iop/messages/dispatch.py,sha256=Wvux2Vw7g76faVKmyfw25iia84-vA-2P-9KpHTOQBug,5648
57
57
  iop/messages/persistent.py,sha256=YJMGhrrMvI0hkmtOkxG3Jn4iurPRU54UqUo4onlakAA,16581
58
- iop/messages/serialization.py,sha256=wqvbtQc2uewvgklIQN-tBMIyiWghL7ui0hPMHk3f5jc,8936
58
+ iop/messages/serialization.py,sha256=BW0o-7GaceMW7RMOzOJ8g9rKEv28NYnYFwtTLmAf7Yg,9255
59
59
  iop/messages/validation.py,sha256=cbq2VaaWTcqesmV-DDwReHh8peynvEMw9h0JNf4q9kQ,1530
60
60
  iop/migration/__init__.py,sha256=wp-RvjLKYW_Pi2AJLfiWe1bACxENzEgjXtP9UMNiSVY,36
61
61
  iop/migration/io.py,sha256=hAehtApFZFgGzjzgwBmDMxdA1xoRhE-okOcEzvgFdQ4,1822
@@ -74,7 +74,7 @@ iop/production/rendering.py,sha256=XK1d1tLjuseZfasQhHDZr0BAMVgZjkUKPBo6-8_umMg,9
74
74
  iop/production/runtime.py,sha256=JngIVVkigt1PNLUXBvQu3t8cBos-zLKlgguf0_WWh-M,2302
75
75
  iop/production/types.py,sha256=SsTYPspc8VGrSH8hy49tDBVLWu55D5yODNT7lfFbjmc,9131
76
76
  iop/runtime/__init__.py,sha256=wcyWMRuPCYE_CLd1NmgmI1M-IbFs2Gz2yIj2-EW_2AA,70
77
- iop/runtime/director.py,sha256=zJFTY-29clsnHXhVGkv7OH8Ign0ax_Pi-slAwjKNsmI,12559
77
+ iop/runtime/director.py,sha256=KW8BvkATK8XuIUPNBD9rMww9r3Zg4K3H54868eOgvl0,12867
78
78
  iop/runtime/environment.py,sha256=0KZ4EoW6NUEbF7FW471emxQ-9FbaiX6ngUHVGihgZXU,1564
79
79
  iop/runtime/iris.py,sha256=wFbrgyv0FiMujGeEyZTysx4JX8Exk5ZPAhjc25wGWGU,185
80
80
  iop/runtime/local.py,sha256=p6jZRxd7tsmgyeZqoH5qzqFVBCa5j-r7b-SuaP8dUcI,4593
@@ -85,9 +85,9 @@ iop/runtime/remote/director.py,sha256=IZa505MUsAwI_cfTK5nzRmrB927TMW-BBB2B7dQPnE
85
85
  iop/runtime/remote/migration.py,sha256=J7r1MiWd3ISPjojj_ZqG2x88GddSwjJmXHiuy2F3HkY,1689
86
86
  iop/runtime/remote/settings.py,sha256=P1Hsgld5o57HpSZgPVZzobyjlUmxJj6bstiWvR0JXnc,2144
87
87
  iop/runtime/remote/setup.py,sha256=Tr80F3JJTy7oSUso2jyx0iA_KZayd4MYt9vL0BvPpMA,2600
88
- iris_pex_embedded_python-4.0.0b2.dist-info/licenses/LICENSE,sha256=rZSiBFId_sfbJ6RL0GjjPX-InNLkNS9ou7eQsikciI8,1089
89
- iris_pex_embedded_python-4.0.0b2.dist-info/METADATA,sha256=mxySJ4yvA07dm9SpZBz15aq5c_3rdnvIURUEcRcrklU,4412
90
- iris_pex_embedded_python-4.0.0b2.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
91
- iris_pex_embedded_python-4.0.0b2.dist-info/entry_points.txt,sha256=fzS8ZFsPe8cnpEx208X60DNugCPQmuSloPeg4pyyJDY,42
92
- iris_pex_embedded_python-4.0.0b2.dist-info/top_level.txt,sha256=BM54-OXQ6l2BDtmesWNXckh033s9gcjoO7bfjbwZbxU,4
93
- iris_pex_embedded_python-4.0.0b2.dist-info/RECORD,,
88
+ iris_pex_embedded_python-4.0.0b3.dist-info/licenses/LICENSE,sha256=rZSiBFId_sfbJ6RL0GjjPX-InNLkNS9ou7eQsikciI8,1089
89
+ iris_pex_embedded_python-4.0.0b3.dist-info/METADATA,sha256=aWCFN8YxK2lK5sJD0vzlu8AkfJ3YBAkSjY3ulm-F78k,4412
90
+ iris_pex_embedded_python-4.0.0b3.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
91
+ iris_pex_embedded_python-4.0.0b3.dist-info/entry_points.txt,sha256=fzS8ZFsPe8cnpEx208X60DNugCPQmuSloPeg4pyyJDY,42
92
+ iris_pex_embedded_python-4.0.0b3.dist-info/top_level.txt,sha256=BM54-OXQ6l2BDtmesWNXckh033s9gcjoO7bfjbwZbxU,4
93
+ iris_pex_embedded_python-4.0.0b3.dist-info/RECORD,,