iris-pex-embedded-python 3.4.0b2__py3-none-any.whl → 3.4.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.

Potentially problematic release.


This version of iris-pex-embedded-python might be problematic. Click here for more details.

iop/_common.py CHANGED
@@ -17,7 +17,19 @@ class _Common(metaclass=abc.ABCMeta):
17
17
  INFO_URL: ClassVar[str]
18
18
  ICON_URL: ClassVar[str]
19
19
  iris_handle: Any = None
20
- log_to_console: bool = False
20
+ _log_to_console: bool = False
21
+
22
+ @property
23
+ def log_to_console(self) -> bool:
24
+ return self._log_to_console
25
+
26
+ @log_to_console.setter
27
+ def log_to_console(self, value: bool) -> None:
28
+ self._log_to_console = value
29
+ self.logger = LogManager.get_logger(self.__class__.__name__,value)
30
+
31
+ def __init__(self):
32
+ self.logger = LogManager.get_logger(self.__class__.__name__)
21
33
 
22
34
  # Lifecycle methods
23
35
  def on_init(self) -> None:
@@ -172,7 +184,7 @@ class _Common(metaclass=abc.ABCMeta):
172
184
  except:
173
185
  pass
174
186
  return ret
175
-
187
+
176
188
  # Logging methods
177
189
  def _log(self) -> Tuple[str, Optional[str]]:
178
190
  """Get class and method name for logging.
@@ -189,15 +201,27 @@ class _Common(metaclass=abc.ABCMeta):
189
201
  pass
190
202
  return current_class, current_method
191
203
 
192
- @property
193
- def logger(self) -> logging.Logger:
194
- """Get a logger instance for this component.
204
+ def _logging(self, message: str, level: int, to_console: Optional[bool] = None) -> None:
205
+ """Write log entry.
195
206
 
196
- Returns:
197
- Logger configured for IRIS integration
207
+ Args:
208
+ message: Message to log
209
+ level: Log level
210
+ to_console: If True, log to console instead of IRIS
198
211
  """
199
- class_name, method_name = self._log()
200
- return LogManager.get_logger(class_name, method_name, self.log_to_console)
212
+ current_class, current_method = self._log()
213
+ if to_console is None:
214
+ to_console = self.log_to_console
215
+ if level == logging.DEBUG:
216
+ self.logger.debug(message, extra={'to_console': to_console, 'class_name': current_class, 'method_name': current_method})
217
+ elif level == logging.INFO:
218
+ self.logger.info(message, extra={'to_console': to_console, 'class_name': current_class, 'method_name': current_method})
219
+ elif level == logging.CRITICAL:
220
+ self.logger.critical(message, extra={'to_console': to_console, 'class_name': current_class, 'method_name': current_method})
221
+ elif level == logging.WARNING:
222
+ self.logger.warning(message, extra={'to_console': to_console, 'class_name': current_class, 'method_name': current_method})
223
+ elif level == logging.ERROR:
224
+ self.logger.error(message, extra={'to_console': to_console, 'class_name': current_class, 'method_name': current_method})
201
225
 
202
226
  def trace(self, message: str, to_console: Optional[bool] = None) -> None:
203
227
  """Write trace log entry.
@@ -206,8 +230,7 @@ class _Common(metaclass=abc.ABCMeta):
206
230
  message: Message to log
207
231
  to_console: If True, log to console instead of IRIS
208
232
  """
209
- self.logger.debug(message, extra={'to_console': to_console})
210
-
233
+ self._logging(message, logging.DEBUG, to_console)
211
234
 
212
235
  def log_info(self, message: str, to_console: Optional[bool] = None) -> None:
213
236
  """Write info log entry.
@@ -216,7 +239,7 @@ class _Common(metaclass=abc.ABCMeta):
216
239
  message: Message to log
217
240
  to_console: If True, log to console instead of IRIS
218
241
  """
219
- self.logger.info(message, extra={'to_console': to_console})
242
+ self._logging(message, logging.INFO, to_console)
220
243
 
221
244
  def log_alert(self, message: str, to_console: Optional[bool] = None) -> None:
222
245
  """Write alert log entry.
@@ -225,7 +248,7 @@ class _Common(metaclass=abc.ABCMeta):
225
248
  message: Message to log
226
249
  to_console: If True, log to console instead of IRIS
227
250
  """
228
- self.logger.critical(message, extra={'to_console': to_console})
251
+ self._logging(message, logging.CRITICAL, to_console)
229
252
 
230
253
  def log_warning(self, message: str, to_console: Optional[bool] = None) -> None:
231
254
  """Write warning log entry.
@@ -234,7 +257,7 @@ class _Common(metaclass=abc.ABCMeta):
234
257
  message: Message to log
235
258
  to_console: If True, log to console instead of IRIS
236
259
  """
237
- self.logger.warning(message, extra={'to_console': to_console})
260
+ self._logging(message, logging.WARNING, to_console)
238
261
 
239
262
  def log_error(self, message: str, to_console: Optional[bool] = None) -> None:
240
263
  """Write error log entry.
@@ -243,7 +266,7 @@ class _Common(metaclass=abc.ABCMeta):
243
266
  message: Message to log
244
267
  to_console: If True, log to console instead of IRIS
245
268
  """
246
- self.logger.error(message, extra={'to_console': to_console})
269
+ self._logging(message, logging.ERROR, to_console)
247
270
 
248
271
  def log_assert(self, message: str) -> None:
249
272
  """Write a log entry of type "assert". Log entries can be viewed in the management portal.
iop/_log_manager.py CHANGED
@@ -1,3 +1,4 @@
1
+ import traceback
1
2
  import iris
2
3
  import logging
3
4
  from typing import Optional, Tuple
@@ -6,7 +7,7 @@ class LogManager:
6
7
  """Manages logging integration between Python's logging module and IRIS."""
7
8
 
8
9
  @staticmethod
9
- def get_logger(class_name: str, method_name: Optional[str] = None, to_console: bool = False) -> logging.Logger:
10
+ def get_logger(class_name: str, to_console: bool = False) -> logging.Logger:
10
11
  """Get a logger instance configured for IRIS integration.
11
12
 
12
13
  Args:
@@ -17,11 +18,11 @@ class LogManager:
17
18
  Returns:
18
19
  Logger instance configured for IRIS integration
19
20
  """
20
- logger = logging.getLogger(f"{class_name}.{method_name}" if method_name else class_name)
21
+ logger = logging.Logger(f"{class_name}")
21
22
 
22
23
  # Only add handler if none exists
23
24
  if not logger.handlers:
24
- handler = IRISLogHandler(class_name, method_name, to_console)
25
+ handler = IRISLogHandler(to_console=to_console)
25
26
  formatter = logging.Formatter('%(message)s')
26
27
  handler.setFormatter(formatter)
27
28
  logger.addHandler(handler)
@@ -33,17 +34,9 @@ class LogManager:
33
34
  class IRISLogHandler(logging.Handler):
34
35
  """Custom logging handler that routes Python logs to IRIS logging system."""
35
36
 
36
- def __init__(self, class_name: str, method_name: Optional[str] = None, to_console: bool = False):
37
- """Initialize the handler with context information.
38
-
39
- Args:
40
- class_name: Name of the class logging the message
41
- method_name: Optional name of the method logging the message
42
- console: If True, log to the console instead of IRIS
43
- """
37
+ def __init__(self, to_console: bool = False):
38
+ """Initialize the IRIS logging handler."""
44
39
  super().__init__()
45
- self.class_name = class_name
46
- self.method_name = method_name
47
40
  self.to_console = to_console
48
41
 
49
42
  # Map Python logging levels to IRIS logging methods
@@ -80,10 +73,11 @@ class IRISLogHandler(logging.Handler):
80
73
  Args:
81
74
  record: The logging record to emit
82
75
  """
83
-
84
- log_func = self.level_map.get(record.levelno, iris.cls("Ens.Util.Log").LogInfo)
76
+ class_name = record.class_name if hasattr(record, "class_name") else record.name
77
+ method_name = record.method_name if hasattr(record, "method_name") else record.funcName
85
78
  if self.to_console or (hasattr(record, "to_console") and record.to_console):
86
79
  iris.cls("%SYS.System").WriteToConsoleLog(self.format(record),
87
- 0,self.level_map_console.get(record.levelno, 0),record.name)
80
+ 0,self.level_map_console.get(record.levelno, 0),class_name+"."+method_name)
88
81
  else:
89
- log_func(self.class_name, self.method_name, self.format(record))
82
+ log_func = self.level_map.get(record.levelno, iris.cls("Ens.Util.Log").LogInfo)
83
+ log_func(class_name, method_name, self.format(record))
iop/_utils.py CHANGED
@@ -7,6 +7,7 @@ import xmltodict
7
7
  import pkg_resources
8
8
  import importlib
9
9
  import json
10
+ from iop._message import _Message, _PydanticMessage
10
11
  from dc_schema import get_schema
11
12
 
12
13
  class _Utils():
@@ -42,7 +43,12 @@ class _Utils():
42
43
 
43
44
  :param cls: The class to register
44
45
  """
45
- schema = get_schema(cls)
46
+ if issubclass(cls,_PydanticMessage):
47
+ schema = cls.model_json_schema()
48
+ elif issubclass(cls,_Message):
49
+ schema = get_schema(cls)
50
+ else:
51
+ raise ValueError("The class must be a subclass of _Message or _PydanticMessage")
46
52
  schema_name = cls.__module__ + '.' + cls.__name__
47
53
  schema_str = json.dumps(schema)
48
54
  categories = schema_name
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: iris_pex_embedded_python
3
- Version: 3.4.0b2
3
+ Version: 3.4.0b3
4
4
  Summary: Iris Interoperability based on Embedded Python
5
5
  Author-email: grongier <guillaume.rongier@intersystems.com>
6
6
  License: MIT License
@@ -98,19 +98,19 @@ iop/_business_operation.py,sha256=ml4BIn1BfrGx8AUGISFR71DZIUCP8vZ2yn9SQjaSzTM,30
98
98
  iop/_business_process.py,sha256=hj6nDIP5Mz5UYbm0vDjvs9lPSEYVQxGJl6tQRcDGTBk,8548
99
99
  iop/_business_service.py,sha256=lPTp3_tcLTOWvHlE_YwrcImLGf1PJBUgIOrV-8ctFLw,3851
100
100
  iop/_cli.py,sha256=IwvVxglSTVkCDXwANLMqnd8mfxGtWB6GjBSdEy8EMm0,7551
101
- iop/_common.py,sha256=E_Mn2t--klAtT4p1MzW1KtcKcLrB1g4Flq5H4JlV8Vs,11619
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
104
  iop/_dispatch.py,sha256=q9oCE4b5FazW1t2oczvBGQtKzip_-yykY9WvXUp1urE,6775
105
105
  iop/_inbound_adapter.py,sha256=PS5ToqhrYcXq9ZdLbCBqAfVp8kCeRACm_KF66pwBO9U,1652
106
- iop/_log_manager.py,sha256=PZnGWsi-zvWo-bumQO5BK-8kHG2XW-WnZ6ShL7QeZ4c,3499
106
+ iop/_log_manager.py,sha256=f9T8yhcVJlCVNY7E_tb2e65QB_rJWYNF6J586OV2ukA,3240
107
107
  iop/_message.py,sha256=pJQOjRIdw4wSDoJamvItGODMe-UjDU71XihgWdtCAqc,1120
108
108
  iop/_message_validator.py,sha256=K6FxLe72gBHQXZTLVrFw87rABGM0F6CTaNtZ2MqJoss,1408
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
112
  iop/_serialization.py,sha256=hGpFYHWjYRcDuQv4Ml9N16onW8vmHGhDwA3bv_NwFnM,8923
113
- iop/_utils.py,sha256=Aqtp9Jx3ghzkNs4f2cOZXYwv8cGsjmdBocnkP64fa3M,19574
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
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.0b2.dist-info/LICENSE,sha256=rZSiBFId_sfbJ6RL0GjjPX-InNLkNS9ou7eQsikciI8,1089
139
- iris_pex_embedded_python-3.4.0b2.dist-info/METADATA,sha256=wSmLx_zkXK9oTutFdot5ManhtmjC7_-eYrZLeCC4w_Q,4458
140
- iris_pex_embedded_python-3.4.0b2.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
141
- iris_pex_embedded_python-3.4.0b2.dist-info/entry_points.txt,sha256=pj-i4LSDyiSP6xpHlVjMCbg1Pik7dC3_sdGY3Yp9Vhk,38
142
- iris_pex_embedded_python-3.4.0b2.dist-info/top_level.txt,sha256=VWDlX4YF4qFVRGrG3-Gs0kgREol02i8gIpsHNbhfFPw,42
143
- iris_pex_embedded_python-3.4.0b2.dist-info/RECORD,,
138
+ iris_pex_embedded_python-3.4.0b3.dist-info/LICENSE,sha256=rZSiBFId_sfbJ6RL0GjjPX-InNLkNS9ou7eQsikciI8,1089
139
+ iris_pex_embedded_python-3.4.0b3.dist-info/METADATA,sha256=IKYFmzgZt7oSXALO_VUWgkvu9NO5BI_bxug6IxZXFLE,4458
140
+ iris_pex_embedded_python-3.4.0b3.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
141
+ iris_pex_embedded_python-3.4.0b3.dist-info/entry_points.txt,sha256=pj-i4LSDyiSP6xpHlVjMCbg1Pik7dC3_sdGY3Yp9Vhk,38
142
+ iris_pex_embedded_python-3.4.0b3.dist-info/top_level.txt,sha256=VWDlX4YF4qFVRGrG3-Gs0kgREol02i8gIpsHNbhfFPw,42
143
+ iris_pex_embedded_python-3.4.0b3.dist-info/RECORD,,