exonware-xwsystem 0.0.1.408__py3-none-any.whl → 0.0.1.410__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 (256) hide show
  1. exonware/__init__.py +2 -2
  2. exonware/conf.py +10 -20
  3. exonware/xwsystem/__init__.py +5 -15
  4. exonware/xwsystem/caching/__init__.py +1 -1
  5. exonware/xwsystem/caching/base.py +15 -15
  6. exonware/xwsystem/caching/bloom_cache.py +4 -4
  7. exonware/xwsystem/caching/cache_manager.py +2 -2
  8. exonware/xwsystem/caching/conditional.py +3 -3
  9. exonware/xwsystem/caching/contracts.py +12 -12
  10. exonware/xwsystem/caching/decorators.py +1 -1
  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 +7 -7
  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 +23 -8
  20. exonware/xwsystem/caching/lfu_optimized.py +20 -20
  21. exonware/xwsystem/caching/lru_cache.py +13 -6
  22. exonware/xwsystem/caching/memory_bounded.py +7 -7
  23. exonware/xwsystem/caching/metrics_exporter.py +5 -5
  24. exonware/xwsystem/caching/observable_cache.py +1 -1
  25. exonware/xwsystem/caching/pluggable_cache.py +8 -8
  26. exonware/xwsystem/caching/rate_limiter.py +1 -1
  27. exonware/xwsystem/caching/read_through.py +5 -5
  28. exonware/xwsystem/caching/secure_cache.py +1 -1
  29. exonware/xwsystem/caching/serializable.py +2 -2
  30. exonware/xwsystem/caching/stats.py +7 -7
  31. exonware/xwsystem/caching/tagging.py +10 -10
  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 +8 -8
  37. exonware/xwsystem/caching/write_behind.py +4 -4
  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 +13 -13
  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 +1 -1
  55. exonware/xwsystem/config/logging.py +1 -1
  56. exonware/xwsystem/config/logging_setup.py +1 -1
  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 +12 -12
  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 +1 -1
  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 +2 -2
  72. exonware/xwsystem/io/archive/base.py +15 -15
  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 +7 -7
  77. exonware/xwsystem/io/archive/formats/lz4_format.py +7 -7
  78. exonware/xwsystem/io/archive/formats/rar.py +7 -7
  79. exonware/xwsystem/io/archive/formats/sevenzip.py +7 -7
  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 +7 -7
  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 +7 -7
  86. exonware/xwsystem/io/base.py +17 -17
  87. exonware/xwsystem/io/codec/__init__.py +1 -1
  88. exonware/xwsystem/io/codec/base.py +260 -13
  89. exonware/xwsystem/io/codec/contracts.py +3 -6
  90. exonware/xwsystem/io/codec/registry.py +28 -28
  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/defs.py +2 -2
  98. exonware/xwsystem/io/errors.py +32 -3
  99. exonware/xwsystem/io/facade.py +3 -3
  100. exonware/xwsystem/io/file/__init__.py +1 -1
  101. exonware/xwsystem/io/file/base.py +2 -2
  102. exonware/xwsystem/io/file/conversion.py +1 -1
  103. exonware/xwsystem/io/file/file.py +3 -3
  104. exonware/xwsystem/io/file/paged_source.py +1 -1
  105. exonware/xwsystem/io/file/paging/__init__.py +1 -1
  106. exonware/xwsystem/io/file/paging/byte_paging.py +1 -1
  107. exonware/xwsystem/io/file/paging/line_paging.py +1 -1
  108. exonware/xwsystem/io/file/paging/record_paging.py +1 -1
  109. exonware/xwsystem/io/file/paging/registry.py +4 -4
  110. exonware/xwsystem/io/file/source.py +3 -3
  111. exonware/xwsystem/io/filesystem/__init__.py +1 -1
  112. exonware/xwsystem/io/filesystem/base.py +1 -1
  113. exonware/xwsystem/io/filesystem/local.py +1 -1
  114. exonware/xwsystem/io/folder/__init__.py +1 -1
  115. exonware/xwsystem/io/folder/base.py +2 -2
  116. exonware/xwsystem/io/folder/folder.py +5 -5
  117. exonware/xwsystem/io/serialization/__init__.py +1 -1
  118. exonware/xwsystem/io/serialization/auto_serializer.py +3 -3
  119. exonware/xwsystem/io/serialization/base.py +84 -35
  120. exonware/xwsystem/io/serialization/contracts.py +6 -4
  121. exonware/xwsystem/io/serialization/defs.py +1 -1
  122. exonware/xwsystem/io/serialization/errors.py +1 -1
  123. exonware/xwsystem/io/serialization/flyweight.py +18 -18
  124. exonware/xwsystem/io/serialization/format_detector.py +11 -11
  125. exonware/xwsystem/io/serialization/formats/__init__.py +1 -1
  126. exonware/xwsystem/io/serialization/formats/binary/bson.py +1 -1
  127. exonware/xwsystem/io/serialization/formats/binary/cbor.py +1 -1
  128. exonware/xwsystem/io/serialization/formats/binary/marshal.py +1 -1
  129. exonware/xwsystem/io/serialization/formats/binary/msgpack.py +1 -1
  130. exonware/xwsystem/io/serialization/formats/binary/pickle.py +1 -1
  131. exonware/xwsystem/io/serialization/formats/binary/plistlib.py +1 -1
  132. exonware/xwsystem/io/serialization/formats/database/dbm.py +1 -1
  133. exonware/xwsystem/io/serialization/formats/database/shelve.py +1 -1
  134. exonware/xwsystem/io/serialization/formats/database/sqlite3.py +1 -1
  135. exonware/xwsystem/io/serialization/formats/text/configparser.py +2 -2
  136. exonware/xwsystem/io/serialization/formats/text/csv.py +2 -2
  137. exonware/xwsystem/io/serialization/formats/text/formdata.py +2 -2
  138. exonware/xwsystem/io/serialization/formats/text/json.py +23 -5
  139. exonware/xwsystem/io/serialization/formats/text/json5.py +93 -10
  140. exonware/xwsystem/io/serialization/formats/text/jsonlines.py +4 -4
  141. exonware/xwsystem/io/serialization/formats/text/multipart.py +2 -2
  142. exonware/xwsystem/io/serialization/formats/text/toml.py +47 -2
  143. exonware/xwsystem/io/serialization/formats/text/xml.py +444 -69
  144. exonware/xwsystem/io/serialization/formats/text/yaml.py +1 -1
  145. exonware/xwsystem/io/serialization/registry.py +5 -5
  146. exonware/xwsystem/io/serialization/serializer.py +11 -11
  147. exonware/xwsystem/io/serialization/utils/__init__.py +1 -1
  148. exonware/xwsystem/io/serialization/utils/path_ops.py +3 -3
  149. exonware/xwsystem/io/stream/__init__.py +1 -1
  150. exonware/xwsystem/io/stream/async_operations.py +3 -3
  151. exonware/xwsystem/io/stream/base.py +3 -7
  152. exonware/xwsystem/io/stream/codec_io.py +4 -7
  153. exonware/xwsystem/ipc/async_fabric.py +7 -7
  154. exonware/xwsystem/ipc/base.py +8 -8
  155. exonware/xwsystem/ipc/contracts.py +4 -4
  156. exonware/xwsystem/ipc/defs.py +1 -1
  157. exonware/xwsystem/ipc/errors.py +1 -1
  158. exonware/xwsystem/ipc/message_queue.py +4 -6
  159. exonware/xwsystem/ipc/process_manager.py +7 -7
  160. exonware/xwsystem/ipc/process_pool.py +8 -8
  161. exonware/xwsystem/ipc/shared_memory.py +5 -5
  162. exonware/xwsystem/monitoring/base.py +32 -32
  163. exonware/xwsystem/monitoring/contracts.py +27 -27
  164. exonware/xwsystem/monitoring/defs.py +1 -1
  165. exonware/xwsystem/monitoring/error_recovery.py +15 -15
  166. exonware/xwsystem/monitoring/errors.py +1 -1
  167. exonware/xwsystem/monitoring/memory_monitor.py +11 -11
  168. exonware/xwsystem/monitoring/metrics.py +8 -8
  169. exonware/xwsystem/monitoring/performance_manager_generic.py +19 -19
  170. exonware/xwsystem/monitoring/performance_monitor.py +11 -11
  171. exonware/xwsystem/monitoring/performance_validator.py +20 -20
  172. exonware/xwsystem/monitoring/system_monitor.py +16 -16
  173. exonware/xwsystem/monitoring/tracing.py +19 -19
  174. exonware/xwsystem/monitoring/tracker.py +7 -7
  175. exonware/xwsystem/operations/__init__.py +5 -5
  176. exonware/xwsystem/operations/base.py +3 -3
  177. exonware/xwsystem/operations/contracts.py +3 -3
  178. exonware/xwsystem/operations/defs.py +5 -5
  179. exonware/xwsystem/operations/diff.py +5 -5
  180. exonware/xwsystem/operations/merge.py +2 -2
  181. exonware/xwsystem/operations/patch.py +5 -5
  182. exonware/xwsystem/patterns/base.py +3 -3
  183. exonware/xwsystem/patterns/context_manager.py +6 -6
  184. exonware/xwsystem/patterns/contracts.py +22 -24
  185. exonware/xwsystem/patterns/defs.py +1 -1
  186. exonware/xwsystem/patterns/dynamic_facade.py +5 -5
  187. exonware/xwsystem/patterns/errors.py +7 -7
  188. exonware/xwsystem/patterns/handler_factory.py +11 -10
  189. exonware/xwsystem/patterns/import_registry.py +22 -22
  190. exonware/xwsystem/patterns/object_pool.py +11 -10
  191. exonware/xwsystem/patterns/registry.py +44 -31
  192. exonware/xwsystem/plugins/__init__.py +1 -1
  193. exonware/xwsystem/plugins/base.py +23 -23
  194. exonware/xwsystem/plugins/contracts.py +26 -26
  195. exonware/xwsystem/plugins/defs.py +1 -1
  196. exonware/xwsystem/plugins/errors.py +7 -7
  197. exonware/xwsystem/runtime/__init__.py +1 -1
  198. exonware/xwsystem/runtime/base.py +40 -40
  199. exonware/xwsystem/runtime/contracts.py +8 -8
  200. exonware/xwsystem/runtime/defs.py +1 -1
  201. exonware/xwsystem/runtime/env.py +8 -8
  202. exonware/xwsystem/runtime/errors.py +1 -1
  203. exonware/xwsystem/runtime/reflection.py +13 -13
  204. exonware/xwsystem/security/auth.py +47 -15
  205. exonware/xwsystem/security/base.py +16 -16
  206. exonware/xwsystem/security/contracts.py +30 -30
  207. exonware/xwsystem/security/crypto.py +7 -7
  208. exonware/xwsystem/security/defs.py +1 -1
  209. exonware/xwsystem/security/errors.py +1 -1
  210. exonware/xwsystem/security/hazmat.py +6 -6
  211. exonware/xwsystem/security/path_validator.py +1 -1
  212. exonware/xwsystem/shared/__init__.py +1 -1
  213. exonware/xwsystem/shared/base.py +14 -14
  214. exonware/xwsystem/shared/contracts.py +6 -6
  215. exonware/xwsystem/shared/defs.py +1 -1
  216. exonware/xwsystem/shared/errors.py +1 -1
  217. exonware/xwsystem/structures/base.py +28 -28
  218. exonware/xwsystem/structures/circular_detector.py +15 -15
  219. exonware/xwsystem/structures/contracts.py +9 -9
  220. exonware/xwsystem/structures/defs.py +1 -1
  221. exonware/xwsystem/structures/errors.py +1 -1
  222. exonware/xwsystem/structures/tree_walker.py +8 -8
  223. exonware/xwsystem/threading/async_primitives.py +6 -6
  224. exonware/xwsystem/threading/base.py +18 -18
  225. exonware/xwsystem/threading/contracts.py +13 -13
  226. exonware/xwsystem/threading/defs.py +1 -1
  227. exonware/xwsystem/threading/errors.py +1 -1
  228. exonware/xwsystem/threading/safe_factory.py +10 -9
  229. exonware/xwsystem/utils/base.py +33 -33
  230. exonware/xwsystem/utils/contracts.py +9 -9
  231. exonware/xwsystem/utils/dt/__init__.py +1 -1
  232. exonware/xwsystem/utils/dt/base.py +5 -5
  233. exonware/xwsystem/utils/dt/contracts.py +2 -2
  234. exonware/xwsystem/utils/dt/defs.py +1 -1
  235. exonware/xwsystem/utils/dt/errors.py +1 -1
  236. exonware/xwsystem/utils/dt/formatting.py +3 -3
  237. exonware/xwsystem/utils/dt/humanize.py +1 -1
  238. exonware/xwsystem/utils/dt/parsing.py +2 -2
  239. exonware/xwsystem/utils/dt/timezone_utils.py +5 -5
  240. exonware/xwsystem/utils/errors.py +1 -1
  241. exonware/xwsystem/utils/test_runner.py +6 -6
  242. exonware/xwsystem/utils/utils_contracts.py +1 -1
  243. exonware/xwsystem/validation/__init__.py +1 -1
  244. exonware/xwsystem/validation/base.py +39 -39
  245. exonware/xwsystem/validation/contracts.py +8 -8
  246. exonware/xwsystem/validation/declarative.py +9 -9
  247. exonware/xwsystem/validation/defs.py +1 -1
  248. exonware/xwsystem/validation/errors.py +1 -1
  249. exonware/xwsystem/validation/fluent_validator.py +8 -8
  250. exonware/xwsystem/version.py +2 -2
  251. {exonware_xwsystem-0.0.1.408.dist-info → exonware_xwsystem-0.0.1.410.dist-info}/METADATA +9 -11
  252. exonware_xwsystem-0.0.1.410.dist-info/RECORD +273 -0
  253. {exonware_xwsystem-0.0.1.408.dist-info → exonware_xwsystem-0.0.1.410.dist-info}/WHEEL +1 -1
  254. exonware/xwsystem/lazy_bootstrap.py +0 -79
  255. exonware_xwsystem-0.0.1.408.dist-info/RECORD +0 -274
  256. {exonware_xwsystem-0.0.1.408.dist-info → exonware_xwsystem-0.0.1.410.dist-info}/licenses/LICENSE +0 -0
@@ -10,7 +10,7 @@ import time
10
10
  from collections import defaultdict, deque
11
11
  from contextlib import contextmanager
12
12
  from dataclasses import dataclass, field
13
- from typing import Any, Callable, Dict, List, Optional
13
+ from typing import Any, Callable, Optional
14
14
 
15
15
  from ..config.logging_setup import get_logger
16
16
 
@@ -55,7 +55,7 @@ class OperationMetrics:
55
55
  """Get error rate as percentage."""
56
56
  return (self.error_count / max(1, self.total_calls)) * 100
57
57
 
58
- def to_dict(self) -> Dict[str, Any]:
58
+ def to_dict(self) -> dict[str, Any]:
59
59
  """Convert to dictionary representation."""
60
60
  return {
61
61
  "total_calls": self.total_calls,
@@ -75,9 +75,9 @@ class GenericMetrics:
75
75
  def __init__(self, component_name: str = "generic"):
76
76
  self.component_name = component_name
77
77
  self._logger = get_logger(f"{component_name}.metrics")
78
- self._operations: Dict[str, OperationMetrics] = defaultdict(OperationMetrics)
79
- self._counters: Dict[str, int] = defaultdict(int)
80
- self._gauges: Dict[str, float] = {}
78
+ self._operations: dict[str, OperationMetrics] = defaultdict(OperationMetrics)
79
+ self._counters: dict[str, int] = defaultdict(int)
80
+ self._gauges: dict[str, float] = {}
81
81
  self._start_time = time.time()
82
82
  self._lock = threading.RLock()
83
83
 
@@ -179,14 +179,14 @@ class GenericMetrics:
179
179
  """Get uptime in seconds."""
180
180
  return time.time() - self._start_time
181
181
 
182
- def get_operation_stats(self, operation_name: str) -> Dict[str, Any]:
182
+ def get_operation_stats(self, operation_name: str) -> dict[str, Any]:
183
183
  """Get statistics for a specific operation."""
184
184
  with self._lock:
185
185
  if operation_name in self._operations:
186
186
  return self._operations[operation_name].to_dict()
187
187
  return {}
188
188
 
189
- def get_summary(self) -> Dict[str, Any]:
189
+ def get_summary(self) -> dict[str, Any]:
190
190
  """Get comprehensive metrics summary."""
191
191
  with self._lock:
192
192
  operations_summary = {}
@@ -289,7 +289,7 @@ class GenericMetrics:
289
289
 
290
290
 
291
291
  # Global metrics registry
292
- _metrics_registry: Dict[str, GenericMetrics] = {}
292
+ _metrics_registry: dict[str, GenericMetrics] = {}
293
293
  _registry_lock = threading.Lock()
294
294
 
295
295
 
@@ -10,7 +10,7 @@ health monitoring, and recommendations without being tied to specific implementa
10
10
  Company: eXonware.com
11
11
  Author: Eng. Muhammad AlShehri
12
12
  Email: connect@exonware.com
13
- Version: 0.0.1.408
13
+ Version: 0.0.1.410
14
14
  Generation Date: November 04, 2025
15
15
  """
16
16
 
@@ -18,7 +18,7 @@ import threading
18
18
  import time
19
19
  from dataclasses import dataclass, field
20
20
  from enum import Enum
21
- from typing import Any, Dict, List, Optional, Union
21
+ from typing import Any, Optional, Union
22
22
 
23
23
  from ..config.performance_modes import PerformanceMode
24
24
  from ..config.logging_setup import get_logger
@@ -34,7 +34,7 @@ class PerformanceRecommendation:
34
34
  priority: str # 'low', 'medium', 'high', 'critical'
35
35
  message: str
36
36
  action: str
37
- details: Dict[str, Any] = field(default_factory=dict)
37
+ details: dict[str, Any] = field(default_factory=dict)
38
38
 
39
39
 
40
40
  @dataclass
@@ -43,8 +43,8 @@ class HealthStatus:
43
43
 
44
44
  status: str # 'excellent', 'good', 'fair', 'poor', 'critical'
45
45
  health_score: int # 0-100
46
- warnings: Dict[str, bool] = field(default_factory=dict)
47
- details: Dict[str, Any] = field(default_factory=dict)
46
+ warnings: dict[str, bool] = field(default_factory=dict)
47
+ details: dict[str, Any] = field(default_factory=dict)
48
48
 
49
49
 
50
50
  class GenericPerformanceManager:
@@ -59,8 +59,8 @@ class GenericPerformanceManager:
59
59
  """Initialize generic performance manager."""
60
60
  self.component_name = component_name
61
61
  self._lock = threading.RLock()
62
- self._mode_history: List[Dict[str, Any]] = []
63
- self._performance_stats: Dict[str, Any] = {}
62
+ self._mode_history: list[dict[str, Any]] = []
63
+ self._performance_stats: dict[str, Any] = {}
64
64
  self._last_mode_change = time.time()
65
65
  self._local_mode = None
66
66
  self._local_config = None
@@ -121,7 +121,7 @@ class GenericPerformanceManager:
121
121
  # This should be overridden by subclasses
122
122
  return {"performance_mode": mode}
123
123
 
124
- def get_mode_history(self) -> List[Dict[str, Any]]:
124
+ def get_mode_history(self) -> list[dict[str, Any]]:
125
125
  """Get the history of performance mode changes."""
126
126
  with self._lock:
127
127
  return self._mode_history.copy()
@@ -136,7 +136,7 @@ class GenericPerformanceManager:
136
136
  # GENERIC PERFORMANCE STATISTICS
137
137
  # ============================================================================
138
138
 
139
- def get_performance_stats(self) -> Dict[str, Any]:
139
+ def get_performance_stats(self) -> dict[str, Any]:
140
140
  """Get comprehensive performance statistics."""
141
141
  with self._lock:
142
142
  current_mode = self.get_performance_mode()
@@ -282,7 +282,7 @@ class GenericPerformanceManager:
282
282
  logger.info(f"Performance monitoring stopped for {self.component_name}")
283
283
  return self
284
284
 
285
- def get_performance_report(self) -> Dict[str, Any]:
285
+ def get_performance_report(self) -> dict[str, Any]:
286
286
  """Generate a comprehensive performance report."""
287
287
  stats = self.get_performance_stats()
288
288
  health = self.get_health_status()
@@ -296,8 +296,8 @@ class GenericPerformanceManager:
296
296
  }
297
297
 
298
298
  def benchmark_performance(
299
- self, test_operations: List[callable] = None
300
- ) -> Dict[str, Any]:
299
+ self, test_operations: list[callable] = None
300
+ ) -> dict[str, Any]:
301
301
  """Run performance benchmarks."""
302
302
  if test_operations is None:
303
303
  test_operations = []
@@ -337,11 +337,11 @@ class GenericPerformanceManager:
337
337
  # GENERIC HELPER METHODS (to be overridden by subclasses)
338
338
  # ============================================================================
339
339
 
340
- def _get_cache_stats(self) -> Dict[str, Any]:
340
+ def _get_cache_stats(self) -> dict[str, Any]:
341
341
  """Get cache statistics. Override in subclasses."""
342
342
  return {"hit_rate": 0.0, "miss_rate": 0.0, "size": 0, "max_size": 0}
343
343
 
344
- def _get_memory_stats(self) -> Dict[str, Any]:
344
+ def _get_memory_stats(self) -> dict[str, Any]:
345
345
  """Get memory usage statistics."""
346
346
  try:
347
347
  import os
@@ -361,7 +361,7 @@ class GenericPerformanceManager:
361
361
  logger.warning(f"Failed to get memory stats: {e}")
362
362
  return {"error": str(e)}
363
363
 
364
- def _get_operation_stats(self) -> Dict[str, Any]:
364
+ def _get_operation_stats(self) -> dict[str, Any]:
365
365
  """Get operation statistics. Override in subclasses."""
366
366
  return {
367
367
  "total_operations": 0,
@@ -370,13 +370,13 @@ class GenericPerformanceManager:
370
370
  "fastest_operation": None,
371
371
  }
372
372
 
373
- def _get_adaptive_stats(self) -> Dict[str, Any]:
373
+ def _get_adaptive_stats(self) -> dict[str, Any]:
374
374
  """Get adaptive learning statistics. Override in subclasses."""
375
375
  return {"learning_rate": 0.0, "adaptation_count": 0, "last_adaptation": None}
376
376
 
377
377
  def _generate_recommendations(
378
- self, stats: Dict[str, Any], health: HealthStatus
379
- ) -> List[PerformanceRecommendation]:
378
+ self, stats: dict[str, Any], health: HealthStatus
379
+ ) -> list[PerformanceRecommendation]:
380
380
  """Generate performance recommendations."""
381
381
  recommendations = []
382
382
 
@@ -463,7 +463,7 @@ class GenericPerformanceManager:
463
463
 
464
464
  return self
465
465
 
466
- def _apply_manual_overrides(self, config_overrides: Dict[str, Any]) -> None:
466
+ def _apply_manual_overrides(self, config_overrides: dict[str, Any]) -> None:
467
467
  """Apply manual configuration overrides. Override in subclasses."""
468
468
  pass
469
469
 
@@ -9,7 +9,7 @@ framework-wide reusability.
9
9
  import logging
10
10
  import time
11
11
  from contextlib import contextmanager
12
- from typing import Any, ContextManager, Dict, List, Optional
12
+ from typing import Any, ContextManager, Optional
13
13
 
14
14
  logger = logging.getLogger(__name__)
15
15
 
@@ -30,8 +30,8 @@ class PerformanceStats:
30
30
  """Initialize empty performance statistics."""
31
31
  self.operations_count = 0
32
32
  self.total_processing_time = 0.0
33
- self.memory_usage_samples: List[Dict[str, Any]] = []
34
- self.operation_history: List[Dict[str, Any]] = []
33
+ self.memory_usage_samples: list[dict[str, Any]] = []
34
+ self.operation_history: list[dict[str, Any]] = []
35
35
  self.error_count = 0
36
36
  self.cache_hits = 0
37
37
  self.cache_misses = 0
@@ -46,7 +46,7 @@ class PerformanceStats:
46
46
  self.cache_hits = 0
47
47
  self.cache_misses = 0
48
48
 
49
- def to_native(self) -> Dict[str, Any]:
49
+ def to_native(self) -> dict[str, Any]:
50
50
  """Convert statistics to dictionary format."""
51
51
  return {
52
52
  "operations_count": self.operations_count,
@@ -58,7 +58,7 @@ class PerformanceStats:
58
58
  "cache_misses": self.cache_misses,
59
59
  }
60
60
 
61
- def from_native(self, data: Dict[str, Any]) -> None:
61
+ def from_native(self, data: dict[str, Any]) -> None:
62
62
  """Load statistics from dictionary format."""
63
63
  self.operations_count = data.get("operations_count", 0)
64
64
  self.total_processing_time = data.get("total_processing_time", 0.0)
@@ -73,7 +73,7 @@ class PerformanceStats:
73
73
  operation_name: str,
74
74
  duration: float,
75
75
  success: bool = True,
76
- memory_usage: Optional[Dict[str, Any]] = None,
76
+ memory_usage: Optional[dict[str, Any]] = None,
77
77
  **context_data: Any,
78
78
  ) -> None:
79
79
  """Add operation data to statistics."""
@@ -155,7 +155,7 @@ class PerformanceMonitor:
155
155
  """Get current performance statistics."""
156
156
  return self.stats
157
157
 
158
- def get_stats_dict(self) -> Dict[str, Any]:
158
+ def get_stats_dict(self) -> dict[str, Any]:
159
159
  """Get performance statistics as dictionary."""
160
160
  return self.stats.to_native()
161
161
 
@@ -179,7 +179,7 @@ class PerformanceMonitor:
179
179
  operation_name: str,
180
180
  duration: float,
181
181
  success: bool = True,
182
- memory_usage: Optional[Dict[str, Any]] = None,
182
+ memory_usage: Optional[dict[str, Any]] = None,
183
183
  **context_data: Any,
184
184
  ) -> None:
185
185
  """Record an operation manually."""
@@ -200,7 +200,7 @@ class PerformanceMonitor:
200
200
  if self._enabled:
201
201
  self.stats.cache_misses += 1
202
202
 
203
- def get_summary(self) -> Dict[str, Any]:
203
+ def get_summary(self) -> dict[str, Any]:
204
204
  """Get performance summary."""
205
205
  return {
206
206
  "monitor_name": self.name,
@@ -303,7 +303,7 @@ def enhanced_error_context(operation: str, **context_data: Any) -> ContextManage
303
303
  return ErrorContext()
304
304
 
305
305
 
306
- def calculate_performance_summary(stats: Dict[str, Any]) -> Dict[str, Any]:
306
+ def calculate_performance_summary(stats: dict[str, Any]) -> dict[str, Any]:
307
307
  """
308
308
  Calculate performance summary from statistics.
309
309
 
@@ -341,7 +341,7 @@ def calculate_performance_summary(stats: Dict[str, Any]) -> Dict[str, Any]:
341
341
 
342
342
 
343
343
  def format_performance_report(
344
- stats: Dict[str, Any], include_history: bool = False
344
+ stats: dict[str, Any], include_history: bool = False
345
345
  ) -> str:
346
346
  """
347
347
  Format performance statistics as a readable report.
@@ -10,7 +10,7 @@ import threading
10
10
  import time
11
11
  from collections import defaultdict, deque
12
12
  from dataclasses import dataclass, field
13
- from typing import Any, Callable, Dict, List, Optional
13
+ from typing import Any, Callable, Optional
14
14
 
15
15
  from ..config.logging_setup import get_logger
16
16
 
@@ -25,8 +25,8 @@ class PerformanceMetric:
25
25
  duration: float # seconds
26
26
  timestamp: float
27
27
  success: bool = True
28
- error_info: Optional[Dict[str, Any]] = None
29
- additional_data: Dict[str, Any] = field(default_factory=dict)
28
+ error_info: Optional[dict[str, Any]] = None
29
+ additional_data: dict[str, Any] = field(default_factory=dict)
30
30
 
31
31
 
32
32
  @dataclass
@@ -57,8 +57,8 @@ class PerformanceReport:
57
57
  percentile_99: float
58
58
  error_rate: float
59
59
  throughput: float # operations per second
60
- threshold_violations: List[str] = field(default_factory=list)
61
- recommendations: List[str] = field(default_factory=list)
60
+ threshold_violations: list[str] = field(default_factory=list)
61
+ recommendations: list[str] = field(default_factory=list)
62
62
 
63
63
 
64
64
  class PerformanceValidator:
@@ -86,11 +86,11 @@ class PerformanceValidator:
86
86
  self.enable_regression_detection = enable_regression_detection
87
87
 
88
88
  # Performance data storage
89
- self._metrics: Dict[str, deque] = defaultdict(
89
+ self._metrics: dict[str, deque] = defaultdict(
90
90
  lambda: deque(maxlen=max_metrics_per_operation)
91
91
  )
92
- self._thresholds: Dict[str, PerformanceThreshold] = {}
93
- self._baseline_performance: Dict[str, Dict[str, float]] = {}
92
+ self._thresholds: dict[str, PerformanceThreshold] = {}
93
+ self._baseline_performance: dict[str, dict[str, float]] = {}
94
94
 
95
95
  # Thread safety
96
96
  self._lock = threading.RLock()
@@ -103,8 +103,8 @@ class PerformanceValidator:
103
103
  self._regressions_detected = 0
104
104
 
105
105
  # Callbacks
106
- self._threshold_violation_callbacks: List[Callable] = []
107
- self._regression_detected_callbacks: List[Callable] = []
106
+ self._threshold_violation_callbacks: list[Callable] = []
107
+ self._regression_detected_callbacks: list[Callable] = []
108
108
 
109
109
  logger.info("📊 Performance validator initialized")
110
110
 
@@ -119,8 +119,8 @@ class PerformanceValidator:
119
119
  operation_name: str,
120
120
  duration: float,
121
121
  success: bool = True,
122
- error_info: Optional[Dict[str, Any]] = None,
123
- additional_data: Dict[str, Any] = None,
122
+ error_info: Optional[dict[str, Any]] = None,
123
+ additional_data: dict[str, Any] = None,
124
124
  ) -> None:
125
125
  """Record a performance metric."""
126
126
  if additional_data is None:
@@ -139,12 +139,12 @@ class PerformanceValidator:
139
139
  self._metrics[operation_name].append(metric)
140
140
  self._total_metrics_recorded += 1
141
141
 
142
- def get_operation_metrics(self, operation_name: str) -> List[PerformanceMetric]:
142
+ def get_operation_metrics(self, operation_name: str) -> list[PerformanceMetric]:
143
143
  """Get all metrics for a specific operation."""
144
144
  with self._lock:
145
145
  return list(self._metrics.get(operation_name, []))
146
146
 
147
- def calculate_percentiles(self, durations: List[float]) -> Dict[str, float]:
147
+ def calculate_percentiles(self, durations: list[float]) -> dict[str, float]:
148
148
  """Calculate percentiles for a list of durations."""
149
149
  if not durations:
150
150
  return {}
@@ -265,7 +265,7 @@ class PerformanceValidator:
265
265
 
266
266
  return report
267
267
 
268
- def validate_all_operations(self) -> Dict[str, PerformanceReport]:
268
+ def validate_all_operations(self) -> dict[str, PerformanceReport]:
269
269
  """Validate performance for all operations."""
270
270
  with self._lock:
271
271
  operation_names = set(self._metrics.keys())
@@ -276,7 +276,7 @@ class PerformanceValidator:
276
276
 
277
277
  return reports
278
278
 
279
- def detect_regression(self, operation_name: str) -> Optional[Dict[str, Any]]:
279
+ def detect_regression(self, operation_name: str) -> Optional[dict[str, Any]]:
280
280
  """Detect performance regression compared to baseline."""
281
281
  if not self.enable_regression_detection:
282
282
  return None
@@ -409,7 +409,7 @@ class PerformanceValidator:
409
409
  logger.error(f"Error in validation loop: {e}")
410
410
  time.sleep(1.0) # Brief pause on error
411
411
 
412
- def get_performance_statistics(self) -> Dict[str, Any]:
412
+ def get_performance_statistics(self) -> dict[str, Any]:
413
413
  """Get overall performance statistics."""
414
414
  with self._lock:
415
415
  total_operations = sum(len(metrics) for metrics in self._metrics.values())
@@ -482,8 +482,8 @@ def record_performance_metric(
482
482
  operation_name: str,
483
483
  duration: float,
484
484
  success: bool = True,
485
- error_info: Optional[Dict[str, Any]] = None,
486
- additional_data: Dict[str, Any] = None,
485
+ error_info: Optional[dict[str, Any]] = None,
486
+ additional_data: dict[str, Any] = None,
487
487
  ) -> None:
488
488
  """Record a global performance metric."""
489
489
  validator = get_performance_validator()
@@ -498,7 +498,7 @@ def validate_performance(operation_name: str) -> PerformanceReport:
498
498
  return validator.validate_performance(operation_name)
499
499
 
500
500
 
501
- def get_performance_statistics() -> Dict[str, Any]:
501
+ def get_performance_statistics() -> dict[str, Any]:
502
502
  """Get global performance statistics."""
503
503
  validator = get_performance_validator()
504
504
  return validator.get_performance_statistics()
@@ -2,7 +2,7 @@
2
2
  Company: eXonware.com
3
3
  Author: Eng. Muhammad AlShehri
4
4
  Email: connect@exonware.com
5
- Version: 0.0.1.408
5
+ Version: 0.0.1.410
6
6
  Generation Date: September 04, 2025
7
7
 
8
8
  System-wide monitoring and hardware introspection utilities.
@@ -12,7 +12,7 @@ import os
12
12
  import platform
13
13
  import time
14
14
  from dataclasses import dataclass
15
- from typing import Dict, List, Optional, Any, Tuple, Union
15
+ from typing import Optional, Any, Union
16
16
  from pathlib import Path
17
17
 
18
18
  # Import psutil - lazy installation system will handle it if missing
@@ -37,7 +37,7 @@ class ProcessInfo:
37
37
  create_time: float
38
38
  num_threads: int
39
39
  username: Optional[str] = None
40
- cmdline: Optional[List[str]] = None
40
+ cmdline: Optional[list[str]] = None
41
41
  cwd: Optional[str] = None
42
42
  exe: Optional[str] = None
43
43
 
@@ -149,7 +149,7 @@ class SystemMonitor:
149
149
  # PROCESS MONITORING
150
150
  # =============================================================================
151
151
 
152
- def list_processes(self, attrs: Optional[List[str]] = None) -> List[ProcessInfo]:
152
+ def list_processes(self, attrs: Optional[list[str]] = None) -> list[ProcessInfo]:
153
153
  """
154
154
  List all running processes.
155
155
 
@@ -251,7 +251,7 @@ class SystemMonitor:
251
251
  except (psutil.NoSuchProcess, psutil.AccessDenied, psutil.ZombieProcess):
252
252
  return None
253
253
 
254
- def find_processes_by_name(self, name: str) -> List[ProcessInfo]:
254
+ def find_processes_by_name(self, name: str) -> list[ProcessInfo]:
255
255
  """
256
256
  Find processes by name.
257
257
 
@@ -357,7 +357,7 @@ class SystemMonitor:
357
357
 
358
358
  return SystemInfo(**system_info)
359
359
 
360
- def get_cpu_usage(self, interval: float = 1.0, per_cpu: bool = False) -> Union[float, List[float]]:
360
+ def get_cpu_usage(self, interval: float = 1.0, per_cpu: bool = False) -> Union[float, list[float]]:
361
361
  """
362
362
  Get CPU usage percentage.
363
363
 
@@ -372,7 +372,7 @@ class SystemMonitor:
372
372
 
373
373
  return psutil.cpu_percent(interval=interval, percpu=per_cpu)
374
374
 
375
- def get_memory_usage(self) -> Dict[str, Any]:
375
+ def get_memory_usage(self) -> dict[str, Any]:
376
376
  """
377
377
  Get memory usage information.
378
378
 
@@ -394,7 +394,7 @@ class SystemMonitor:
394
394
  'cached': getattr(memory, 'cached', 0),
395
395
  }
396
396
 
397
- def get_disk_usage(self) -> List[DiskInfo]:
397
+ def get_disk_usage(self) -> list[DiskInfo]:
398
398
  """
399
399
  Get disk usage information for all mounted disks.
400
400
 
@@ -427,7 +427,7 @@ class SystemMonitor:
427
427
 
428
428
  return disks
429
429
 
430
- def get_network_interfaces(self) -> List[NetworkInfo]:
430
+ def get_network_interfaces(self) -> list[NetworkInfo]:
431
431
  """
432
432
  Get network interface statistics.
433
433
 
@@ -468,7 +468,7 @@ class SystemMonitor:
468
468
 
469
469
  return interfaces
470
470
 
471
- def get_network_connections(self, kind: str = 'inet') -> List[NetworkConnection]:
471
+ def get_network_connections(self, kind: str = 'inet') -> list[NetworkConnection]:
472
472
  """
473
473
  Get network connections.
474
474
 
@@ -518,7 +518,7 @@ class SystemMonitor:
518
518
  # HARDWARE INFORMATION
519
519
  # =============================================================================
520
520
 
521
- def get_hardware_info(self) -> Dict[str, Any]:
521
+ def get_hardware_info(self) -> dict[str, Any]:
522
522
  """
523
523
  Get detailed hardware information.
524
524
 
@@ -648,11 +648,11 @@ class SystemMonitor:
648
648
  # Fallback to environment variables
649
649
  return os.getenv('USER') or os.getenv('USERNAME') or 'unknown'
650
650
 
651
- def get_environment_variables(self) -> Dict[str, str]:
651
+ def get_environment_variables(self) -> dict[str, str]:
652
652
  """Get all environment variables."""
653
653
  return dict(os.environ)
654
654
 
655
- def get_python_info(self) -> Dict[str, Any]:
655
+ def get_python_info(self) -> dict[str, Any]:
656
656
  """Get Python runtime information."""
657
657
  import sys
658
658
 
@@ -670,7 +670,7 @@ class SystemMonitor:
670
670
  _system_monitor = SystemMonitor()
671
671
 
672
672
  # Convenience functions
673
- def list_processes() -> List[ProcessInfo]:
673
+ def list_processes() -> list[ProcessInfo]:
674
674
  """List all running processes."""
675
675
  return _system_monitor.list_processes()
676
676
 
@@ -686,11 +686,11 @@ def get_cpu_usage(interval: float = 1.0) -> float:
686
686
  """Get CPU usage percentage."""
687
687
  return _system_monitor.get_cpu_usage(interval)
688
688
 
689
- def get_memory_usage() -> Dict[str, Any]:
689
+ def get_memory_usage() -> dict[str, Any]:
690
690
  """Get memory usage information."""
691
691
  return _system_monitor.get_memory_usage()
692
692
 
693
- def get_hardware_info() -> Dict[str, Any]:
693
+ def get_hardware_info() -> dict[str, Any]:
694
694
  """Get hardware information."""
695
695
  return _system_monitor.get_hardware_info()
696
696