exonware-xwsystem 0.0.1.409__py3-none-any.whl → 0.0.1.411__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.
Files changed (260) hide show
  1. exonware/__init__.py +2 -2
  2. exonware/conf.py +10 -20
  3. exonware/xwsystem/__init__.py +6 -16
  4. exonware/xwsystem/caching/__init__.py +1 -1
  5. exonware/xwsystem/caching/base.py +16 -16
  6. exonware/xwsystem/caching/bloom_cache.py +5 -5
  7. exonware/xwsystem/caching/cache_manager.py +2 -2
  8. exonware/xwsystem/caching/conditional.py +4 -4
  9. exonware/xwsystem/caching/contracts.py +12 -12
  10. exonware/xwsystem/caching/decorators.py +2 -2
  11. exonware/xwsystem/caching/defs.py +1 -1
  12. exonware/xwsystem/caching/disk_cache.py +4 -4
  13. exonware/xwsystem/caching/distributed.py +1 -1
  14. exonware/xwsystem/caching/errors.py +1 -1
  15. exonware/xwsystem/caching/events.py +8 -8
  16. exonware/xwsystem/caching/eviction_strategies.py +9 -9
  17. exonware/xwsystem/caching/fluent.py +1 -1
  18. exonware/xwsystem/caching/integrity.py +1 -1
  19. exonware/xwsystem/caching/lfu_cache.py +24 -9
  20. exonware/xwsystem/caching/lfu_optimized.py +21 -21
  21. exonware/xwsystem/caching/lru_cache.py +14 -7
  22. exonware/xwsystem/caching/memory_bounded.py +8 -8
  23. exonware/xwsystem/caching/metrics_exporter.py +6 -6
  24. exonware/xwsystem/caching/observable_cache.py +1 -1
  25. exonware/xwsystem/caching/pluggable_cache.py +9 -9
  26. exonware/xwsystem/caching/rate_limiter.py +1 -1
  27. exonware/xwsystem/caching/read_through.py +6 -6
  28. exonware/xwsystem/caching/secure_cache.py +1 -1
  29. exonware/xwsystem/caching/serializable.py +3 -3
  30. exonware/xwsystem/caching/stats.py +7 -7
  31. exonware/xwsystem/caching/tagging.py +11 -11
  32. exonware/xwsystem/caching/ttl_cache.py +21 -6
  33. exonware/xwsystem/caching/two_tier_cache.py +5 -5
  34. exonware/xwsystem/caching/utils.py +3 -3
  35. exonware/xwsystem/caching/validation.py +1 -1
  36. exonware/xwsystem/caching/warming.py +9 -9
  37. exonware/xwsystem/caching/write_behind.py +5 -5
  38. exonware/xwsystem/cli/__init__.py +1 -1
  39. exonware/xwsystem/cli/args.py +10 -10
  40. exonware/xwsystem/cli/base.py +15 -15
  41. exonware/xwsystem/cli/colors.py +1 -1
  42. exonware/xwsystem/cli/console.py +1 -1
  43. exonware/xwsystem/cli/contracts.py +5 -5
  44. exonware/xwsystem/cli/defs.py +1 -1
  45. exonware/xwsystem/cli/errors.py +1 -1
  46. exonware/xwsystem/cli/progress.py +1 -1
  47. exonware/xwsystem/cli/prompts.py +1 -1
  48. exonware/xwsystem/cli/tables.py +7 -7
  49. exonware/xwsystem/config/__init__.py +1 -1
  50. exonware/xwsystem/config/base.py +14 -14
  51. exonware/xwsystem/config/contracts.py +22 -22
  52. exonware/xwsystem/config/defaults.py +2 -2
  53. exonware/xwsystem/config/defs.py +1 -1
  54. exonware/xwsystem/config/errors.py +2 -2
  55. exonware/xwsystem/config/logging.py +1 -1
  56. exonware/xwsystem/config/logging_setup.py +2 -2
  57. exonware/xwsystem/config/performance.py +7 -7
  58. exonware/xwsystem/config/performance_modes.py +20 -20
  59. exonware/xwsystem/config/version_manager.py +4 -4
  60. exonware/xwsystem/{http → http_client}/__init__.py +1 -1
  61. exonware/xwsystem/{http → http_client}/advanced_client.py +20 -20
  62. exonware/xwsystem/{http → http_client}/base.py +13 -13
  63. exonware/xwsystem/{http → http_client}/client.py +43 -43
  64. exonware/xwsystem/{http → http_client}/contracts.py +5 -5
  65. exonware/xwsystem/{http → http_client}/defs.py +2 -2
  66. exonware/xwsystem/{http → http_client}/errors.py +2 -2
  67. exonware/xwsystem/io/__init__.py +1 -1
  68. exonware/xwsystem/io/archive/__init__.py +1 -1
  69. exonware/xwsystem/io/archive/archive.py +5 -5
  70. exonware/xwsystem/io/archive/archive_files.py +8 -8
  71. exonware/xwsystem/io/archive/archivers.py +3 -3
  72. exonware/xwsystem/io/archive/base.py +17 -17
  73. exonware/xwsystem/io/archive/codec_integration.py +1 -1
  74. exonware/xwsystem/io/archive/compression.py +1 -1
  75. exonware/xwsystem/io/archive/formats/__init__.py +1 -1
  76. exonware/xwsystem/io/archive/formats/brotli_format.py +12 -9
  77. exonware/xwsystem/io/archive/formats/lz4_format.py +12 -9
  78. exonware/xwsystem/io/archive/formats/rar.py +12 -9
  79. exonware/xwsystem/io/archive/formats/sevenzip.py +12 -9
  80. exonware/xwsystem/io/archive/formats/squashfs_format.py +7 -7
  81. exonware/xwsystem/io/archive/formats/tar.py +8 -8
  82. exonware/xwsystem/io/archive/formats/wim_format.py +12 -9
  83. exonware/xwsystem/io/archive/formats/zip.py +8 -8
  84. exonware/xwsystem/io/archive/formats/zpaq_format.py +7 -7
  85. exonware/xwsystem/io/archive/formats/zstandard.py +12 -9
  86. exonware/xwsystem/io/base.py +17 -17
  87. exonware/xwsystem/io/codec/__init__.py +1 -1
  88. exonware/xwsystem/io/codec/base.py +261 -14
  89. exonware/xwsystem/io/codec/contracts.py +3 -6
  90. exonware/xwsystem/io/codec/registry.py +29 -29
  91. exonware/xwsystem/io/common/__init__.py +1 -1
  92. exonware/xwsystem/io/common/atomic.py +2 -2
  93. exonware/xwsystem/io/common/base.py +1 -1
  94. exonware/xwsystem/io/common/lock.py +1 -1
  95. exonware/xwsystem/io/common/watcher.py +4 -4
  96. exonware/xwsystem/io/contracts.py +34 -39
  97. exonware/xwsystem/io/data_operations.py +480 -0
  98. exonware/xwsystem/io/defs.py +2 -2
  99. exonware/xwsystem/io/errors.py +32 -3
  100. exonware/xwsystem/io/facade.py +4 -4
  101. exonware/xwsystem/io/file/__init__.py +1 -1
  102. exonware/xwsystem/io/file/base.py +2 -2
  103. exonware/xwsystem/io/file/conversion.py +1 -1
  104. exonware/xwsystem/io/file/file.py +10 -8
  105. exonware/xwsystem/io/file/paged_source.py +8 -1
  106. exonware/xwsystem/io/file/paging/__init__.py +1 -1
  107. exonware/xwsystem/io/file/paging/byte_paging.py +1 -1
  108. exonware/xwsystem/io/file/paging/line_paging.py +1 -1
  109. exonware/xwsystem/io/file/paging/record_paging.py +1 -1
  110. exonware/xwsystem/io/file/paging/registry.py +5 -5
  111. exonware/xwsystem/io/file/source.py +22 -11
  112. exonware/xwsystem/io/filesystem/__init__.py +1 -1
  113. exonware/xwsystem/io/filesystem/base.py +1 -1
  114. exonware/xwsystem/io/filesystem/local.py +9 -1
  115. exonware/xwsystem/io/folder/__init__.py +1 -1
  116. exonware/xwsystem/io/folder/base.py +2 -2
  117. exonware/xwsystem/io/folder/folder.py +6 -6
  118. exonware/xwsystem/io/serialization/__init__.py +1 -1
  119. exonware/xwsystem/io/serialization/auto_serializer.py +53 -40
  120. exonware/xwsystem/io/serialization/base.py +248 -35
  121. exonware/xwsystem/io/serialization/contracts.py +93 -4
  122. exonware/xwsystem/io/serialization/defs.py +1 -1
  123. exonware/xwsystem/io/serialization/errors.py +1 -1
  124. exonware/xwsystem/io/serialization/flyweight.py +22 -22
  125. exonware/xwsystem/io/serialization/format_detector.py +18 -15
  126. exonware/xwsystem/io/serialization/formats/__init__.py +1 -1
  127. exonware/xwsystem/io/serialization/formats/binary/bson.py +1 -1
  128. exonware/xwsystem/io/serialization/formats/binary/cbor.py +1 -1
  129. exonware/xwsystem/io/serialization/formats/binary/marshal.py +1 -1
  130. exonware/xwsystem/io/serialization/formats/binary/msgpack.py +1 -1
  131. exonware/xwsystem/io/serialization/formats/binary/pickle.py +1 -1
  132. exonware/xwsystem/io/serialization/formats/binary/plistlib.py +1 -1
  133. exonware/xwsystem/io/serialization/formats/database/dbm.py +53 -1
  134. exonware/xwsystem/io/serialization/formats/database/shelve.py +48 -1
  135. exonware/xwsystem/io/serialization/formats/database/sqlite3.py +85 -1
  136. exonware/xwsystem/io/serialization/formats/text/configparser.py +2 -2
  137. exonware/xwsystem/io/serialization/formats/text/csv.py +2 -2
  138. exonware/xwsystem/io/serialization/formats/text/formdata.py +2 -2
  139. exonware/xwsystem/io/serialization/formats/text/json.py +23 -5
  140. exonware/xwsystem/io/serialization/formats/text/json5.py +98 -13
  141. exonware/xwsystem/io/serialization/formats/text/jsonlines.py +230 -20
  142. exonware/xwsystem/io/serialization/formats/text/multipart.py +2 -2
  143. exonware/xwsystem/io/serialization/formats/text/toml.py +65 -4
  144. exonware/xwsystem/io/serialization/formats/text/xml.py +451 -69
  145. exonware/xwsystem/io/serialization/formats/text/yaml.py +52 -2
  146. exonware/xwsystem/io/serialization/registry.py +5 -5
  147. exonware/xwsystem/io/serialization/serializer.py +184 -12
  148. exonware/xwsystem/io/serialization/utils/__init__.py +1 -1
  149. exonware/xwsystem/io/serialization/utils/path_ops.py +3 -3
  150. exonware/xwsystem/io/stream/__init__.py +1 -1
  151. exonware/xwsystem/io/stream/async_operations.py +3 -3
  152. exonware/xwsystem/io/stream/base.py +3 -7
  153. exonware/xwsystem/io/stream/codec_io.py +4 -7
  154. exonware/xwsystem/ipc/async_fabric.py +7 -8
  155. exonware/xwsystem/ipc/base.py +9 -9
  156. exonware/xwsystem/ipc/contracts.py +5 -5
  157. exonware/xwsystem/ipc/defs.py +1 -1
  158. exonware/xwsystem/ipc/errors.py +2 -2
  159. exonware/xwsystem/ipc/message_queue.py +4 -6
  160. exonware/xwsystem/ipc/pipes.py +2 -2
  161. exonware/xwsystem/ipc/process_manager.py +7 -7
  162. exonware/xwsystem/ipc/process_pool.py +8 -8
  163. exonware/xwsystem/ipc/shared_memory.py +7 -7
  164. exonware/xwsystem/monitoring/base.py +33 -33
  165. exonware/xwsystem/monitoring/contracts.py +27 -27
  166. exonware/xwsystem/monitoring/defs.py +1 -1
  167. exonware/xwsystem/monitoring/error_recovery.py +16 -16
  168. exonware/xwsystem/monitoring/errors.py +2 -2
  169. exonware/xwsystem/monitoring/memory_monitor.py +12 -12
  170. exonware/xwsystem/monitoring/metrics.py +8 -8
  171. exonware/xwsystem/monitoring/performance_manager_generic.py +20 -20
  172. exonware/xwsystem/monitoring/performance_monitor.py +11 -11
  173. exonware/xwsystem/monitoring/performance_validator.py +21 -21
  174. exonware/xwsystem/monitoring/system_monitor.py +17 -17
  175. exonware/xwsystem/monitoring/tracing.py +20 -20
  176. exonware/xwsystem/monitoring/tracker.py +7 -7
  177. exonware/xwsystem/operations/__init__.py +5 -5
  178. exonware/xwsystem/operations/base.py +3 -3
  179. exonware/xwsystem/operations/contracts.py +3 -3
  180. exonware/xwsystem/operations/defs.py +5 -5
  181. exonware/xwsystem/operations/diff.py +5 -5
  182. exonware/xwsystem/operations/merge.py +2 -2
  183. exonware/xwsystem/operations/patch.py +5 -5
  184. exonware/xwsystem/patterns/base.py +4 -4
  185. exonware/xwsystem/patterns/context_manager.py +7 -7
  186. exonware/xwsystem/patterns/contracts.py +29 -31
  187. exonware/xwsystem/patterns/defs.py +1 -1
  188. exonware/xwsystem/patterns/dynamic_facade.py +9 -9
  189. exonware/xwsystem/patterns/errors.py +10 -10
  190. exonware/xwsystem/patterns/handler_factory.py +15 -14
  191. exonware/xwsystem/patterns/import_registry.py +22 -22
  192. exonware/xwsystem/patterns/object_pool.py +14 -13
  193. exonware/xwsystem/patterns/registry.py +45 -32
  194. exonware/xwsystem/plugins/__init__.py +1 -1
  195. exonware/xwsystem/plugins/base.py +25 -25
  196. exonware/xwsystem/plugins/contracts.py +28 -28
  197. exonware/xwsystem/plugins/defs.py +1 -1
  198. exonware/xwsystem/plugins/errors.py +9 -9
  199. exonware/xwsystem/runtime/__init__.py +1 -1
  200. exonware/xwsystem/runtime/base.py +42 -42
  201. exonware/xwsystem/runtime/contracts.py +9 -9
  202. exonware/xwsystem/runtime/defs.py +1 -1
  203. exonware/xwsystem/runtime/env.py +9 -9
  204. exonware/xwsystem/runtime/errors.py +1 -1
  205. exonware/xwsystem/runtime/reflection.py +15 -15
  206. exonware/xwsystem/security/auth.py +47 -15
  207. exonware/xwsystem/security/base.py +17 -17
  208. exonware/xwsystem/security/contracts.py +30 -30
  209. exonware/xwsystem/security/crypto.py +8 -8
  210. exonware/xwsystem/security/defs.py +1 -1
  211. exonware/xwsystem/security/errors.py +2 -2
  212. exonware/xwsystem/security/hazmat.py +7 -7
  213. exonware/xwsystem/security/path_validator.py +1 -1
  214. exonware/xwsystem/shared/__init__.py +1 -1
  215. exonware/xwsystem/shared/base.py +14 -14
  216. exonware/xwsystem/shared/contracts.py +6 -6
  217. exonware/xwsystem/shared/defs.py +1 -1
  218. exonware/xwsystem/shared/errors.py +1 -1
  219. exonware/xwsystem/structures/__init__.py +1 -1
  220. exonware/xwsystem/structures/base.py +29 -29
  221. exonware/xwsystem/structures/circular_detector.py +15 -15
  222. exonware/xwsystem/structures/contracts.py +9 -9
  223. exonware/xwsystem/structures/defs.py +1 -1
  224. exonware/xwsystem/structures/errors.py +2 -2
  225. exonware/xwsystem/structures/tree_walker.py +8 -8
  226. exonware/xwsystem/threading/async_primitives.py +7 -7
  227. exonware/xwsystem/threading/base.py +19 -19
  228. exonware/xwsystem/threading/contracts.py +13 -13
  229. exonware/xwsystem/threading/defs.py +1 -1
  230. exonware/xwsystem/threading/errors.py +2 -2
  231. exonware/xwsystem/threading/safe_factory.py +13 -12
  232. exonware/xwsystem/utils/base.py +34 -34
  233. exonware/xwsystem/utils/contracts.py +9 -9
  234. exonware/xwsystem/utils/dt/__init__.py +1 -1
  235. exonware/xwsystem/utils/dt/base.py +6 -6
  236. exonware/xwsystem/utils/dt/contracts.py +2 -2
  237. exonware/xwsystem/utils/dt/defs.py +1 -1
  238. exonware/xwsystem/utils/dt/errors.py +2 -2
  239. exonware/xwsystem/utils/dt/formatting.py +3 -3
  240. exonware/xwsystem/utils/dt/humanize.py +2 -2
  241. exonware/xwsystem/utils/dt/parsing.py +2 -2
  242. exonware/xwsystem/utils/dt/timezone_utils.py +5 -5
  243. exonware/xwsystem/utils/errors.py +2 -2
  244. exonware/xwsystem/utils/test_runner.py +6 -6
  245. exonware/xwsystem/utils/utils_contracts.py +1 -1
  246. exonware/xwsystem/validation/__init__.py +1 -1
  247. exonware/xwsystem/validation/base.py +48 -48
  248. exonware/xwsystem/validation/contracts.py +8 -8
  249. exonware/xwsystem/validation/data_validator.py +10 -0
  250. exonware/xwsystem/validation/declarative.py +15 -15
  251. exonware/xwsystem/validation/defs.py +1 -1
  252. exonware/xwsystem/validation/errors.py +2 -2
  253. exonware/xwsystem/validation/fluent_validator.py +10 -10
  254. exonware/xwsystem/version.py +2 -2
  255. {exonware_xwsystem-0.0.1.409.dist-info → exonware_xwsystem-0.0.1.411.dist-info}/METADATA +9 -11
  256. exonware_xwsystem-0.0.1.411.dist-info/RECORD +274 -0
  257. {exonware_xwsystem-0.0.1.409.dist-info → exonware_xwsystem-0.0.1.411.dist-info}/WHEEL +1 -1
  258. exonware/xwsystem/lazy_bootstrap.py +0 -79
  259. exonware_xwsystem-0.0.1.409.dist-info/RECORD +0 -274
  260. {exonware_xwsystem-0.0.1.409.dist-info → exonware_xwsystem-0.0.1.411.dist-info}/licenses/LICENSE +0 -0
@@ -16,7 +16,7 @@ import time
16
16
  import signal
17
17
  import subprocess
18
18
  import multiprocessing as mp
19
- from typing import Dict, List, Optional, Callable, Any, Union
19
+ from typing import Optional, Callable, Any, Union
20
20
  from dataclasses import dataclass
21
21
  from threading import Lock, Event
22
22
  import logging
@@ -29,7 +29,7 @@ class ProcessInfo:
29
29
  """Information about a managed process."""
30
30
  pid: int
31
31
  name: str
32
- command: List[str]
32
+ command: list[str]
33
33
  started_at: float
34
34
  status: str # 'running', 'stopped', 'failed', 'terminated'
35
35
  exit_code: Optional[int] = None
@@ -60,8 +60,8 @@ class ProcessManager:
60
60
  """
61
61
  self.max_processes = max_processes or mp.cpu_count() * 2
62
62
  self.monitor_interval = monitor_interval
63
- self.processes: Dict[str, subprocess.Popen] = {}
64
- self.process_info: Dict[str, ProcessInfo] = {}
63
+ self.processes: dict[str, subprocess.Popen] = {}
64
+ self.process_info: dict[str, ProcessInfo] = {}
65
65
  self._lock = Lock()
66
66
  self._shutdown_event = Event()
67
67
  self._monitor_thread = None
@@ -74,9 +74,9 @@ class ProcessManager:
74
74
 
75
75
  def start_process(self,
76
76
  name: str,
77
- command: Union[str, List[str]],
77
+ command: Union[str, list[str]],
78
78
  cwd: Optional[str] = None,
79
- env: Optional[Dict[str, str]] = None,
79
+ env: Optional[dict[str, str]] = None,
80
80
  shell: bool = False) -> bool:
81
81
  """
82
82
  Start a new managed process.
@@ -227,7 +227,7 @@ class ProcessManager:
227
227
  with self._lock:
228
228
  return self.process_info.get(name)
229
229
 
230
- def list_processes(self) -> List[ProcessInfo]:
230
+ def list_processes(self) -> list[ProcessInfo]:
231
231
  """List all managed processes."""
232
232
  with self._lock:
233
233
  return list(self.process_info.values())
@@ -17,7 +17,7 @@ import logging
17
17
  import multiprocessing as mp
18
18
  import time
19
19
  from dataclasses import dataclass
20
- from typing import Any, Callable, Dict, List, Optional, Union
20
+ from typing import Any, Callable, Optional, Union
21
21
 
22
22
  logger = logging.getLogger(__name__)
23
23
 
@@ -79,8 +79,8 @@ class ProcessPool:
79
79
  )
80
80
 
81
81
  # Task tracking
82
- self._active_tasks: Dict[str, concurrent.futures.Future] = {}
83
- self._completed_tasks: List[TaskResult] = []
82
+ self._active_tasks: dict[str, concurrent.futures.Future] = {}
83
+ self._completed_tasks: list[TaskResult] = []
84
84
  self._task_counter = 0
85
85
 
86
86
  # Statistics
@@ -202,7 +202,7 @@ class ProcessPool:
202
202
 
203
203
  return None
204
204
 
205
- def wait_for_all(self, timeout: Optional[float] = None) -> List[TaskResult]:
205
+ def wait_for_all(self, timeout: Optional[float] = None) -> list[TaskResult]:
206
206
  """
207
207
  Wait for all active tasks to complete.
208
208
 
@@ -247,7 +247,7 @@ class ProcessPool:
247
247
 
248
248
  return cancelled
249
249
 
250
- def get_active_tasks(self) -> List[str]:
250
+ def get_active_tasks(self) -> list[str]:
251
251
  """Get list of active task IDs."""
252
252
  return list(self._active_tasks.keys())
253
253
 
@@ -321,7 +321,7 @@ class AsyncProcessPool:
321
321
  self._loop: Optional[asyncio.AbstractEventLoop] = None
322
322
 
323
323
  # Task tracking
324
- self._active_tasks: Dict[str, asyncio.Task] = {}
324
+ self._active_tasks: dict[str, asyncio.Task] = {}
325
325
  self._task_counter = 0
326
326
 
327
327
  def _ensure_executor(self):
@@ -397,7 +397,7 @@ class AsyncProcessPool:
397
397
  else:
398
398
  return await task
399
399
 
400
- async def wait_for_all(self, timeout: Optional[float] = None) -> List[Any]:
400
+ async def wait_for_all(self, timeout: Optional[float] = None) -> list[Any]:
401
401
  """
402
402
  Wait for all active tasks to complete.
403
403
 
@@ -454,7 +454,7 @@ class AsyncProcessPool:
454
454
 
455
455
  return cancelled
456
456
 
457
- def get_active_tasks(self) -> List[str]:
457
+ def get_active_tasks(self) -> list[str]:
458
458
  """Get list of active task IDs."""
459
459
  return list(self._active_tasks.keys())
460
460
 
@@ -16,16 +16,16 @@ import mmap
16
16
  import struct
17
17
  import pickle
18
18
  import threading
19
- from typing import Any, Dict, Optional, Union, TypeVar, Generic
19
+ from typing import Any, Optional, Union
20
+ # Root cause: Migrating to Python 3.12 built-in generic syntax for consistency
21
+ # Priority #3: Maintainability - Modern type annotations improve code clarity
20
22
  from contextlib import contextmanager
21
23
  import logging
22
24
 
23
25
  logger = logging.getLogger(__name__)
24
26
 
25
- T = TypeVar('T')
26
27
 
27
-
28
- class SharedData(Generic[T]):
28
+ class SharedData[T]:
29
29
  """
30
30
  Thread-safe shared data container with automatic serialization.
31
31
 
@@ -68,7 +68,7 @@ class SharedData(Generic[T]):
68
68
  # Unix: Use /dev/shm or temporary files
69
69
  import tempfile
70
70
  self._file_handle = tempfile.NamedTemporaryFile(
71
- prefix=f"xsystem_shared_{self.name}_",
71
+ prefix=f"xwsystem_shared_{self.name}_",
72
72
  delete=False
73
73
  )
74
74
  self._file_handle.write(b'\x00' * self.size)
@@ -242,7 +242,7 @@ class SharedMemoryManager:
242
242
  """
243
243
 
244
244
  def __init__(self):
245
- self._segments: Dict[str, SharedData] = {}
245
+ self._segments: dict[str, SharedData] = {}
246
246
  self._lock = threading.RLock()
247
247
 
248
248
  def create_segment(self, name: str, size: int = 1024 * 1024) -> SharedData:
@@ -364,7 +364,7 @@ class SharedMemory:
364
364
  name: Name for the shared memory segment
365
365
  size: Size of the memory segment
366
366
  """
367
- self.name = name or f"xsystem_shared_{os.getpid()}"
367
+ self.name = name or f"xwsystem_shared_{os.getpid()}"
368
368
  self.size = size
369
369
  self._manager = SharedMemoryManager()
370
370
  self._segment = None
@@ -1,16 +1,16 @@
1
- #exonware/xsystem/monitoring/base.py
1
+ #exonware/xwsystem/monitoring/base.py
2
2
  """
3
3
  Company: eXonware.com
4
4
  Author: Eng. Muhammad AlShehri
5
5
  Email: connect@exonware.com
6
- Version: 0.0.1.409
6
+ Version: 0.0.1.411
7
7
  Generation Date: September 04, 2025
8
8
 
9
9
  Monitoring module base classes - abstract classes for monitoring functionality.
10
10
  """
11
11
 
12
12
  from abc import ABC, abstractmethod
13
- from typing import Any, Dict, List, Optional, Union, Callable, TYPE_CHECKING
13
+ from typing import Any, Optional, Union, Callable, TYPE_CHECKING
14
14
  from .defs import MetricType, AlertLevel, HealthStatus, SpanKind
15
15
 
16
16
  if TYPE_CHECKING:
@@ -28,9 +28,9 @@ class APerformanceMonitorBase(ABC):
28
28
  monitor_name: Name of the performance monitor
29
29
  """
30
30
  self.monitor_name = monitor_name
31
- self._metrics: Dict[str, Any] = {}
32
- self._thresholds: Dict[str, float] = {}
33
- self._alerts: List[Dict[str, Any]] = []
31
+ self._metrics: dict[str, Any] = {}
32
+ self._thresholds: dict[str, float] = {}
33
+ self._alerts: list[dict[str, Any]] = []
34
34
 
35
35
  @abstractmethod
36
36
  def start_monitoring(self) -> None:
@@ -58,7 +58,7 @@ class APerformanceMonitorBase(ABC):
58
58
  pass
59
59
 
60
60
  @abstractmethod
61
- def get_all_metrics(self) -> Dict[str, float]:
61
+ def get_all_metrics(self) -> dict[str, float]:
62
62
  """Get all metrics."""
63
63
  pass
64
64
 
@@ -68,12 +68,12 @@ class APerformanceMonitorBase(ABC):
68
68
  pass
69
69
 
70
70
  @abstractmethod
71
- def check_thresholds(self) -> List[Dict[str, Any]]:
71
+ def check_thresholds(self) -> list[dict[str, Any]]:
72
72
  """Check if any metrics exceed thresholds."""
73
73
  pass
74
74
 
75
75
  @abstractmethod
76
- def get_performance_summary(self) -> Dict[str, Any]:
76
+ def get_performance_summary(self) -> dict[str, Any]:
77
77
  """Get performance summary."""
78
78
  pass
79
79
 
@@ -83,7 +83,7 @@ class AMemoryMonitorBase(ABC):
83
83
 
84
84
  def __init__(self):
85
85
  """Initialize memory monitor."""
86
- self._memory_snapshots: List[Dict[str, Any]] = []
86
+ self._memory_snapshots: list[dict[str, Any]] = []
87
87
  self._leak_detection_enabled = False
88
88
 
89
89
  @abstractmethod
@@ -97,22 +97,22 @@ class AMemoryMonitorBase(ABC):
97
97
  pass
98
98
 
99
99
  @abstractmethod
100
- def take_snapshot(self) -> Dict[str, Any]:
100
+ def take_snapshot(self) -> dict[str, Any]:
101
101
  """Take memory snapshot."""
102
102
  pass
103
103
 
104
104
  @abstractmethod
105
- def get_memory_usage(self) -> Dict[str, float]:
105
+ def get_memory_usage(self) -> dict[str, float]:
106
106
  """Get current memory usage."""
107
107
  pass
108
108
 
109
109
  @abstractmethod
110
- def detect_memory_leaks(self) -> List[Dict[str, Any]]:
110
+ def detect_memory_leaks(self) -> list[dict[str, Any]]:
111
111
  """Detect potential memory leaks."""
112
112
  pass
113
113
 
114
114
  @abstractmethod
115
- def get_memory_stats(self) -> Dict[str, Any]:
115
+ def get_memory_stats(self) -> dict[str, Any]:
116
116
  """Get memory statistics."""
117
117
  pass
118
118
 
@@ -122,7 +122,7 @@ class AMemoryMonitorBase(ABC):
122
122
  pass
123
123
 
124
124
  @abstractmethod
125
- def get_garbage_collection_stats(self) -> Dict[str, Any]:
125
+ def get_garbage_collection_stats(self) -> dict[str, Any]:
126
126
  """Get garbage collection statistics."""
127
127
  pass
128
128
 
@@ -143,10 +143,10 @@ class AMetricsBase(ABC):
143
143
  metrics_name: Name of the metrics collector
144
144
  """
145
145
  self.metrics_name = metrics_name
146
- self._counters: Dict[str, int] = {}
147
- self._gauges: Dict[str, float] = {}
148
- self._histograms: Dict[str, List[float]] = {}
149
- self._timers: Dict[str, List[float]] = {}
146
+ self._counters: dict[str, int] = {}
147
+ self._gauges: dict[str, float] = {}
148
+ self._histograms: dict[str, list[float]] = {}
149
+ self._timers: dict[str, list[float]] = {}
150
150
 
151
151
  @abstractmethod
152
152
  def increment_counter(self, name: str, value: int = 1) -> None:
@@ -179,17 +179,17 @@ class AMetricsBase(ABC):
179
179
  pass
180
180
 
181
181
  @abstractmethod
182
- def get_histogram_stats(self, name: str) -> Dict[str, float]:
182
+ def get_histogram_stats(self, name: str) -> dict[str, float]:
183
183
  """Get histogram statistics."""
184
184
  pass
185
185
 
186
186
  @abstractmethod
187
- def get_timer_stats(self, name: str) -> Dict[str, float]:
187
+ def get_timer_stats(self, name: str) -> dict[str, float]:
188
188
  """Get timer statistics."""
189
189
  pass
190
190
 
191
191
  @abstractmethod
192
- def export_metrics(self) -> Dict[str, Any]:
192
+ def export_metrics(self) -> dict[str, Any]:
193
193
  """Export all metrics."""
194
194
  pass
195
195
 
@@ -204,8 +204,8 @@ class AErrorRecoveryBase(ABC):
204
204
 
205
205
  def __init__(self):
206
206
  """Initialize error recovery."""
207
- self._recovery_strategies: Dict[str, Callable] = {}
208
- self._circuit_breakers: Dict[str, Dict[str, Any]] = {}
207
+ self._recovery_strategies: dict[str, Callable] = {}
208
+ self._circuit_breakers: dict[str, dict[str, Any]] = {}
209
209
 
210
210
  @abstractmethod
211
211
  def register_recovery_strategy(self, error_type: str, strategy: Callable) -> None:
@@ -213,7 +213,7 @@ class AErrorRecoveryBase(ABC):
213
213
  pass
214
214
 
215
215
  @abstractmethod
216
- def handle_error(self, error: Exception, context: Dict[str, Any]) -> bool:
216
+ def handle_error(self, error: Exception, context: dict[str, Any]) -> bool:
217
217
  """Handle error with recovery strategy."""
218
218
  pass
219
219
 
@@ -239,7 +239,7 @@ class AErrorRecoveryBase(ABC):
239
239
  pass
240
240
 
241
241
  @abstractmethod
242
- def get_circuit_state(self, name: str) -> Dict[str, Any]:
242
+ def get_circuit_state(self, name: str) -> dict[str, Any]:
243
243
  """Get circuit breaker state."""
244
244
  pass
245
245
 
@@ -250,7 +250,7 @@ class ASystemMonitorBase(ABC):
250
250
  def __init__(self):
251
251
  """Initialize system monitor."""
252
252
  self._monitoring_enabled = False
253
- self._system_metrics: Dict[str, Any] = {}
253
+ self._system_metrics: dict[str, Any] = {}
254
254
 
255
255
  @abstractmethod
256
256
  def start_system_monitoring(self) -> None:
@@ -268,17 +268,17 @@ class ASystemMonitorBase(ABC):
268
268
  pass
269
269
 
270
270
  @abstractmethod
271
- def get_memory_usage(self) -> Dict[str, float]:
271
+ def get_memory_usage(self) -> dict[str, float]:
272
272
  """Get memory usage statistics."""
273
273
  pass
274
274
 
275
275
  @abstractmethod
276
- def get_disk_usage(self) -> Dict[str, float]:
276
+ def get_disk_usage(self) -> dict[str, float]:
277
277
  """Get disk usage statistics."""
278
278
  pass
279
279
 
280
280
  @abstractmethod
281
- def get_network_usage(self) -> Dict[str, float]:
281
+ def get_network_usage(self) -> dict[str, float]:
282
282
  """Get network usage statistics."""
283
283
  pass
284
284
 
@@ -303,7 +303,7 @@ class ASystemMonitorBase(ABC):
303
303
  pass
304
304
 
305
305
  @abstractmethod
306
- def get_system_info(self) -> Dict[str, Any]:
306
+ def get_system_info(self) -> dict[str, Any]:
307
307
  """Get comprehensive system information."""
308
308
  pass
309
309
 
@@ -322,7 +322,7 @@ class ATracingProvider(ABC):
322
322
  name: str,
323
323
  kind: 'SpanKind' = None,
324
324
  parent: Optional['SpanContext'] = None,
325
- attributes: Optional[Dict[str, Any]] = None
325
+ attributes: Optional[dict[str, Any]] = None
326
326
  ) -> 'SpanContext':
327
327
  """Start a new span."""
328
328
  pass
@@ -338,6 +338,6 @@ class ATracingProvider(ABC):
338
338
  pass
339
339
 
340
340
  @abstractmethod
341
- def add_span_event(self, span: 'SpanContext', name: str, attributes: Optional[Dict[str, Any]] = None) -> None:
341
+ def add_span_event(self, span: 'SpanContext', name: str, attributes: Optional[dict[str, Any]] = None) -> None:
342
342
  """Add event to span."""
343
343
  pass
@@ -3,14 +3,14 @@
3
3
  Company: eXonware.com
4
4
  Author: Eng. Muhammad AlShehri
5
5
  Email: connect@exonware.com
6
- Version: 0.0.1.409
6
+ Version: 0.0.1.411
7
7
  Generation Date: September 04, 2025
8
8
 
9
9
  Monitoring protocol interfaces for XWSystem.
10
10
  """
11
11
 
12
12
  from abc import ABC, abstractmethod
13
- from typing import Any, Dict, List, Optional, Union, Iterator, Callable, Tuple, Protocol
13
+ from typing import Any, Optional, Union, Iterator, Callable, Protocol
14
14
  from typing_extensions import runtime_checkable
15
15
  import time
16
16
 
@@ -63,7 +63,7 @@ class IPerformance(ABC):
63
63
  pass
64
64
 
65
65
  @abstractmethod
66
- def get_metrics(self) -> Dict[str, Any]:
66
+ def get_metrics(self) -> dict[str, Any]:
67
67
  """
68
68
  Get performance metrics.
69
69
 
@@ -172,7 +172,7 @@ class IMonitorable(ABC):
172
172
  pass
173
173
 
174
174
  @abstractmethod
175
- def get_health(self) -> Dict[str, Any]:
175
+ def get_health(self) -> dict[str, Any]:
176
176
  """
177
177
  Get health information.
178
178
 
@@ -192,7 +192,7 @@ class IMonitorable(ABC):
192
192
  pass
193
193
 
194
194
  @abstractmethod
195
- def get_monitoring_info(self) -> Dict[str, Any]:
195
+ def get_monitoring_info(self) -> dict[str, Any]:
196
196
  """
197
197
  Get monitoring information.
198
198
 
@@ -234,7 +234,7 @@ class IMetrics(ABC):
234
234
  """
235
235
 
236
236
  @abstractmethod
237
- def collect_metrics(self) -> Dict[str, Any]:
237
+ def collect_metrics(self) -> dict[str, Any]:
238
238
  """
239
239
  Collect all metrics.
240
240
 
@@ -244,7 +244,7 @@ class IMetrics(ABC):
244
244
  pass
245
245
 
246
246
  @abstractmethod
247
- def add_metric(self, name: str, value: Any, labels: Optional[Dict[str, str]] = None) -> None:
247
+ def add_metric(self, name: str, value: Any, labels: Optional[dict[str, str]] = None) -> None:
248
248
  """
249
249
  Add metric.
250
250
 
@@ -282,7 +282,7 @@ class IMetrics(ABC):
282
282
  pass
283
283
 
284
284
  @abstractmethod
285
- def list_metrics(self) -> List[str]:
285
+ def list_metrics(self) -> list[str]:
286
286
  """
287
287
  List all metric names.
288
288
 
@@ -312,7 +312,7 @@ class IMetrics(ABC):
312
312
  pass
313
313
 
314
314
  @abstractmethod
315
- def get_metrics_summary(self) -> Dict[str, Any]:
315
+ def get_metrics_summary(self) -> dict[str, Any]:
316
316
  """
317
317
  Get metrics summary.
318
318
 
@@ -344,7 +344,7 @@ class IHealthCheck(ABC):
344
344
  pass
345
345
 
346
346
  @abstractmethod
347
- def get_health_details(self) -> Dict[str, Any]:
347
+ def get_health_details(self) -> dict[str, Any]:
348
348
  """
349
349
  Get detailed health information.
350
350
 
@@ -378,7 +378,7 @@ class IHealthCheck(ABC):
378
378
  pass
379
379
 
380
380
  @abstractmethod
381
- def list_health_checks(self) -> List[str]:
381
+ def list_health_checks(self) -> list[str]:
382
382
  """
383
383
  List all health check names.
384
384
 
@@ -388,7 +388,7 @@ class IHealthCheck(ABC):
388
388
  pass
389
389
 
390
390
  @abstractmethod
391
- def run_health_checks(self) -> Dict[str, HealthStatus]:
391
+ def run_health_checks(self) -> dict[str, HealthStatus]:
392
392
  """
393
393
  Run all health checks.
394
394
 
@@ -446,7 +446,7 @@ class IAlerting(ABC):
446
446
  pass
447
447
 
448
448
  @abstractmethod
449
- def get_alert(self, alert_id: str) -> Optional[Dict[str, Any]]:
449
+ def get_alert(self, alert_id: str) -> Optional[dict[str, Any]]:
450
450
  """
451
451
  Get alert by ID.
452
452
 
@@ -459,7 +459,7 @@ class IAlerting(ABC):
459
459
  pass
460
460
 
461
461
  @abstractmethod
462
- def list_alerts(self, level: Optional[AlertLevel] = None) -> List[Dict[str, Any]]:
462
+ def list_alerts(self, level: Optional[AlertLevel] = None) -> list[dict[str, Any]]:
463
463
  """
464
464
  List alerts.
465
465
 
@@ -513,7 +513,7 @@ class IAlerting(ABC):
513
513
  pass
514
514
 
515
515
  @abstractmethod
516
- def get_alert_stats(self) -> Dict[str, int]:
516
+ def get_alert_stats(self) -> dict[str, int]:
517
517
  """
518
518
  Get alert statistics.
519
519
 
@@ -557,7 +557,7 @@ class ISystemMonitor(ABC):
557
557
  pass
558
558
 
559
559
  @abstractmethod
560
- def get_memory_usage(self) -> Dict[str, Any]:
560
+ def get_memory_usage(self) -> dict[str, Any]:
561
561
  """
562
562
  Get memory usage information.
563
563
 
@@ -567,7 +567,7 @@ class ISystemMonitor(ABC):
567
567
  pass
568
568
 
569
569
  @abstractmethod
570
- def get_disk_usage(self) -> Dict[str, Any]:
570
+ def get_disk_usage(self) -> dict[str, Any]:
571
571
  """
572
572
  Get disk usage information.
573
573
 
@@ -577,7 +577,7 @@ class ISystemMonitor(ABC):
577
577
  pass
578
578
 
579
579
  @abstractmethod
580
- def get_network_usage(self) -> Dict[str, Any]:
580
+ def get_network_usage(self) -> dict[str, Any]:
581
581
  """
582
582
  Get network usage information.
583
583
 
@@ -587,7 +587,7 @@ class ISystemMonitor(ABC):
587
587
  pass
588
588
 
589
589
  @abstractmethod
590
- def get_process_info(self) -> List[Dict[str, Any]]:
590
+ def get_process_info(self) -> list[dict[str, Any]]:
591
591
  """
592
592
  Get process information.
593
593
 
@@ -617,7 +617,7 @@ class ISystemMonitor(ABC):
617
617
  pass
618
618
 
619
619
  @abstractmethod
620
- def get_system_info(self) -> Dict[str, Any]:
620
+ def get_system_info(self) -> dict[str, Any]:
621
621
  """
622
622
  Get system information.
623
623
 
@@ -652,7 +652,7 @@ class IProfiler(ABC):
652
652
  pass
653
653
 
654
654
  @abstractmethod
655
- def stop_profiling(self, session_id: str) -> Dict[str, Any]:
655
+ def stop_profiling(self, session_id: str) -> dict[str, Any]:
656
656
  """
657
657
  Stop profiling session.
658
658
 
@@ -665,7 +665,7 @@ class IProfiler(ABC):
665
665
  pass
666
666
 
667
667
  @abstractmethod
668
- def profile_function(self, func: Callable, *args, **kwargs) -> Tuple[Any, Dict[str, Any]]:
668
+ def profile_function(self, func: Callable, *args, **kwargs) -> tuple[Any, dict[str, Any]]:
669
669
  """
670
670
  Profile function execution.
671
671
 
@@ -680,7 +680,7 @@ class IProfiler(ABC):
680
680
  pass
681
681
 
682
682
  @abstractmethod
683
- def get_profiling_results(self, session_id: str) -> Optional[Dict[str, Any]]:
683
+ def get_profiling_results(self, session_id: str) -> Optional[dict[str, Any]]:
684
684
  """
685
685
  Get profiling results.
686
686
 
@@ -693,7 +693,7 @@ class IProfiler(ABC):
693
693
  pass
694
694
 
695
695
  @abstractmethod
696
- def list_profiling_sessions(self) -> List[str]:
696
+ def list_profiling_sessions(self) -> list[str]:
697
697
  """
698
698
  List profiling sessions.
699
699
 
@@ -813,7 +813,7 @@ class IMonitoringConfig(ABC):
813
813
  pass
814
814
 
815
815
  @abstractmethod
816
- def get_monitoring_config(self) -> Dict[str, Any]:
816
+ def get_monitoring_config(self) -> dict[str, Any]:
817
817
  """
818
818
  Get monitoring configuration.
819
819
 
@@ -823,7 +823,7 @@ class IMonitoringConfig(ABC):
823
823
  pass
824
824
 
825
825
  @abstractmethod
826
- def set_monitoring_config(self, config: Dict[str, Any]) -> None:
826
+ def set_monitoring_config(self, config: dict[str, Any]) -> None:
827
827
  """
828
828
  Set monitoring configuration.
829
829
 
@@ -849,6 +849,6 @@ class Monitorable(Protocol):
849
849
  """Stop performance monitoring."""
850
850
  ...
851
851
 
852
- def get_stats(self) -> Dict[str, Any]:
852
+ def get_stats(self) -> dict[str, Any]:
853
853
  """Get performance statistics."""
854
854
  ...
@@ -4,7 +4,7 @@
4
4
  Company: eXonware.com
5
5
  Author: Eng. Muhammad AlShehri
6
6
  Email: connect@exonware.com
7
- Version: 0.0.1.409
7
+ Version: 0.0.1.411
8
8
  Generation Date: 07-Sep-2025
9
9
 
10
10
  Monitoring types and enums for XWSystem.