exonware-xwsystem 0.0.1.410__py3-none-any.whl → 0.1.0.1__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 +1 -1
- exonware/conf.py +1 -1
- exonware/xwsystem/__init__.py +2 -2
- exonware/xwsystem/caching/__init__.py +1 -1
- exonware/xwsystem/caching/base.py +2 -2
- exonware/xwsystem/caching/bloom_cache.py +2 -2
- exonware/xwsystem/caching/cache_manager.py +1 -1
- exonware/xwsystem/caching/conditional.py +2 -2
- exonware/xwsystem/caching/contracts.py +1 -1
- exonware/xwsystem/caching/decorators.py +2 -2
- exonware/xwsystem/caching/defs.py +1 -1
- exonware/xwsystem/caching/disk_cache.py +1 -1
- exonware/xwsystem/caching/distributed.py +1 -1
- exonware/xwsystem/caching/errors.py +1 -1
- exonware/xwsystem/caching/events.py +2 -2
- exonware/xwsystem/caching/eviction_strategies.py +1 -1
- exonware/xwsystem/caching/fluent.py +1 -1
- exonware/xwsystem/caching/integrity.py +1 -1
- exonware/xwsystem/caching/lfu_cache.py +2 -2
- exonware/xwsystem/caching/lfu_optimized.py +3 -3
- exonware/xwsystem/caching/lru_cache.py +2 -2
- exonware/xwsystem/caching/memory_bounded.py +2 -2
- exonware/xwsystem/caching/metrics_exporter.py +2 -2
- exonware/xwsystem/caching/observable_cache.py +1 -1
- exonware/xwsystem/caching/pluggable_cache.py +2 -2
- exonware/xwsystem/caching/rate_limiter.py +1 -1
- exonware/xwsystem/caching/read_through.py +2 -2
- exonware/xwsystem/caching/secure_cache.py +1 -1
- exonware/xwsystem/caching/serializable.py +2 -2
- exonware/xwsystem/caching/stats.py +1 -1
- exonware/xwsystem/caching/tagging.py +2 -2
- exonware/xwsystem/caching/ttl_cache.py +1 -1
- exonware/xwsystem/caching/two_tier_cache.py +1 -1
- exonware/xwsystem/caching/utils.py +1 -1
- exonware/xwsystem/caching/validation.py +1 -1
- exonware/xwsystem/caching/warming.py +2 -2
- exonware/xwsystem/caching/write_behind.py +2 -2
- exonware/xwsystem/cli/__init__.py +1 -1
- exonware/xwsystem/cli/args.py +1 -1
- exonware/xwsystem/cli/base.py +1 -1
- exonware/xwsystem/cli/colors.py +1 -1
- exonware/xwsystem/cli/console.py +1 -1
- exonware/xwsystem/cli/contracts.py +1 -1
- 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 +1 -1
- exonware/xwsystem/config/__init__.py +1 -1
- exonware/xwsystem/config/base.py +2 -2
- exonware/xwsystem/config/contracts.py +1 -1
- exonware/xwsystem/config/defaults.py +1 -1
- exonware/xwsystem/config/defs.py +1 -1
- exonware/xwsystem/config/errors.py +2 -2
- exonware/xwsystem/config/logging.py +1 -1
- exonware/xwsystem/config/logging_setup.py +2 -2
- exonware/xwsystem/config/performance.py +115 -388
- exonware/xwsystem/http_client/__init__.py +1 -1
- exonware/xwsystem/http_client/advanced_client.py +2 -2
- exonware/xwsystem/http_client/base.py +2 -2
- exonware/xwsystem/http_client/client.py +2 -2
- exonware/xwsystem/http_client/contracts.py +1 -1
- exonware/xwsystem/http_client/defs.py +1 -1
- exonware/xwsystem/http_client/errors.py +2 -2
- exonware/xwsystem/io/__init__.py +1 -1
- exonware/xwsystem/io/archive/__init__.py +1 -1
- exonware/xwsystem/io/archive/archive.py +1 -1
- exonware/xwsystem/io/archive/archive_files.py +1 -1
- exonware/xwsystem/io/archive/archivers.py +2 -2
- exonware/xwsystem/io/archive/base.py +6 -6
- 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 +6 -3
- exonware/xwsystem/io/archive/formats/lz4_format.py +6 -3
- exonware/xwsystem/io/archive/formats/rar.py +6 -3
- exonware/xwsystem/io/archive/formats/sevenzip.py +6 -3
- exonware/xwsystem/io/archive/formats/squashfs_format.py +1 -1
- exonware/xwsystem/io/archive/formats/tar.py +1 -1
- exonware/xwsystem/io/archive/formats/wim_format.py +6 -3
- exonware/xwsystem/io/archive/formats/zip.py +1 -1
- exonware/xwsystem/io/archive/formats/zpaq_format.py +1 -1
- exonware/xwsystem/io/archive/formats/zstandard.py +6 -3
- exonware/xwsystem/io/base.py +1 -1
- exonware/xwsystem/io/codec/__init__.py +1 -1
- exonware/xwsystem/io/codec/base.py +6 -6
- exonware/xwsystem/io/codec/contracts.py +1 -1
- exonware/xwsystem/io/codec/registry.py +5 -5
- exonware/xwsystem/io/common/__init__.py +1 -1
- exonware/xwsystem/io/common/base.py +1 -1
- exonware/xwsystem/io/common/lock.py +1 -1
- exonware/xwsystem/io/common/watcher.py +1 -1
- exonware/xwsystem/io/contracts.py +1 -1
- exonware/xwsystem/io/data_operations.py +746 -0
- exonware/xwsystem/io/defs.py +1 -1
- exonware/xwsystem/io/errors.py +1 -1
- exonware/xwsystem/io/facade.py +2 -2
- exonware/xwsystem/io/file/__init__.py +1 -1
- exonware/xwsystem/io/file/base.py +1 -1
- exonware/xwsystem/io/file/conversion.py +1 -1
- exonware/xwsystem/io/file/file.py +8 -6
- exonware/xwsystem/io/file/paged_source.py +8 -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 +20 -9
- exonware/xwsystem/io/filesystem/__init__.py +1 -1
- exonware/xwsystem/io/filesystem/base.py +1 -1
- exonware/xwsystem/io/filesystem/local.py +9 -1
- exonware/xwsystem/io/folder/__init__.py +1 -1
- exonware/xwsystem/io/folder/base.py +1 -1
- exonware/xwsystem/io/folder/folder.py +2 -2
- exonware/xwsystem/io/serialization/__init__.py +1 -1
- exonware/xwsystem/io/serialization/auto_serializer.py +52 -39
- exonware/xwsystem/io/serialization/base.py +165 -1
- exonware/xwsystem/io/serialization/contracts.py +88 -1
- exonware/xwsystem/io/serialization/defs.py +1 -1
- exonware/xwsystem/io/serialization/errors.py +1 -1
- exonware/xwsystem/io/serialization/flyweight.py +10 -10
- exonware/xwsystem/io/serialization/format_detector.py +8 -5
- 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 +53 -1
- exonware/xwsystem/io/serialization/formats/database/shelve.py +48 -1
- exonware/xwsystem/io/serialization/formats/database/sqlite3.py +85 -1
- exonware/xwsystem/io/serialization/formats/text/append_only_log.py +201 -0
- exonware/xwsystem/io/serialization/formats/text/configparser.py +1 -1
- exonware/xwsystem/io/serialization/formats/text/csv.py +1 -1
- exonware/xwsystem/io/serialization/formats/text/formdata.py +1 -1
- exonware/xwsystem/io/serialization/formats/text/json.py +43 -20
- exonware/xwsystem/io/serialization/formats/text/json5.py +7 -5
- exonware/xwsystem/io/serialization/formats/text/jsonlines.py +316 -22
- exonware/xwsystem/io/serialization/formats/text/multipart.py +1 -1
- exonware/xwsystem/io/serialization/formats/text/toml.py +19 -3
- exonware/xwsystem/io/serialization/formats/text/xml.py +8 -1
- exonware/xwsystem/io/serialization/formats/text/yaml.py +52 -2
- exonware/xwsystem/io/serialization/parsers/__init__.py +15 -0
- exonware/xwsystem/io/serialization/parsers/base.py +59 -0
- exonware/xwsystem/io/serialization/parsers/hybrid_parser.py +61 -0
- exonware/xwsystem/io/serialization/parsers/msgspec_parser.py +45 -0
- exonware/xwsystem/io/serialization/parsers/orjson_direct_parser.py +53 -0
- exonware/xwsystem/io/serialization/parsers/orjson_parser.py +59 -0
- exonware/xwsystem/io/serialization/parsers/pysimdjson_parser.py +51 -0
- exonware/xwsystem/io/serialization/parsers/rapidjson_parser.py +50 -0
- exonware/xwsystem/io/serialization/parsers/registry.py +90 -0
- exonware/xwsystem/io/serialization/parsers/standard.py +43 -0
- exonware/xwsystem/io/serialization/parsers/ujson_parser.py +50 -0
- exonware/xwsystem/io/serialization/registry.py +1 -1
- exonware/xwsystem/io/serialization/serializer.py +175 -3
- exonware/xwsystem/io/serialization/utils/__init__.py +1 -1
- exonware/xwsystem/io/serialization/utils/path_ops.py +1 -1
- exonware/xwsystem/io/stream/__init__.py +1 -1
- exonware/xwsystem/io/stream/async_operations.py +1 -1
- exonware/xwsystem/io/stream/base.py +1 -1
- exonware/xwsystem/io/stream/codec_io.py +1 -1
- exonware/xwsystem/ipc/async_fabric.py +1 -2
- exonware/xwsystem/ipc/base.py +2 -2
- exonware/xwsystem/ipc/contracts.py +2 -2
- exonware/xwsystem/ipc/defs.py +1 -1
- exonware/xwsystem/ipc/errors.py +2 -2
- exonware/xwsystem/ipc/pipes.py +2 -2
- exonware/xwsystem/ipc/shared_memory.py +2 -2
- exonware/xwsystem/monitoring/base.py +2 -2
- exonware/xwsystem/monitoring/contracts.py +1 -1
- exonware/xwsystem/monitoring/defs.py +1 -1
- exonware/xwsystem/monitoring/error_recovery.py +2 -2
- exonware/xwsystem/monitoring/errors.py +2 -2
- exonware/xwsystem/monitoring/memory_monitor.py +1 -1
- exonware/xwsystem/monitoring/performance_manager_generic.py +2 -2
- exonware/xwsystem/monitoring/performance_validator.py +1 -1
- exonware/xwsystem/monitoring/system_monitor.py +2 -2
- exonware/xwsystem/monitoring/tracing.py +2 -2
- exonware/xwsystem/monitoring/tracker.py +1 -1
- exonware/xwsystem/operations/__init__.py +1 -1
- exonware/xwsystem/operations/base.py +1 -1
- exonware/xwsystem/operations/defs.py +1 -1
- exonware/xwsystem/operations/diff.py +1 -1
- exonware/xwsystem/operations/merge.py +1 -1
- exonware/xwsystem/operations/patch.py +1 -1
- exonware/xwsystem/patterns/base.py +2 -2
- exonware/xwsystem/patterns/context_manager.py +2 -2
- exonware/xwsystem/patterns/contracts.py +9 -9
- exonware/xwsystem/patterns/defs.py +1 -1
- exonware/xwsystem/patterns/dynamic_facade.py +8 -8
- exonware/xwsystem/patterns/errors.py +5 -5
- exonware/xwsystem/patterns/handler_factory.py +6 -6
- exonware/xwsystem/patterns/object_pool.py +7 -7
- exonware/xwsystem/patterns/registry.py +3 -3
- exonware/xwsystem/plugins/__init__.py +1 -1
- exonware/xwsystem/plugins/base.py +5 -5
- exonware/xwsystem/plugins/contracts.py +5 -5
- exonware/xwsystem/plugins/defs.py +1 -1
- exonware/xwsystem/plugins/errors.py +4 -4
- exonware/xwsystem/runtime/__init__.py +1 -1
- exonware/xwsystem/runtime/base.py +6 -6
- exonware/xwsystem/runtime/contracts.py +6 -6
- exonware/xwsystem/runtime/defs.py +1 -1
- exonware/xwsystem/runtime/env.py +2 -2
- exonware/xwsystem/runtime/errors.py +1 -1
- exonware/xwsystem/runtime/reflection.py +8 -8
- exonware/xwsystem/security/auth.py +1 -1
- exonware/xwsystem/security/base.py +2 -2
- exonware/xwsystem/security/contracts.py +1 -1
- exonware/xwsystem/security/crypto.py +2 -2
- exonware/xwsystem/security/defs.py +1 -1
- exonware/xwsystem/security/errors.py +2 -2
- exonware/xwsystem/security/hazmat.py +2 -2
- exonware/xwsystem/shared/__init__.py +1 -1
- exonware/xwsystem/shared/base.py +1 -1
- exonware/xwsystem/shared/contracts.py +1 -1
- exonware/xwsystem/shared/defs.py +1 -1
- exonware/xwsystem/shared/errors.py +1 -1
- exonware/xwsystem/structures/__init__.py +1 -1
- exonware/xwsystem/structures/base.py +2 -2
- exonware/xwsystem/structures/contracts.py +1 -1
- exonware/xwsystem/structures/defs.py +1 -1
- exonware/xwsystem/structures/errors.py +2 -2
- exonware/xwsystem/threading/async_primitives.py +2 -2
- exonware/xwsystem/threading/base.py +2 -2
- exonware/xwsystem/threading/contracts.py +1 -1
- exonware/xwsystem/threading/defs.py +1 -1
- exonware/xwsystem/threading/errors.py +2 -2
- exonware/xwsystem/threading/safe_factory.py +6 -6
- exonware/xwsystem/utils/base.py +2 -2
- exonware/xwsystem/utils/contracts.py +1 -1
- exonware/xwsystem/utils/dt/__init__.py +1 -1
- exonware/xwsystem/utils/dt/base.py +2 -2
- exonware/xwsystem/utils/dt/contracts.py +1 -1
- exonware/xwsystem/utils/dt/defs.py +1 -1
- exonware/xwsystem/utils/dt/errors.py +2 -2
- exonware/xwsystem/utils/dt/formatting.py +1 -1
- exonware/xwsystem/utils/dt/humanize.py +2 -2
- exonware/xwsystem/utils/dt/parsing.py +1 -1
- exonware/xwsystem/utils/dt/timezone_utils.py +1 -1
- exonware/xwsystem/utils/errors.py +2 -2
- exonware/xwsystem/utils/utils_contracts.py +1 -1
- exonware/xwsystem/validation/__init__.py +1 -1
- exonware/xwsystem/validation/base.py +15 -15
- exonware/xwsystem/validation/contracts.py +1 -1
- exonware/xwsystem/validation/data_validator.py +10 -0
- exonware/xwsystem/validation/declarative.py +9 -9
- exonware/xwsystem/validation/defs.py +1 -1
- exonware/xwsystem/validation/errors.py +2 -2
- exonware/xwsystem/validation/fluent_validator.py +4 -4
- exonware/xwsystem/version.py +4 -4
- {exonware_xwsystem-0.0.1.410.dist-info → exonware_xwsystem-0.1.0.1.dist-info}/METADATA +3 -3
- exonware_xwsystem-0.1.0.1.dist-info/RECORD +284 -0
- exonware/xwsystem/caching/USAGE_GUIDE.md +0 -779
- exonware/xwsystem/utils/test_runner.py +0 -526
- exonware_xwsystem-0.0.1.410.dist-info/RECORD +0 -273
- {exonware_xwsystem-0.0.1.410.dist-info → exonware_xwsystem-0.1.0.1.dist-info}/WHEEL +0 -0
- {exonware_xwsystem-0.0.1.410.dist-info → exonware_xwsystem-0.1.0.1.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
#exonware/
|
|
1
|
+
#exonware/xwsystem/threading/errors.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
|
|
6
|
+
Version: 0.1.0.1
|
|
7
7
|
Generation Date: September 04, 2025
|
|
8
8
|
|
|
9
9
|
Threading module errors - exception classes for threading functionality.
|
|
@@ -6,7 +6,7 @@ Thread-safe factory pattern for handler registration and management.
|
|
|
6
6
|
import logging
|
|
7
7
|
import threading
|
|
8
8
|
from abc import ABC, abstractmethod
|
|
9
|
-
from typing import Any, Callable, Optional
|
|
9
|
+
from typing import Any, Callable, Optional
|
|
10
10
|
# Root cause: Migrating to Python 3.12 built-in generic syntax for consistency
|
|
11
11
|
# Priority #3: Maintainability - Modern type annotations improve code clarity
|
|
12
12
|
|
|
@@ -22,14 +22,14 @@ class ThreadSafeFactory[T]:
|
|
|
22
22
|
"""
|
|
23
23
|
|
|
24
24
|
def __init__(self) -> None:
|
|
25
|
-
self._handlers: dict[str,
|
|
25
|
+
self._handlers: dict[str, type[T]] = {}
|
|
26
26
|
self._extensions: dict[str, str] = {}
|
|
27
27
|
self._lock = threading.RLock() # Reentrant lock for thread safety
|
|
28
28
|
self._methods_generated = False
|
|
29
29
|
self._methods_lock = threading.Lock()
|
|
30
30
|
|
|
31
31
|
def register(
|
|
32
|
-
self, name: str, handler_class:
|
|
32
|
+
self, name: str, handler_class: type[T], extensions: Optional[list[str]] = None
|
|
33
33
|
) -> None:
|
|
34
34
|
"""
|
|
35
35
|
Register a handler with optional file extensions.
|
|
@@ -58,7 +58,7 @@ class ThreadSafeFactory[T]:
|
|
|
58
58
|
)
|
|
59
59
|
self._extensions[ext] = name_lower
|
|
60
60
|
|
|
61
|
-
def get_handler(self, name: str) ->
|
|
61
|
+
def get_handler(self, name: str) -> type[T]:
|
|
62
62
|
"""
|
|
63
63
|
Get a handler by name.
|
|
64
64
|
|
|
@@ -77,7 +77,7 @@ class ThreadSafeFactory[T]:
|
|
|
77
77
|
raise KeyError(f"No handler registered for: {name}")
|
|
78
78
|
return handler
|
|
79
79
|
|
|
80
|
-
def get_handler_if_exists(self, name: str) -> Optional[
|
|
80
|
+
def get_handler_if_exists(self, name: str) -> Optional[type[T]]:
|
|
81
81
|
"""
|
|
82
82
|
Get a handler by name, returning None if not found.
|
|
83
83
|
|
|
@@ -167,7 +167,7 @@ class MethodGenerator:
|
|
|
167
167
|
|
|
168
168
|
@staticmethod
|
|
169
169
|
def generate_export_methods(
|
|
170
|
-
target_class:
|
|
170
|
+
target_class: type,
|
|
171
171
|
factory: ThreadSafeFactory,
|
|
172
172
|
method_template: Callable,
|
|
173
173
|
method_name_pattern: str = "{action}_{format}",
|
exonware/xwsystem/utils/base.py
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
#exonware/
|
|
1
|
+
#exonware/xwsystem/utils/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
|
|
6
|
+
Version: 0.1.0.1
|
|
7
7
|
Generation Date: September 04, 2025
|
|
8
8
|
|
|
9
9
|
Utils module base classes - abstract classes for utility functionality.
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
#exonware/
|
|
1
|
+
#exonware/xwsystem/datetime/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
|
|
6
|
+
Version: 0.1.0.1
|
|
7
7
|
Generation Date: September 04, 2025
|
|
8
8
|
|
|
9
9
|
DateTime module base classes - abstract classes for date/time functionality.
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
#exonware/
|
|
1
|
+
#exonware/xwsystem/datetime/errors.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
|
|
6
|
+
Version: 0.1.0.1
|
|
7
7
|
Generation Date: September 04, 2025
|
|
8
8
|
|
|
9
9
|
DateTime module errors - exception classes for date/time functionality.
|
|
@@ -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.1.0.1
|
|
6
6
|
Generation Date: September 04, 2025
|
|
7
7
|
|
|
8
8
|
Human-friendly datetime formatting and parsing utilities.
|
|
@@ -14,7 +14,7 @@ from typing import Optional, Union
|
|
|
14
14
|
|
|
15
15
|
from exonware.xwsystem.config.logging_setup import get_logger
|
|
16
16
|
|
|
17
|
-
logger = get_logger("
|
|
17
|
+
logger = get_logger("xwsystem.utils.dt.humanize")
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
def humanize_timedelta(td: timedelta, precision: int = 2, max_units: int = 2) -> str:
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
#exonware/
|
|
1
|
+
#exonware/xwsystem/utils/errors.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
|
|
6
|
+
Version: 0.1.0.1
|
|
7
7
|
Generation Date: September 04, 2025
|
|
8
8
|
|
|
9
9
|
Utils module errors - exception classes for utility functionality.
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
#exonware/
|
|
1
|
+
#exonware/xwsystem/validation/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
|
|
6
|
+
Version: 0.1.0.1
|
|
7
7
|
Generation Date: September 04, 2025
|
|
8
8
|
|
|
9
9
|
Validation module base classes - abstract classes for validation functionality.
|
|
10
10
|
"""
|
|
11
11
|
|
|
12
12
|
from abc import ABC, abstractmethod
|
|
13
|
-
from typing import Any, Optional, Union, Callable
|
|
13
|
+
from typing import Any, Optional, Union, Callable
|
|
14
14
|
# Root cause: Migrating to Python 3.12 built-in generic syntax for consistency
|
|
15
15
|
# Priority #3: Maintainability - Modern type annotations improve code clarity
|
|
16
16
|
from .contracts import ValidationType, ValidationLevel, ConstraintType, SchemaType
|
|
@@ -82,17 +82,17 @@ class ADataValidatorBase(ABC):
|
|
|
82
82
|
|
|
83
83
|
def __init__(self):
|
|
84
84
|
"""Initialize data validator."""
|
|
85
|
-
self._validators: dict[
|
|
85
|
+
self._validators: dict[type, AValidatorBase] = {}
|
|
86
86
|
self._custom_validators: dict[str, Callable] = {}
|
|
87
87
|
self._validation_cache: dict[str, bool] = {}
|
|
88
88
|
|
|
89
89
|
@abstractmethod
|
|
90
|
-
def validate_data(self, data: Any, data_type: Optional[
|
|
90
|
+
def validate_data(self, data: Any, data_type: Optional[type] = None) -> bool:
|
|
91
91
|
"""Validate data."""
|
|
92
92
|
pass
|
|
93
93
|
|
|
94
94
|
@abstractmethod
|
|
95
|
-
def validate_type(self, data: Any, expected_type:
|
|
95
|
+
def validate_type(self, data: Any, expected_type: type) -> bool:
|
|
96
96
|
"""Validate data type."""
|
|
97
97
|
pass
|
|
98
98
|
|
|
@@ -134,17 +134,17 @@ class ADataValidatorBase(ABC):
|
|
|
134
134
|
pass
|
|
135
135
|
|
|
136
136
|
@abstractmethod
|
|
137
|
-
def register_validator(self, data_type:
|
|
137
|
+
def register_validator(self, data_type: type, validator: AValidatorBase) -> None:
|
|
138
138
|
"""Register validator for data type."""
|
|
139
139
|
pass
|
|
140
140
|
|
|
141
141
|
@abstractmethod
|
|
142
|
-
def unregister_validator(self, data_type:
|
|
142
|
+
def unregister_validator(self, data_type: type) -> None:
|
|
143
143
|
"""Unregister validator for data type."""
|
|
144
144
|
pass
|
|
145
145
|
|
|
146
146
|
@abstractmethod
|
|
147
|
-
def get_validator(self, data_type:
|
|
147
|
+
def get_validator(self, data_type: type) -> Optional[AValidatorBase]:
|
|
148
148
|
"""Get validator for data type."""
|
|
149
149
|
pass
|
|
150
150
|
|
|
@@ -154,27 +154,27 @@ class ATypeSafetyBase(ABC):
|
|
|
154
154
|
|
|
155
155
|
def __init__(self):
|
|
156
156
|
"""Initialize type safety."""
|
|
157
|
-
self._type_annotations: dict[str,
|
|
157
|
+
self._type_annotations: dict[str, type] = {}
|
|
158
158
|
self._type_checks: dict[str, bool] = {}
|
|
159
159
|
self._strict_mode = False
|
|
160
160
|
|
|
161
161
|
@abstractmethod
|
|
162
|
-
def check_type(self, data: Any, expected_type:
|
|
162
|
+
def check_type(self, data: Any, expected_type: type) -> bool:
|
|
163
163
|
"""Check data type."""
|
|
164
164
|
pass
|
|
165
165
|
|
|
166
166
|
@abstractmethod
|
|
167
|
-
def check_types(self, data: dict[str, Any], type_annotations: dict[str,
|
|
167
|
+
def check_types(self, data: dict[str, Any], type_annotations: dict[str, type]) -> bool:
|
|
168
168
|
"""Check multiple data types."""
|
|
169
169
|
pass
|
|
170
170
|
|
|
171
171
|
@abstractmethod
|
|
172
|
-
def coerce_type(self, data: Any, target_type:
|
|
172
|
+
def coerce_type(self, data: Any, target_type: type) -> Any:
|
|
173
173
|
"""Coerce data to target type."""
|
|
174
174
|
pass
|
|
175
175
|
|
|
176
176
|
@abstractmethod
|
|
177
|
-
def is_type_safe(self, data: Any, expected_type:
|
|
177
|
+
def is_type_safe(self, data: Any, expected_type: type) -> bool:
|
|
178
178
|
"""Check if data is type safe."""
|
|
179
179
|
pass
|
|
180
180
|
|
|
@@ -184,7 +184,7 @@ class ATypeSafetyBase(ABC):
|
|
|
184
184
|
pass
|
|
185
185
|
|
|
186
186
|
@abstractmethod
|
|
187
|
-
def validate_type_annotations(self, annotations: dict[str,
|
|
187
|
+
def validate_type_annotations(self, annotations: dict[str, type]) -> bool:
|
|
188
188
|
"""Validate type annotations."""
|
|
189
189
|
pass
|
|
190
190
|
|
|
@@ -218,6 +218,16 @@ class DataValidator:
|
|
|
218
218
|
self.max_path_depth = max_path_depth or DEFAULT_MAX_PATH_DEPTH
|
|
219
219
|
self.max_resolution_depth = max_resolution_depth or DEFAULT_MAX_RESOLUTION_DEPTH
|
|
220
220
|
|
|
221
|
+
def validate_data(
|
|
222
|
+
self, data: Any, operation_name: str = "data_validation"
|
|
223
|
+
) -> None:
|
|
224
|
+
"""
|
|
225
|
+
Validate data structure depth and complexity.
|
|
226
|
+
|
|
227
|
+
This is a convenience method that wraps validate_data_structure.
|
|
228
|
+
"""
|
|
229
|
+
self.validate_data_structure(data, operation_name)
|
|
230
|
+
|
|
221
231
|
def validate_data_structure(
|
|
222
232
|
self, data: Any, operation_name: str = "data_validation"
|
|
223
233
|
) -> None:
|
|
@@ -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.1.0.1
|
|
6
6
|
Generation Date: September 04, 2025
|
|
7
7
|
|
|
8
8
|
Pydantic-style declarative validation with type hints and automatic coercion.
|
|
@@ -12,13 +12,13 @@ import inspect
|
|
|
12
12
|
import json
|
|
13
13
|
from dataclasses import dataclass, field
|
|
14
14
|
from enum import Enum
|
|
15
|
-
from typing import Any, Optional,
|
|
15
|
+
from typing import Any, Optional, Union, get_type_hints, get_origin, get_args
|
|
16
16
|
from datetime import datetime, date
|
|
17
17
|
from pathlib import Path
|
|
18
18
|
|
|
19
19
|
from ..config.logging_setup import get_logger
|
|
20
20
|
|
|
21
|
-
logger = get_logger("
|
|
21
|
+
logger = get_logger("xwsystem.validation.declarative")
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
class ValidationError(Exception):
|
|
@@ -203,7 +203,7 @@ class XModel(metaclass=ModelMeta):
|
|
|
203
203
|
|
|
204
204
|
return validated
|
|
205
205
|
|
|
206
|
-
def _validate_field(self, field_name: str, value: Any, field_type:
|
|
206
|
+
def _validate_field(self, field_name: str, value: Any, field_type: type, field_config: Field) -> Any:
|
|
207
207
|
"""Validate and coerce a single field."""
|
|
208
208
|
if value is None:
|
|
209
209
|
if self._is_optional(field_type):
|
|
@@ -223,7 +223,7 @@ class XModel(metaclass=ModelMeta):
|
|
|
223
223
|
return coerced_value
|
|
224
224
|
|
|
225
225
|
@classmethod
|
|
226
|
-
def _is_optional(cls, field_type:
|
|
226
|
+
def _is_optional(cls, field_type: type) -> bool:
|
|
227
227
|
"""Check if field type is Optional."""
|
|
228
228
|
origin = get_origin(field_type)
|
|
229
229
|
if origin is Union:
|
|
@@ -232,7 +232,7 @@ class XModel(metaclass=ModelMeta):
|
|
|
232
232
|
return False
|
|
233
233
|
|
|
234
234
|
@classmethod
|
|
235
|
-
def _get_actual_type(cls, field_type:
|
|
235
|
+
def _get_actual_type(cls, field_type: type) -> type:
|
|
236
236
|
"""Get actual type from Optional/Union types."""
|
|
237
237
|
origin = get_origin(field_type)
|
|
238
238
|
if origin is Union:
|
|
@@ -246,7 +246,7 @@ class XModel(metaclass=ModelMeta):
|
|
|
246
246
|
return non_none_args[0] if non_none_args else field_type
|
|
247
247
|
return field_type
|
|
248
248
|
|
|
249
|
-
def _coerce_type(self, value: Any, target_type:
|
|
249
|
+
def _coerce_type(self, value: Any, target_type: type, field_name: str) -> Any:
|
|
250
250
|
"""Coerce value to target type."""
|
|
251
251
|
if isinstance(value, target_type):
|
|
252
252
|
return value
|
|
@@ -316,7 +316,7 @@ class XModel(metaclass=ModelMeta):
|
|
|
316
316
|
else:
|
|
317
317
|
raise ValidationError(f"Cannot convert {type(value).__name__} to list")
|
|
318
318
|
|
|
319
|
-
#
|
|
319
|
+
# dict coercion
|
|
320
320
|
elif target_type == dict or (hasattr(target_type, '__origin__') and target_type.__origin__ is dict):
|
|
321
321
|
if isinstance(value, dict):
|
|
322
322
|
return value
|
|
@@ -528,7 +528,7 @@ class XModel(metaclass=ModelMeta):
|
|
|
528
528
|
return schema
|
|
529
529
|
|
|
530
530
|
@classmethod
|
|
531
|
-
def _type_to_json_schema(cls, field_type:
|
|
531
|
+
def _type_to_json_schema(cls, field_type: type, field_config: Field) -> dict[str, Any]:
|
|
532
532
|
"""Convert Python type to JSON Schema property."""
|
|
533
533
|
# Handle Optional types
|
|
534
534
|
if cls._is_optional(field_type):
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
#exonware/
|
|
1
|
+
#exonware/xwsystem/validation/errors.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
|
|
6
|
+
Version: 0.1.0.1
|
|
7
7
|
Generation Date: September 04, 2025
|
|
8
8
|
|
|
9
9
|
Validation module errors - exception classes for validation functionality.
|
|
@@ -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.1.0.1
|
|
7
7
|
Generation Date: October 26, 2025
|
|
8
8
|
|
|
9
9
|
Fluent validator with chainable API for data validation.
|
|
10
10
|
"""
|
|
11
11
|
|
|
12
|
-
from typing import Any, Callable, Optional, Union
|
|
12
|
+
from typing import Any, Callable, Optional, Union
|
|
13
13
|
from .errors import ValidationError
|
|
14
14
|
from ..config.logging_setup import get_logger
|
|
15
15
|
|
|
@@ -65,7 +65,7 @@ class FluentValidator:
|
|
|
65
65
|
|
|
66
66
|
return self
|
|
67
67
|
|
|
68
|
-
def type_check(self, expected_type:
|
|
68
|
+
def type_check(self, expected_type: type, message: Optional[str] = None) -> 'FluentValidator':
|
|
69
69
|
"""
|
|
70
70
|
Check if data is of expected type.
|
|
71
71
|
|
|
@@ -361,7 +361,7 @@ def is_required(field_name: str) -> Callable[[FluentValidator], FluentValidator]
|
|
|
361
361
|
return lambda v: v.require(field_name)
|
|
362
362
|
|
|
363
363
|
|
|
364
|
-
def is_type(expected_type:
|
|
364
|
+
def is_type(expected_type: type) -> Callable[[FluentValidator], FluentValidator]:
|
|
365
365
|
"""Create a type check rule."""
|
|
366
366
|
return lambda v: v.type_check(expected_type)
|
|
367
367
|
|
exonware/xwsystem/version.py
CHANGED
|
@@ -14,13 +14,13 @@ All version references should import from this module to ensure consistency.
|
|
|
14
14
|
# =============================================================================
|
|
15
15
|
|
|
16
16
|
# Main version - update this to change version across entire project
|
|
17
|
-
__version__ = "0.0.1
|
|
17
|
+
__version__ = "0.1.0.1"
|
|
18
18
|
|
|
19
19
|
# Version components for programmatic access
|
|
20
20
|
VERSION_MAJOR = 0
|
|
21
|
-
VERSION_MINOR =
|
|
22
|
-
VERSION_PATCH =
|
|
23
|
-
VERSION_BUILD =
|
|
21
|
+
VERSION_MINOR = 1
|
|
22
|
+
VERSION_PATCH = 0
|
|
23
|
+
VERSION_BUILD = 1 # Set to None for releases, or build number for dev builds
|
|
24
24
|
|
|
25
25
|
# Version metadata
|
|
26
26
|
VERSION_SUFFIX = "" # e.g., "dev", "alpha", "beta", "rc1"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: exonware-xwsystem
|
|
3
|
-
Version: 0.0.1
|
|
3
|
+
Version: 0.1.0.1
|
|
4
4
|
Summary: Enterprise-grade Python framework with AI-powered performance optimization, 24 serialization formats, military-grade security, automatic memory leak prevention, circuit breakers, and production monitoring - replaces 50+ dependencies
|
|
5
5
|
Project-URL: Homepage, https://exonware.com
|
|
6
6
|
Project-URL: Repository, https://github.com/exonware/xwsystem
|
|
@@ -76,8 +76,8 @@ Description-Content-Type: text/markdown
|
|
|
76
76
|
**Company:** eXonware.com
|
|
77
77
|
**Author:** Eng. Muhammad AlShehri
|
|
78
78
|
**Email:** connect@exonware.com
|
|
79
|
-
**Version:** 0.0.1
|
|
80
|
-
**Updated:**
|
|
79
|
+
**Version:** 0.1.0.1
|
|
80
|
+
**Updated:** 22-Dec-2025
|
|
81
81
|
|
|
82
82
|
## 🎯 **The Python Revolution Starts Here**
|
|
83
83
|
|