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.
- exonware/__init__.py +2 -2
- exonware/conf.py +10 -20
- exonware/xwsystem/__init__.py +5 -15
- exonware/xwsystem/caching/__init__.py +1 -1
- exonware/xwsystem/caching/base.py +15 -15
- exonware/xwsystem/caching/bloom_cache.py +4 -4
- exonware/xwsystem/caching/cache_manager.py +2 -2
- exonware/xwsystem/caching/conditional.py +3 -3
- exonware/xwsystem/caching/contracts.py +12 -12
- exonware/xwsystem/caching/decorators.py +1 -1
- exonware/xwsystem/caching/defs.py +1 -1
- exonware/xwsystem/caching/disk_cache.py +4 -4
- exonware/xwsystem/caching/distributed.py +1 -1
- exonware/xwsystem/caching/errors.py +1 -1
- exonware/xwsystem/caching/events.py +7 -7
- exonware/xwsystem/caching/eviction_strategies.py +9 -9
- exonware/xwsystem/caching/fluent.py +1 -1
- exonware/xwsystem/caching/integrity.py +1 -1
- exonware/xwsystem/caching/lfu_cache.py +23 -8
- exonware/xwsystem/caching/lfu_optimized.py +20 -20
- exonware/xwsystem/caching/lru_cache.py +13 -6
- exonware/xwsystem/caching/memory_bounded.py +7 -7
- exonware/xwsystem/caching/metrics_exporter.py +5 -5
- exonware/xwsystem/caching/observable_cache.py +1 -1
- exonware/xwsystem/caching/pluggable_cache.py +8 -8
- exonware/xwsystem/caching/rate_limiter.py +1 -1
- exonware/xwsystem/caching/read_through.py +5 -5
- exonware/xwsystem/caching/secure_cache.py +1 -1
- exonware/xwsystem/caching/serializable.py +2 -2
- exonware/xwsystem/caching/stats.py +7 -7
- exonware/xwsystem/caching/tagging.py +10 -10
- exonware/xwsystem/caching/ttl_cache.py +21 -6
- exonware/xwsystem/caching/two_tier_cache.py +5 -5
- exonware/xwsystem/caching/utils.py +3 -3
- exonware/xwsystem/caching/validation.py +1 -1
- exonware/xwsystem/caching/warming.py +8 -8
- exonware/xwsystem/caching/write_behind.py +4 -4
- exonware/xwsystem/cli/__init__.py +1 -1
- exonware/xwsystem/cli/args.py +10 -10
- exonware/xwsystem/cli/base.py +15 -15
- exonware/xwsystem/cli/colors.py +1 -1
- exonware/xwsystem/cli/console.py +1 -1
- exonware/xwsystem/cli/contracts.py +5 -5
- exonware/xwsystem/cli/defs.py +1 -1
- exonware/xwsystem/cli/errors.py +1 -1
- exonware/xwsystem/cli/progress.py +1 -1
- exonware/xwsystem/cli/prompts.py +1 -1
- exonware/xwsystem/cli/tables.py +7 -7
- exonware/xwsystem/config/__init__.py +1 -1
- exonware/xwsystem/config/base.py +13 -13
- exonware/xwsystem/config/contracts.py +22 -22
- exonware/xwsystem/config/defaults.py +2 -2
- exonware/xwsystem/config/defs.py +1 -1
- exonware/xwsystem/config/errors.py +1 -1
- exonware/xwsystem/config/logging.py +1 -1
- exonware/xwsystem/config/logging_setup.py +1 -1
- exonware/xwsystem/config/performance.py +7 -7
- exonware/xwsystem/config/performance_modes.py +20 -20
- exonware/xwsystem/config/version_manager.py +4 -4
- exonware/xwsystem/{http → http_client}/__init__.py +1 -1
- exonware/xwsystem/{http → http_client}/advanced_client.py +20 -20
- exonware/xwsystem/{http → http_client}/base.py +12 -12
- exonware/xwsystem/{http → http_client}/client.py +43 -43
- exonware/xwsystem/{http → http_client}/contracts.py +5 -5
- exonware/xwsystem/{http → http_client}/defs.py +2 -2
- exonware/xwsystem/{http → http_client}/errors.py +1 -1
- exonware/xwsystem/io/__init__.py +1 -1
- exonware/xwsystem/io/archive/__init__.py +1 -1
- exonware/xwsystem/io/archive/archive.py +5 -5
- exonware/xwsystem/io/archive/archive_files.py +8 -8
- exonware/xwsystem/io/archive/archivers.py +2 -2
- exonware/xwsystem/io/archive/base.py +15 -15
- exonware/xwsystem/io/archive/codec_integration.py +1 -1
- exonware/xwsystem/io/archive/compression.py +1 -1
- exonware/xwsystem/io/archive/formats/__init__.py +1 -1
- exonware/xwsystem/io/archive/formats/brotli_format.py +7 -7
- exonware/xwsystem/io/archive/formats/lz4_format.py +7 -7
- exonware/xwsystem/io/archive/formats/rar.py +7 -7
- exonware/xwsystem/io/archive/formats/sevenzip.py +7 -7
- exonware/xwsystem/io/archive/formats/squashfs_format.py +7 -7
- exonware/xwsystem/io/archive/formats/tar.py +8 -8
- exonware/xwsystem/io/archive/formats/wim_format.py +7 -7
- exonware/xwsystem/io/archive/formats/zip.py +8 -8
- exonware/xwsystem/io/archive/formats/zpaq_format.py +7 -7
- exonware/xwsystem/io/archive/formats/zstandard.py +7 -7
- exonware/xwsystem/io/base.py +17 -17
- exonware/xwsystem/io/codec/__init__.py +1 -1
- exonware/xwsystem/io/codec/base.py +260 -13
- exonware/xwsystem/io/codec/contracts.py +3 -6
- exonware/xwsystem/io/codec/registry.py +28 -28
- exonware/xwsystem/io/common/__init__.py +1 -1
- exonware/xwsystem/io/common/atomic.py +2 -2
- exonware/xwsystem/io/common/base.py +1 -1
- exonware/xwsystem/io/common/lock.py +1 -1
- exonware/xwsystem/io/common/watcher.py +4 -4
- exonware/xwsystem/io/contracts.py +34 -39
- exonware/xwsystem/io/defs.py +2 -2
- exonware/xwsystem/io/errors.py +32 -3
- exonware/xwsystem/io/facade.py +3 -3
- exonware/xwsystem/io/file/__init__.py +1 -1
- exonware/xwsystem/io/file/base.py +2 -2
- exonware/xwsystem/io/file/conversion.py +1 -1
- exonware/xwsystem/io/file/file.py +3 -3
- exonware/xwsystem/io/file/paged_source.py +1 -1
- exonware/xwsystem/io/file/paging/__init__.py +1 -1
- exonware/xwsystem/io/file/paging/byte_paging.py +1 -1
- exonware/xwsystem/io/file/paging/line_paging.py +1 -1
- exonware/xwsystem/io/file/paging/record_paging.py +1 -1
- exonware/xwsystem/io/file/paging/registry.py +4 -4
- exonware/xwsystem/io/file/source.py +3 -3
- exonware/xwsystem/io/filesystem/__init__.py +1 -1
- exonware/xwsystem/io/filesystem/base.py +1 -1
- exonware/xwsystem/io/filesystem/local.py +1 -1
- exonware/xwsystem/io/folder/__init__.py +1 -1
- exonware/xwsystem/io/folder/base.py +2 -2
- exonware/xwsystem/io/folder/folder.py +5 -5
- exonware/xwsystem/io/serialization/__init__.py +1 -1
- exonware/xwsystem/io/serialization/auto_serializer.py +3 -3
- exonware/xwsystem/io/serialization/base.py +84 -35
- exonware/xwsystem/io/serialization/contracts.py +6 -4
- exonware/xwsystem/io/serialization/defs.py +1 -1
- exonware/xwsystem/io/serialization/errors.py +1 -1
- exonware/xwsystem/io/serialization/flyweight.py +18 -18
- exonware/xwsystem/io/serialization/format_detector.py +11 -11
- exonware/xwsystem/io/serialization/formats/__init__.py +1 -1
- exonware/xwsystem/io/serialization/formats/binary/bson.py +1 -1
- exonware/xwsystem/io/serialization/formats/binary/cbor.py +1 -1
- exonware/xwsystem/io/serialization/formats/binary/marshal.py +1 -1
- exonware/xwsystem/io/serialization/formats/binary/msgpack.py +1 -1
- exonware/xwsystem/io/serialization/formats/binary/pickle.py +1 -1
- exonware/xwsystem/io/serialization/formats/binary/plistlib.py +1 -1
- exonware/xwsystem/io/serialization/formats/database/dbm.py +1 -1
- exonware/xwsystem/io/serialization/formats/database/shelve.py +1 -1
- exonware/xwsystem/io/serialization/formats/database/sqlite3.py +1 -1
- exonware/xwsystem/io/serialization/formats/text/configparser.py +2 -2
- exonware/xwsystem/io/serialization/formats/text/csv.py +2 -2
- exonware/xwsystem/io/serialization/formats/text/formdata.py +2 -2
- exonware/xwsystem/io/serialization/formats/text/json.py +23 -5
- exonware/xwsystem/io/serialization/formats/text/json5.py +93 -10
- exonware/xwsystem/io/serialization/formats/text/jsonlines.py +4 -4
- exonware/xwsystem/io/serialization/formats/text/multipart.py +2 -2
- exonware/xwsystem/io/serialization/formats/text/toml.py +47 -2
- exonware/xwsystem/io/serialization/formats/text/xml.py +444 -69
- exonware/xwsystem/io/serialization/formats/text/yaml.py +1 -1
- exonware/xwsystem/io/serialization/registry.py +5 -5
- exonware/xwsystem/io/serialization/serializer.py +11 -11
- exonware/xwsystem/io/serialization/utils/__init__.py +1 -1
- exonware/xwsystem/io/serialization/utils/path_ops.py +3 -3
- exonware/xwsystem/io/stream/__init__.py +1 -1
- exonware/xwsystem/io/stream/async_operations.py +3 -3
- exonware/xwsystem/io/stream/base.py +3 -7
- exonware/xwsystem/io/stream/codec_io.py +4 -7
- exonware/xwsystem/ipc/async_fabric.py +7 -7
- exonware/xwsystem/ipc/base.py +8 -8
- exonware/xwsystem/ipc/contracts.py +4 -4
- exonware/xwsystem/ipc/defs.py +1 -1
- exonware/xwsystem/ipc/errors.py +1 -1
- exonware/xwsystem/ipc/message_queue.py +4 -6
- exonware/xwsystem/ipc/process_manager.py +7 -7
- exonware/xwsystem/ipc/process_pool.py +8 -8
- exonware/xwsystem/ipc/shared_memory.py +5 -5
- exonware/xwsystem/monitoring/base.py +32 -32
- exonware/xwsystem/monitoring/contracts.py +27 -27
- exonware/xwsystem/monitoring/defs.py +1 -1
- exonware/xwsystem/monitoring/error_recovery.py +15 -15
- exonware/xwsystem/monitoring/errors.py +1 -1
- exonware/xwsystem/monitoring/memory_monitor.py +11 -11
- exonware/xwsystem/monitoring/metrics.py +8 -8
- exonware/xwsystem/monitoring/performance_manager_generic.py +19 -19
- exonware/xwsystem/monitoring/performance_monitor.py +11 -11
- exonware/xwsystem/monitoring/performance_validator.py +20 -20
- exonware/xwsystem/monitoring/system_monitor.py +16 -16
- exonware/xwsystem/monitoring/tracing.py +19 -19
- exonware/xwsystem/monitoring/tracker.py +7 -7
- exonware/xwsystem/operations/__init__.py +5 -5
- exonware/xwsystem/operations/base.py +3 -3
- exonware/xwsystem/operations/contracts.py +3 -3
- exonware/xwsystem/operations/defs.py +5 -5
- exonware/xwsystem/operations/diff.py +5 -5
- exonware/xwsystem/operations/merge.py +2 -2
- exonware/xwsystem/operations/patch.py +5 -5
- exonware/xwsystem/patterns/base.py +3 -3
- exonware/xwsystem/patterns/context_manager.py +6 -6
- exonware/xwsystem/patterns/contracts.py +22 -24
- exonware/xwsystem/patterns/defs.py +1 -1
- exonware/xwsystem/patterns/dynamic_facade.py +5 -5
- exonware/xwsystem/patterns/errors.py +7 -7
- exonware/xwsystem/patterns/handler_factory.py +11 -10
- exonware/xwsystem/patterns/import_registry.py +22 -22
- exonware/xwsystem/patterns/object_pool.py +11 -10
- exonware/xwsystem/patterns/registry.py +44 -31
- exonware/xwsystem/plugins/__init__.py +1 -1
- exonware/xwsystem/plugins/base.py +23 -23
- exonware/xwsystem/plugins/contracts.py +26 -26
- exonware/xwsystem/plugins/defs.py +1 -1
- exonware/xwsystem/plugins/errors.py +7 -7
- exonware/xwsystem/runtime/__init__.py +1 -1
- exonware/xwsystem/runtime/base.py +40 -40
- exonware/xwsystem/runtime/contracts.py +8 -8
- exonware/xwsystem/runtime/defs.py +1 -1
- exonware/xwsystem/runtime/env.py +8 -8
- exonware/xwsystem/runtime/errors.py +1 -1
- exonware/xwsystem/runtime/reflection.py +13 -13
- exonware/xwsystem/security/auth.py +47 -15
- exonware/xwsystem/security/base.py +16 -16
- exonware/xwsystem/security/contracts.py +30 -30
- exonware/xwsystem/security/crypto.py +7 -7
- exonware/xwsystem/security/defs.py +1 -1
- exonware/xwsystem/security/errors.py +1 -1
- exonware/xwsystem/security/hazmat.py +6 -6
- exonware/xwsystem/security/path_validator.py +1 -1
- exonware/xwsystem/shared/__init__.py +1 -1
- exonware/xwsystem/shared/base.py +14 -14
- exonware/xwsystem/shared/contracts.py +6 -6
- exonware/xwsystem/shared/defs.py +1 -1
- exonware/xwsystem/shared/errors.py +1 -1
- exonware/xwsystem/structures/base.py +28 -28
- exonware/xwsystem/structures/circular_detector.py +15 -15
- exonware/xwsystem/structures/contracts.py +9 -9
- exonware/xwsystem/structures/defs.py +1 -1
- exonware/xwsystem/structures/errors.py +1 -1
- exonware/xwsystem/structures/tree_walker.py +8 -8
- exonware/xwsystem/threading/async_primitives.py +6 -6
- exonware/xwsystem/threading/base.py +18 -18
- exonware/xwsystem/threading/contracts.py +13 -13
- exonware/xwsystem/threading/defs.py +1 -1
- exonware/xwsystem/threading/errors.py +1 -1
- exonware/xwsystem/threading/safe_factory.py +10 -9
- exonware/xwsystem/utils/base.py +33 -33
- exonware/xwsystem/utils/contracts.py +9 -9
- exonware/xwsystem/utils/dt/__init__.py +1 -1
- exonware/xwsystem/utils/dt/base.py +5 -5
- exonware/xwsystem/utils/dt/contracts.py +2 -2
- exonware/xwsystem/utils/dt/defs.py +1 -1
- exonware/xwsystem/utils/dt/errors.py +1 -1
- exonware/xwsystem/utils/dt/formatting.py +3 -3
- exonware/xwsystem/utils/dt/humanize.py +1 -1
- exonware/xwsystem/utils/dt/parsing.py +2 -2
- exonware/xwsystem/utils/dt/timezone_utils.py +5 -5
- exonware/xwsystem/utils/errors.py +1 -1
- exonware/xwsystem/utils/test_runner.py +6 -6
- exonware/xwsystem/utils/utils_contracts.py +1 -1
- exonware/xwsystem/validation/__init__.py +1 -1
- exonware/xwsystem/validation/base.py +39 -39
- exonware/xwsystem/validation/contracts.py +8 -8
- exonware/xwsystem/validation/declarative.py +9 -9
- exonware/xwsystem/validation/defs.py +1 -1
- exonware/xwsystem/validation/errors.py +1 -1
- exonware/xwsystem/validation/fluent_validator.py +8 -8
- exonware/xwsystem/version.py +2 -2
- {exonware_xwsystem-0.0.1.408.dist-info → exonware_xwsystem-0.0.1.410.dist-info}/METADATA +9 -11
- exonware_xwsystem-0.0.1.410.dist-info/RECORD +273 -0
- {exonware_xwsystem-0.0.1.408.dist-info → exonware_xwsystem-0.0.1.410.dist-info}/WHEEL +1 -1
- exonware/xwsystem/lazy_bootstrap.py +0 -79
- exonware_xwsystem-0.0.1.408.dist-info/RECORD +0 -274
- {exonware_xwsystem-0.0.1.408.dist-info → exonware_xwsystem-0.0.1.410.dist-info}/licenses/LICENSE +0 -0
|
@@ -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.
|
|
5
|
+
Version: 0.0.1.410
|
|
6
6
|
Generation Date: September 05, 2025
|
|
7
7
|
|
|
8
8
|
Distributed Tracing Integration for Enterprise Observability
|
|
@@ -19,7 +19,7 @@ import time
|
|
|
19
19
|
import uuid
|
|
20
20
|
from contextlib import asynccontextmanager, contextmanager
|
|
21
21
|
from dataclasses import dataclass, field
|
|
22
|
-
from typing import Any, AsyncContextManager, ContextManager,
|
|
22
|
+
from typing import Any, AsyncContextManager, ContextManager, Optional, Union
|
|
23
23
|
from .base import ATracingProvider
|
|
24
24
|
from .errors import TracingError
|
|
25
25
|
from .defs import SpanKind
|
|
@@ -40,7 +40,7 @@ class SpanContext:
|
|
|
40
40
|
trace_id: str
|
|
41
41
|
span_id: str
|
|
42
42
|
parent_span_id: Optional[str] = None
|
|
43
|
-
baggage:
|
|
43
|
+
baggage: dict[str, Any] = field(default_factory=dict)
|
|
44
44
|
|
|
45
45
|
|
|
46
46
|
@dataclass
|
|
@@ -77,7 +77,7 @@ class OpenTelemetryTracer(ATracingProvider):
|
|
|
77
77
|
# OpenTelemetry is now required
|
|
78
78
|
|
|
79
79
|
self.service_name = service_name
|
|
80
|
-
self._spans:
|
|
80
|
+
self._spans: dict[str, Any] = {}
|
|
81
81
|
|
|
82
82
|
# Set up tracer provider
|
|
83
83
|
trace.set_tracer_provider(TracerProvider())
|
|
@@ -126,7 +126,7 @@ class OpenTelemetryTracer(ATracingProvider):
|
|
|
126
126
|
name: str,
|
|
127
127
|
kind: SpanKind = SpanKind.INTERNAL,
|
|
128
128
|
parent: Optional[SpanContext] = None,
|
|
129
|
-
attributes: Optional[
|
|
129
|
+
attributes: Optional[dict[str, Any]] = None
|
|
130
130
|
) -> SpanContext:
|
|
131
131
|
"""Start a new span."""
|
|
132
132
|
span = self.tracer.start_span(name)
|
|
@@ -163,7 +163,7 @@ class OpenTelemetryTracer(ATracingProvider):
|
|
|
163
163
|
if span.span_id in self._spans:
|
|
164
164
|
self._spans[span.span_id].set_attribute(key, value)
|
|
165
165
|
|
|
166
|
-
def add_span_event(self, span: SpanContext, name: str, attributes: Optional[
|
|
166
|
+
def add_span_event(self, span: SpanContext, name: str, attributes: Optional[dict[str, Any]] = None) -> None:
|
|
167
167
|
"""Add event to span."""
|
|
168
168
|
if span.span_id in self._spans:
|
|
169
169
|
self._spans[span.span_id].add_event(name, attributes or {})
|
|
@@ -177,14 +177,14 @@ class JaegerTracer(ATracingProvider):
|
|
|
177
177
|
self.service_name = service_name
|
|
178
178
|
self.agent_host = agent_host
|
|
179
179
|
self.agent_port = agent_port
|
|
180
|
-
self._spans:
|
|
180
|
+
self._spans: dict[str, dict[str, Any]] = {}
|
|
181
181
|
|
|
182
182
|
def start_span(
|
|
183
183
|
self,
|
|
184
184
|
name: str,
|
|
185
185
|
kind: SpanKind = SpanKind.INTERNAL,
|
|
186
186
|
parent: Optional[SpanContext] = None,
|
|
187
|
-
attributes: Optional[
|
|
187
|
+
attributes: Optional[dict[str, Any]] = None
|
|
188
188
|
) -> SpanContext:
|
|
189
189
|
"""Start a new span."""
|
|
190
190
|
span_id = str(uuid.uuid4())
|
|
@@ -225,7 +225,7 @@ class JaegerTracer(ATracingProvider):
|
|
|
225
225
|
if span.span_id in self._spans:
|
|
226
226
|
self._spans[span.span_id]['attributes'][key] = value
|
|
227
227
|
|
|
228
|
-
def add_span_event(self, span: SpanContext, name: str, attributes: Optional[
|
|
228
|
+
def add_span_event(self, span: SpanContext, name: str, attributes: Optional[dict[str, Any]] = None) -> None:
|
|
229
229
|
"""Add event to span."""
|
|
230
230
|
if span.span_id in self._spans:
|
|
231
231
|
self._spans[span.span_id]['events'].append({
|
|
@@ -272,7 +272,7 @@ class TracingManager:
|
|
|
272
272
|
self,
|
|
273
273
|
name: str,
|
|
274
274
|
kind: SpanKind = SpanKind.INTERNAL,
|
|
275
|
-
attributes: Optional[
|
|
275
|
+
attributes: Optional[dict[str, Any]] = None
|
|
276
276
|
) -> ContextManager[SpanContext]:
|
|
277
277
|
"""Context manager for tracing an operation."""
|
|
278
278
|
span = self.provider.start_span(name, kind=kind, attributes=attributes)
|
|
@@ -290,7 +290,7 @@ class TracingManager:
|
|
|
290
290
|
self,
|
|
291
291
|
name: str,
|
|
292
292
|
kind: SpanKind = SpanKind.INTERNAL,
|
|
293
|
-
attributes: Optional[
|
|
293
|
+
attributes: Optional[dict[str, Any]] = None
|
|
294
294
|
) -> AsyncContextManager[SpanContext]:
|
|
295
295
|
"""Async context manager for tracing an operation."""
|
|
296
296
|
span = self.provider.start_span(name, kind=kind, attributes=attributes)
|
|
@@ -309,7 +309,7 @@ class TracingManager:
|
|
|
309
309
|
# This would add to the root span in a real implementation
|
|
310
310
|
logger.debug(f"Trace attribute: {key}={value}")
|
|
311
311
|
|
|
312
|
-
def add_trace_event(self, name: str, attributes: Optional[
|
|
312
|
+
def add_trace_event(self, name: str, attributes: Optional[dict[str, Any]] = None) -> None:
|
|
313
313
|
"""Add event to current trace."""
|
|
314
314
|
if self._current_trace:
|
|
315
315
|
# This would add to the current span in a real implementation
|
|
@@ -324,7 +324,7 @@ class TracingManager:
|
|
|
324
324
|
# Placeholder - would return active span in full implementation
|
|
325
325
|
return None
|
|
326
326
|
|
|
327
|
-
def start_span(self, name: str, parent: Optional[SpanContext] = None, attributes: Optional[
|
|
327
|
+
def start_span(self, name: str, parent: Optional[SpanContext] = None, attributes: Optional[dict[str, Any]] = None) -> SpanContext:
|
|
328
328
|
"""Start a new span."""
|
|
329
329
|
return self.provider.start_span(name, parent=parent, attributes=attributes)
|
|
330
330
|
|
|
@@ -336,7 +336,7 @@ class TracingManager:
|
|
|
336
336
|
"""Add attribute to span."""
|
|
337
337
|
self.provider.add_span_attribute(span, key, value)
|
|
338
338
|
|
|
339
|
-
def add_span_event(self, span: SpanContext, name: str, attributes: Optional[
|
|
339
|
+
def add_span_event(self, span: SpanContext, name: str, attributes: Optional[dict[str, Any]] = None) -> None:
|
|
340
340
|
"""Add event to span."""
|
|
341
341
|
self.provider.add_span_event(span, name, attributes)
|
|
342
342
|
|
|
@@ -349,7 +349,7 @@ class NoOpTracingProvider(ATracingProvider):
|
|
|
349
349
|
name: str,
|
|
350
350
|
kind: SpanKind = SpanKind.INTERNAL,
|
|
351
351
|
parent: Optional[SpanContext] = None,
|
|
352
|
-
attributes: Optional[
|
|
352
|
+
attributes: Optional[dict[str, Any]] = None
|
|
353
353
|
) -> SpanContext:
|
|
354
354
|
"""Start a no-op span."""
|
|
355
355
|
return SpanContext(
|
|
@@ -365,7 +365,7 @@ class NoOpTracingProvider(ATracingProvider):
|
|
|
365
365
|
"""Add attribute to no-op span."""
|
|
366
366
|
pass
|
|
367
367
|
|
|
368
|
-
def add_span_event(self, span: SpanContext, name: str, attributes: Optional[
|
|
368
|
+
def add_span_event(self, span: SpanContext, name: str, attributes: Optional[dict[str, Any]] = None) -> None:
|
|
369
369
|
"""Add event to no-op span."""
|
|
370
370
|
pass
|
|
371
371
|
|
|
@@ -393,11 +393,11 @@ class DistributedTracing:
|
|
|
393
393
|
if provider:
|
|
394
394
|
self.manager.set_provider(provider)
|
|
395
395
|
|
|
396
|
-
def start_trace(self, name: str, attributes: Optional[
|
|
396
|
+
def start_trace(self, name: str, attributes: Optional[dict[str, Any]] = None) -> TraceContext:
|
|
397
397
|
"""Start a new trace."""
|
|
398
398
|
return self.manager.start_trace(name, **(attributes or {}))
|
|
399
399
|
|
|
400
|
-
def start_span(self, name: str, parent: Optional[SpanContext] = None, attributes: Optional[
|
|
400
|
+
def start_span(self, name: str, parent: Optional[SpanContext] = None, attributes: Optional[dict[str, Any]] = None) -> SpanContext:
|
|
401
401
|
"""Start a new span."""
|
|
402
402
|
return self.manager.start_span(name, parent, attributes)
|
|
403
403
|
|
|
@@ -409,7 +409,7 @@ class DistributedTracing:
|
|
|
409
409
|
"""Add attribute to span."""
|
|
410
410
|
self.manager.add_span_attribute(span, key, value)
|
|
411
411
|
|
|
412
|
-
def add_span_event(self, span: SpanContext, name: str, attributes: Optional[
|
|
412
|
+
def add_span_event(self, span: SpanContext, name: str, attributes: Optional[dict[str, Any]] = None) -> None:
|
|
413
413
|
"""Add event to span."""
|
|
414
414
|
self.manager.add_span_event(span, name, attributes)
|
|
415
415
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Company: eXonware.com
|
|
4
4
|
Author: Eng. Muhammad AlShehri
|
|
5
5
|
Email: connect@exonware.com
|
|
6
|
-
Version: 0.0.1.
|
|
6
|
+
Version: 0.0.1.410
|
|
7
7
|
Generation Date: October 26, 2025
|
|
8
8
|
|
|
9
9
|
Operation tracker for monitoring operations with context management.
|
|
@@ -12,7 +12,7 @@ Operation tracker for monitoring operations with context management.
|
|
|
12
12
|
import threading
|
|
13
13
|
import time
|
|
14
14
|
from contextlib import contextmanager
|
|
15
|
-
from typing import Any,
|
|
15
|
+
from typing import Any, Optional, Callable
|
|
16
16
|
from .metrics import OperationMetrics, MetricSnapshot
|
|
17
17
|
from ..config.logging_setup import get_logger
|
|
18
18
|
|
|
@@ -41,8 +41,8 @@ class OperationTracker:
|
|
|
41
41
|
"""
|
|
42
42
|
self.max_recent_samples = max_recent_samples
|
|
43
43
|
self._lock = threading.RLock()
|
|
44
|
-
self._metrics:
|
|
45
|
-
self._callbacks:
|
|
44
|
+
self._metrics: dict[str, OperationMetrics] = {}
|
|
45
|
+
self._callbacks: list[Callable[[str, float, bool], None]] = []
|
|
46
46
|
|
|
47
47
|
def track_operation(
|
|
48
48
|
self,
|
|
@@ -111,12 +111,12 @@ class OperationTracker:
|
|
|
111
111
|
with self._lock:
|
|
112
112
|
return self._metrics.get(operation_name)
|
|
113
113
|
|
|
114
|
-
def get_all_stats(self) ->
|
|
114
|
+
def get_all_stats(self) -> dict[str, OperationMetrics]:
|
|
115
115
|
"""Get statistics for all operations."""
|
|
116
116
|
with self._lock:
|
|
117
117
|
return self._metrics.copy()
|
|
118
118
|
|
|
119
|
-
def get_summary_stats(self) ->
|
|
119
|
+
def get_summary_stats(self) -> dict[str, Any]:
|
|
120
120
|
"""Get summary statistics across all operations."""
|
|
121
121
|
with self._lock:
|
|
122
122
|
if not self._metrics:
|
|
@@ -142,7 +142,7 @@ class OperationTracker:
|
|
|
142
142
|
'error_rate': total_errors / max(1, total_calls),
|
|
143
143
|
}
|
|
144
144
|
|
|
145
|
-
def get_top_operations(self, limit: int = 10, sort_by: str = 'total_calls') ->
|
|
145
|
+
def get_top_operations(self, limit: int = 10, sort_by: str = 'total_calls') -> list[dict[str, Any]]:
|
|
146
146
|
"""
|
|
147
147
|
Get top operations by specified metric.
|
|
148
148
|
|
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
Company: eXonware.com
|
|
4
4
|
Author: Eng. Muhammad AlShehri
|
|
5
5
|
Email: connect@exonware.com
|
|
6
|
-
Version: 0.0.1.
|
|
6
|
+
Version: 0.0.1.410
|
|
7
7
|
Generation Date: October 26, 2025
|
|
8
8
|
|
|
9
9
|
Universal operations library for data manipulation.
|
|
10
10
|
"""
|
|
11
11
|
|
|
12
|
-
from typing import Any,
|
|
12
|
+
from typing import Any, Optional, Union
|
|
13
13
|
from enum import Enum
|
|
14
14
|
from dataclasses import dataclass
|
|
15
15
|
from ..config.logging_setup import get_logger
|
|
@@ -46,9 +46,9 @@ class PatchOperation(Enum):
|
|
|
46
46
|
@dataclass
|
|
47
47
|
class DiffResult:
|
|
48
48
|
"""Result of a diff operation."""
|
|
49
|
-
operations:
|
|
49
|
+
operations: list[dict[str, Any]]
|
|
50
50
|
mode: DiffMode
|
|
51
|
-
paths_changed:
|
|
51
|
+
paths_changed: list[str]
|
|
52
52
|
total_changes: int
|
|
53
53
|
|
|
54
54
|
|
|
@@ -57,7 +57,7 @@ class PatchResult:
|
|
|
57
57
|
"""Result of a patch operation."""
|
|
58
58
|
success: bool
|
|
59
59
|
operations_applied: int
|
|
60
|
-
errors:
|
|
60
|
+
errors: list[str]
|
|
61
61
|
result: Any
|
|
62
62
|
|
|
63
63
|
|
|
@@ -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.
|
|
6
|
+
Version: 0.0.1.410
|
|
7
7
|
Generation Date: October 26, 2025
|
|
8
8
|
|
|
9
9
|
Base classes and contracts for operations.
|
|
10
10
|
"""
|
|
11
11
|
|
|
12
12
|
from abc import ABC, abstractmethod
|
|
13
|
-
from typing import Any,
|
|
13
|
+
from typing import Any, Optional, Union
|
|
14
14
|
from .defs import MergeStrategy, DiffMode, PatchOperation, DiffResult, PatchResult
|
|
15
15
|
|
|
16
16
|
|
|
@@ -68,7 +68,7 @@ class IPatchOperation(IOperation):
|
|
|
68
68
|
"""Interface for patch operations."""
|
|
69
69
|
|
|
70
70
|
@abstractmethod
|
|
71
|
-
def apply_patch(self, data: Any, operations:
|
|
71
|
+
def apply_patch(self, data: Any, operations: list[dict[str, Any]]) -> PatchResult:
|
|
72
72
|
"""Apply patch operations to data."""
|
|
73
73
|
pass
|
|
74
74
|
|
|
@@ -8,7 +8,7 @@ Operations Contracts
|
|
|
8
8
|
Protocol definitions for data operations.
|
|
9
9
|
"""
|
|
10
10
|
|
|
11
|
-
from typing import Any,
|
|
11
|
+
from typing import Any, Protocol, runtime_checkable
|
|
12
12
|
from .defs import MergeStrategy, DiffMode
|
|
13
13
|
|
|
14
14
|
|
|
@@ -44,7 +44,7 @@ class IDiff(Protocol):
|
|
|
44
44
|
old: Any,
|
|
45
45
|
new: Any,
|
|
46
46
|
mode: DiffMode = DiffMode.STANDARD
|
|
47
|
-
) ->
|
|
47
|
+
) -> list[dict[str, Any]]:
|
|
48
48
|
"""Generate diff between two data structures."""
|
|
49
49
|
...
|
|
50
50
|
|
|
@@ -56,7 +56,7 @@ class IPatch(Protocol):
|
|
|
56
56
|
def patch(
|
|
57
57
|
self,
|
|
58
58
|
data: Any,
|
|
59
|
-
operations:
|
|
59
|
+
operations: list[dict[str, Any]]
|
|
60
60
|
) -> Any:
|
|
61
61
|
"""Apply patch operations to data."""
|
|
62
62
|
...
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
Company: eXonware.com
|
|
6
6
|
Author: Eng. Muhammad AlShehri
|
|
7
7
|
Email: connect@exonware.com
|
|
8
|
-
Version: 0.0.1.
|
|
8
|
+
Version: 0.0.1.410
|
|
9
9
|
Generation Date: October 27, 2025
|
|
10
10
|
|
|
11
11
|
Operations definitions and data structures.
|
|
@@ -13,7 +13,7 @@ Operations definitions and data structures.
|
|
|
13
13
|
|
|
14
14
|
from enum import Enum
|
|
15
15
|
from dataclasses import dataclass
|
|
16
|
-
from typing import Any
|
|
16
|
+
from typing import Any
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
class MergeStrategy(Enum):
|
|
@@ -45,9 +45,9 @@ class PatchOperation(Enum):
|
|
|
45
45
|
@dataclass
|
|
46
46
|
class DiffResult:
|
|
47
47
|
"""Result of a diff operation."""
|
|
48
|
-
operations:
|
|
48
|
+
operations: list[dict[str, Any]]
|
|
49
49
|
mode: DiffMode
|
|
50
|
-
paths_changed:
|
|
50
|
+
paths_changed: list[str]
|
|
51
51
|
total_changes: int
|
|
52
52
|
|
|
53
53
|
|
|
@@ -56,7 +56,7 @@ class PatchResult:
|
|
|
56
56
|
"""Result of a patch operation."""
|
|
57
57
|
success: bool
|
|
58
58
|
operations_applied: int
|
|
59
|
-
errors:
|
|
59
|
+
errors: list[str]
|
|
60
60
|
result: Any
|
|
61
61
|
|
|
62
62
|
|
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
Company: eXonware.com
|
|
6
6
|
Author: Eng. Muhammad AlShehri
|
|
7
7
|
Email: connect@exonware.com
|
|
8
|
-
Version: 0.0.1.
|
|
8
|
+
Version: 0.0.1.410
|
|
9
9
|
Generation Date: October 27, 2025
|
|
10
10
|
|
|
11
11
|
Diff operations implementation.
|
|
12
12
|
"""
|
|
13
13
|
|
|
14
14
|
import threading
|
|
15
|
-
from typing import Any,
|
|
15
|
+
from typing import Any, Optional, Union
|
|
16
16
|
from .base import IDiffOperation, DiffError
|
|
17
17
|
from .defs import DiffMode, DiffResult
|
|
18
18
|
from ..config.logging_setup import get_logger
|
|
@@ -76,7 +76,7 @@ class DiffOperation(IDiffOperation):
|
|
|
76
76
|
raise DiffError(f"Diff operation failed: {e}", "diff")
|
|
77
77
|
|
|
78
78
|
def _structural_diff(self, original: Any, modified: Any, path: str,
|
|
79
|
-
operations:
|
|
79
|
+
operations: list, paths_changed: list) -> list:
|
|
80
80
|
"""Compare structure only (keys, types)."""
|
|
81
81
|
# Compare types
|
|
82
82
|
if type(original) != type(modified):
|
|
@@ -133,7 +133,7 @@ class DiffOperation(IDiffOperation):
|
|
|
133
133
|
return operations
|
|
134
134
|
|
|
135
135
|
def _content_diff(self, original: Any, modified: Any, path: str,
|
|
136
|
-
operations:
|
|
136
|
+
operations: list, paths_changed: list) -> list:
|
|
137
137
|
"""Compare content only (values)."""
|
|
138
138
|
if original != modified:
|
|
139
139
|
operations.append({
|
|
@@ -148,7 +148,7 @@ class DiffOperation(IDiffOperation):
|
|
|
148
148
|
return operations
|
|
149
149
|
|
|
150
150
|
def _full_diff(self, original: Any, modified: Any, path: str,
|
|
151
|
-
operations:
|
|
151
|
+
operations: list, paths_changed: list) -> list:
|
|
152
152
|
"""
|
|
153
153
|
Compare both structure and content recursively.
|
|
154
154
|
|
|
@@ -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.
|
|
6
|
+
Version: 0.0.1.410
|
|
7
7
|
Generation Date: October 26, 2025
|
|
8
8
|
|
|
9
9
|
Merge operations implementation.
|
|
10
10
|
"""
|
|
11
11
|
|
|
12
12
|
import threading
|
|
13
|
-
from typing import Any,
|
|
13
|
+
from typing import Any, Optional, Union
|
|
14
14
|
from .base import IMergeOperation, MergeError
|
|
15
15
|
from .defs import MergeStrategy
|
|
16
16
|
from ..config.logging_setup import get_logger
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
Company: eXonware.com
|
|
6
6
|
Author: Eng. Muhammad AlShehri
|
|
7
7
|
Email: connect@exonware.com
|
|
8
|
-
Version: 0.0.1.
|
|
8
|
+
Version: 0.0.1.410
|
|
9
9
|
Generation Date: October 27, 2025
|
|
10
10
|
|
|
11
11
|
Patch operations implementation (RFC 6902 JSON Patch).
|
|
@@ -13,7 +13,7 @@ Patch operations implementation (RFC 6902 JSON Patch).
|
|
|
13
13
|
|
|
14
14
|
import threading
|
|
15
15
|
import copy
|
|
16
|
-
from typing import Any,
|
|
16
|
+
from typing import Any, Optional, Union
|
|
17
17
|
from .base import IPatchOperation, PatchError
|
|
18
18
|
from .defs import PatchOperation, PatchResult
|
|
19
19
|
from ..config.logging_setup import get_logger
|
|
@@ -36,7 +36,7 @@ class PatchOperationImpl(IPatchOperation):
|
|
|
36
36
|
|
|
37
37
|
return self.apply_patch(data, operations)
|
|
38
38
|
|
|
39
|
-
def apply_patch(self, data: Any, operations:
|
|
39
|
+
def apply_patch(self, data: Any, operations: list[dict[str, Any]]) -> PatchResult:
|
|
40
40
|
"""
|
|
41
41
|
Apply patch operations to data (RFC 6902 JSON Patch).
|
|
42
42
|
|
|
@@ -97,7 +97,7 @@ class PatchOperationImpl(IPatchOperation):
|
|
|
97
97
|
except Exception as e:
|
|
98
98
|
raise PatchError(f"Patch operation failed: {e}", "patch")
|
|
99
99
|
|
|
100
|
-
def _parse_path(self, path: str) ->
|
|
100
|
+
def _parse_path(self, path: str) -> list[str]:
|
|
101
101
|
"""Parse JSON Pointer path."""
|
|
102
102
|
if path == "/":
|
|
103
103
|
return []
|
|
@@ -218,7 +218,7 @@ class PatchOperationImpl(IPatchOperation):
|
|
|
218
218
|
|
|
219
219
|
|
|
220
220
|
# Convenience function
|
|
221
|
-
def apply_patch(data: Any, operations:
|
|
221
|
+
def apply_patch(data: Any, operations: list[dict[str, Any]]) -> PatchResult:
|
|
222
222
|
"""
|
|
223
223
|
Convenience function for patch operations.
|
|
224
224
|
|
|
@@ -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.
|
|
6
|
+
Version: 0.0.1.410
|
|
7
7
|
Generation Date: September 04, 2025
|
|
8
8
|
|
|
9
9
|
Abstract base classes for XSystem patterns.
|
|
10
10
|
"""
|
|
11
11
|
|
|
12
12
|
from abc import ABC, abstractmethod
|
|
13
|
-
from typing import Any
|
|
13
|
+
from typing import Any
|
|
14
14
|
|
|
15
15
|
from .contracts import IHandler, IPattern
|
|
16
16
|
|
|
@@ -83,7 +83,7 @@ class AHandler(IHandler[Any]):
|
|
|
83
83
|
"""
|
|
84
84
|
return True
|
|
85
85
|
|
|
86
|
-
def get_supported_formats(self) ->
|
|
86
|
+
def get_supported_formats(self) -> list[str]:
|
|
87
87
|
"""
|
|
88
88
|
Get list of formats this handler supports.
|
|
89
89
|
|
|
@@ -9,7 +9,7 @@ import contextlib
|
|
|
9
9
|
import logging
|
|
10
10
|
import threading
|
|
11
11
|
from contextlib import ExitStack, contextmanager
|
|
12
|
-
from typing import Any, ContextManager,
|
|
12
|
+
from typing import Any, ContextManager, Generator, Optional, Type, Union
|
|
13
13
|
|
|
14
14
|
logger = logging.getLogger(__name__)
|
|
15
15
|
|
|
@@ -273,8 +273,8 @@ class MultiContextManager:
|
|
|
273
273
|
|
|
274
274
|
def __init__(self) -> None:
|
|
275
275
|
"""Initialize empty multi-context manager."""
|
|
276
|
-
self.contexts:
|
|
277
|
-
self.entered_contexts:
|
|
276
|
+
self.contexts: list[ContextManager] = []
|
|
277
|
+
self.entered_contexts: list[Any] = []
|
|
278
278
|
self.stack: Optional[ExitStack] = None
|
|
279
279
|
|
|
280
280
|
def add_context(self, context: ContextManager):
|
|
@@ -283,7 +283,7 @@ class MultiContextManager:
|
|
|
283
283
|
raise RuntimeError("Cannot add contexts after entering")
|
|
284
284
|
self.contexts.append(context)
|
|
285
285
|
|
|
286
|
-
def __enter__(self) ->
|
|
286
|
+
def __enter__(self) -> list[Any]:
|
|
287
287
|
"""Enter all managed contexts."""
|
|
288
288
|
self.stack = ExitStack()
|
|
289
289
|
self.entered_contexts = []
|
|
@@ -327,7 +327,7 @@ class ContextManager:
|
|
|
327
327
|
def __init__(self, name: str = "context"):
|
|
328
328
|
"""Initialize context manager."""
|
|
329
329
|
self.name = name
|
|
330
|
-
self._contexts:
|
|
330
|
+
self._contexts: dict[str, Any] = {}
|
|
331
331
|
self._active = False
|
|
332
332
|
|
|
333
333
|
def __enter__(self):
|
|
@@ -360,6 +360,6 @@ class ContextManager:
|
|
|
360
360
|
"""Check if context is active."""
|
|
361
361
|
return self._active
|
|
362
362
|
|
|
363
|
-
def get_all_contexts(self) ->
|
|
363
|
+
def get_all_contexts(self) -> dict[str, Any]:
|
|
364
364
|
"""Get all contexts."""
|
|
365
365
|
return self._contexts.copy()
|