exonware-xwsystem 0.1.0.1__py3-none-any.whl → 0.1.0.4__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 -1
- exonware/conf.py +2 -2
- exonware/xwsystem/__init__.py +115 -43
- exonware/xwsystem/base.py +30 -0
- exonware/xwsystem/caching/__init__.py +39 -13
- exonware/xwsystem/caching/base.py +24 -6
- exonware/xwsystem/caching/bloom_cache.py +2 -2
- exonware/xwsystem/caching/cache_manager.py +2 -1
- exonware/xwsystem/caching/conditional.py +2 -2
- exonware/xwsystem/caching/contracts.py +85 -139
- exonware/xwsystem/caching/decorators.py +6 -19
- exonware/xwsystem/caching/defs.py +2 -1
- exonware/xwsystem/caching/disk_cache.py +2 -1
- exonware/xwsystem/caching/distributed.py +2 -1
- exonware/xwsystem/caching/errors.py +2 -1
- exonware/xwsystem/caching/events.py +110 -27
- exonware/xwsystem/caching/eviction_strategies.py +2 -2
- exonware/xwsystem/caching/external_caching_python.py +701 -0
- exonware/xwsystem/caching/facade.py +253 -0
- exonware/xwsystem/caching/factory.py +300 -0
- exonware/xwsystem/caching/fluent.py +14 -12
- exonware/xwsystem/caching/integrity.py +21 -6
- exonware/xwsystem/caching/lfu_cache.py +2 -1
- exonware/xwsystem/caching/lfu_optimized.py +18 -6
- exonware/xwsystem/caching/lru_cache.py +7 -4
- exonware/xwsystem/caching/memory_bounded.py +2 -2
- exonware/xwsystem/caching/metrics_exporter.py +2 -2
- exonware/xwsystem/caching/observable_cache.py +2 -2
- exonware/xwsystem/caching/pluggable_cache.py +2 -2
- exonware/xwsystem/caching/rate_limiter.py +2 -2
- exonware/xwsystem/caching/read_through.py +2 -2
- exonware/xwsystem/caching/secure_cache.py +81 -28
- exonware/xwsystem/caching/serializable.py +9 -7
- exonware/xwsystem/caching/stats.py +2 -2
- exonware/xwsystem/caching/tagging.py +2 -2
- exonware/xwsystem/caching/ttl_cache.py +4 -3
- exonware/xwsystem/caching/two_tier_cache.py +6 -3
- exonware/xwsystem/caching/utils.py +30 -12
- exonware/xwsystem/caching/validation.py +2 -2
- exonware/xwsystem/caching/warming.py +6 -3
- exonware/xwsystem/caching/write_behind.py +15 -6
- exonware/xwsystem/config/__init__.py +11 -17
- exonware/xwsystem/config/base.py +5 -5
- exonware/xwsystem/config/contracts.py +93 -153
- exonware/xwsystem/config/defaults.py +3 -2
- exonware/xwsystem/config/defs.py +3 -2
- exonware/xwsystem/config/errors.py +2 -5
- exonware/xwsystem/config/logging.py +12 -8
- exonware/xwsystem/config/logging_setup.py +3 -2
- exonware/xwsystem/config/performance.py +1 -46
- exonware/xwsystem/config/performance_modes.py +9 -8
- exonware/xwsystem/config/version_manager.py +1 -0
- exonware/xwsystem/config.py +27 -0
- exonware/xwsystem/console/__init__.py +53 -0
- exonware/xwsystem/console/base.py +133 -0
- exonware/xwsystem/console/cli/__init__.py +61 -0
- exonware/xwsystem/{cli → console/cli}/args.py +27 -24
- exonware/xwsystem/{cli → console/cli}/base.py +18 -87
- exonware/xwsystem/{cli → console/cli}/colors.py +15 -13
- exonware/xwsystem/console/cli/console.py +98 -0
- exonware/xwsystem/{cli → console/cli}/contracts.py +51 -69
- exonware/xwsystem/console/cli/defs.py +87 -0
- exonware/xwsystem/console/cli/encoding.py +69 -0
- exonware/xwsystem/{cli → console/cli}/errors.py +8 -3
- exonware/xwsystem/console/cli/event_logger.py +166 -0
- exonware/xwsystem/{cli → console/cli}/progress.py +25 -21
- exonware/xwsystem/{cli → console/cli}/prompts.py +3 -2
- exonware/xwsystem/{cli → console/cli}/tables.py +27 -24
- exonware/xwsystem/console/contracts.py +113 -0
- exonware/xwsystem/console/defs.py +154 -0
- exonware/xwsystem/console/errors.py +34 -0
- exonware/xwsystem/console/event_logger.py +385 -0
- exonware/xwsystem/console/writer.py +132 -0
- exonware/xwsystem/contracts.py +28 -0
- exonware/xwsystem/data_structures/__init__.py +23 -0
- exonware/xwsystem/data_structures/trie.py +34 -0
- exonware/xwsystem/data_structures/union_find.py +144 -0
- exonware/xwsystem/defs.py +17 -0
- exonware/xwsystem/errors.py +23 -0
- exonware/xwsystem/facade.py +62 -0
- exonware/xwsystem/http_client/__init__.py +22 -1
- exonware/xwsystem/http_client/advanced_client.py +8 -5
- exonware/xwsystem/http_client/base.py +3 -2
- exonware/xwsystem/http_client/client.py +7 -4
- exonware/xwsystem/http_client/contracts.py +42 -56
- exonware/xwsystem/http_client/defs.py +2 -1
- exonware/xwsystem/http_client/errors.py +2 -1
- exonware/xwsystem/http_client/facade.py +156 -0
- exonware/xwsystem/io/__init__.py +22 -3
- exonware/xwsystem/io/archive/__init__.py +8 -2
- exonware/xwsystem/io/archive/archive.py +1 -1
- exonware/xwsystem/io/archive/archive_files.py +4 -7
- exonware/xwsystem/io/archive/archivers.py +120 -10
- exonware/xwsystem/io/archive/base.py +4 -5
- exonware/xwsystem/io/archive/codec_integration.py +1 -2
- exonware/xwsystem/io/archive/compression.py +1 -2
- exonware/xwsystem/io/archive/facade.py +263 -0
- exonware/xwsystem/io/archive/formats/__init__.py +2 -3
- exonware/xwsystem/io/archive/formats/brotli_format.py +20 -7
- exonware/xwsystem/io/archive/formats/lz4_format.py +20 -7
- exonware/xwsystem/io/archive/formats/rar.py +11 -5
- exonware/xwsystem/io/archive/formats/sevenzip.py +12 -6
- exonware/xwsystem/io/archive/formats/squashfs_format.py +1 -2
- exonware/xwsystem/io/archive/formats/tar.py +52 -7
- exonware/xwsystem/io/archive/formats/wim_format.py +11 -5
- exonware/xwsystem/io/archive/formats/zip.py +1 -2
- exonware/xwsystem/io/archive/formats/zpaq_format.py +1 -2
- exonware/xwsystem/io/archive/formats/zstandard.py +20 -7
- exonware/xwsystem/io/base.py +119 -115
- exonware/xwsystem/io/codec/__init__.py +4 -2
- exonware/xwsystem/io/codec/base.py +19 -13
- exonware/xwsystem/io/codec/contracts.py +59 -2
- exonware/xwsystem/io/codec/registry.py +67 -21
- exonware/xwsystem/io/common/__init__.py +1 -1
- exonware/xwsystem/io/common/atomic.py +29 -16
- exonware/xwsystem/io/common/base.py +11 -10
- exonware/xwsystem/io/common/lock.py +6 -5
- exonware/xwsystem/io/common/path_manager.py +2 -1
- exonware/xwsystem/io/common/watcher.py +1 -2
- exonware/xwsystem/io/contracts.py +301 -433
- exonware/xwsystem/io/contracts_1.py +1180 -0
- exonware/xwsystem/io/data_operations.py +19 -20
- exonware/xwsystem/io/defs.py +4 -3
- exonware/xwsystem/io/errors.py +3 -2
- exonware/xwsystem/io/facade.py +87 -61
- exonware/xwsystem/io/file/__init__.py +1 -1
- exonware/xwsystem/io/file/base.py +8 -9
- exonware/xwsystem/io/file/conversion.py +2 -3
- exonware/xwsystem/io/file/file.py +61 -18
- exonware/xwsystem/io/file/paged_source.py +8 -8
- exonware/xwsystem/io/file/paging/__init__.py +1 -2
- exonware/xwsystem/io/file/paging/byte_paging.py +4 -5
- exonware/xwsystem/io/file/paging/line_paging.py +2 -3
- exonware/xwsystem/io/file/paging/record_paging.py +2 -3
- exonware/xwsystem/io/file/paging/registry.py +1 -2
- exonware/xwsystem/io/file/source.py +13 -17
- exonware/xwsystem/io/filesystem/__init__.py +1 -1
- exonware/xwsystem/io/filesystem/base.py +1 -2
- exonware/xwsystem/io/filesystem/local.py +3 -4
- exonware/xwsystem/io/folder/__init__.py +1 -1
- exonware/xwsystem/io/folder/base.py +1 -2
- exonware/xwsystem/io/folder/folder.py +16 -7
- exonware/xwsystem/io/indexing/__init__.py +14 -0
- exonware/xwsystem/io/indexing/facade.py +443 -0
- exonware/xwsystem/io/path_parser.py +98 -0
- exonware/xwsystem/io/serialization/__init__.py +21 -3
- exonware/xwsystem/io/serialization/auto_serializer.py +146 -20
- exonware/xwsystem/io/serialization/base.py +84 -34
- exonware/xwsystem/io/serialization/contracts.py +50 -73
- exonware/xwsystem/io/serialization/defs.py +2 -1
- exonware/xwsystem/io/serialization/errors.py +2 -1
- exonware/xwsystem/io/serialization/flyweight.py +154 -7
- exonware/xwsystem/io/serialization/format_detector.py +15 -14
- exonware/xwsystem/io/serialization/formats/__init__.py +8 -5
- exonware/xwsystem/io/serialization/formats/binary/bson.py +15 -6
- exonware/xwsystem/io/serialization/formats/binary/cbor.py +5 -5
- exonware/xwsystem/io/serialization/formats/binary/marshal.py +5 -5
- exonware/xwsystem/io/serialization/formats/binary/msgpack.py +5 -5
- exonware/xwsystem/io/serialization/formats/binary/pickle.py +5 -5
- exonware/xwsystem/io/serialization/formats/binary/plistlib.py +5 -5
- exonware/xwsystem/io/serialization/formats/database/dbm.py +7 -7
- exonware/xwsystem/io/serialization/formats/database/shelve.py +7 -7
- exonware/xwsystem/io/serialization/formats/database/sqlite3.py +7 -7
- exonware/xwsystem/io/serialization/formats/tabular/__init__.py +27 -0
- exonware/xwsystem/io/serialization/formats/tabular/base.py +89 -0
- exonware/xwsystem/io/serialization/formats/tabular/csv.py +319 -0
- exonware/xwsystem/io/serialization/formats/tabular/df.py +249 -0
- exonware/xwsystem/io/serialization/formats/tabular/excel.py +291 -0
- exonware/xwsystem/io/serialization/formats/tabular/googlesheets.py +374 -0
- exonware/xwsystem/io/serialization/formats/text/__init__.py +1 -1
- exonware/xwsystem/io/serialization/formats/text/append_only_log.py +5 -7
- exonware/xwsystem/io/serialization/formats/text/configparser.py +5 -5
- exonware/xwsystem/io/serialization/formats/text/csv.py +7 -5
- exonware/xwsystem/io/serialization/formats/text/formdata.py +5 -5
- exonware/xwsystem/io/serialization/formats/text/json.py +27 -18
- exonware/xwsystem/io/serialization/formats/text/json5.py +8 -4
- exonware/xwsystem/io/serialization/formats/text/jsonlines.py +18 -14
- exonware/xwsystem/io/serialization/formats/text/multipart.py +5 -5
- exonware/xwsystem/io/serialization/formats/text/toml.py +8 -6
- exonware/xwsystem/io/serialization/formats/text/xml.py +25 -20
- exonware/xwsystem/io/serialization/formats/text/yaml.py +8 -6
- exonware/xwsystem/io/serialization/parsers/__init__.py +3 -2
- exonware/xwsystem/io/serialization/parsers/base.py +6 -5
- exonware/xwsystem/io/serialization/parsers/hybrid_parser.py +7 -6
- exonware/xwsystem/io/serialization/parsers/msgspec_parser.py +10 -7
- exonware/xwsystem/io/serialization/parsers/orjson_direct_parser.py +7 -6
- exonware/xwsystem/io/serialization/parsers/orjson_parser.py +11 -8
- exonware/xwsystem/io/serialization/parsers/pysimdjson_parser.py +13 -9
- exonware/xwsystem/io/serialization/parsers/rapidjson_parser.py +10 -7
- exonware/xwsystem/io/serialization/parsers/registry.py +11 -10
- exonware/xwsystem/io/serialization/parsers/standard.py +7 -6
- exonware/xwsystem/io/serialization/parsers/ujson_parser.py +10 -7
- exonware/xwsystem/io/serialization/registry.py +4 -4
- exonware/xwsystem/io/serialization/serializer.py +168 -79
- exonware/xwsystem/io/serialization/universal_options.py +367 -0
- exonware/xwsystem/io/serialization/utils/__init__.py +1 -2
- exonware/xwsystem/io/serialization/utils/path_ops.py +5 -6
- exonware/xwsystem/io/source_reader.py +223 -0
- exonware/xwsystem/io/stream/__init__.py +1 -1
- exonware/xwsystem/io/stream/async_operations.py +61 -14
- exonware/xwsystem/io/stream/base.py +1 -2
- exonware/xwsystem/io/stream/codec_io.py +6 -7
- exonware/xwsystem/ipc/__init__.py +1 -0
- exonware/xwsystem/ipc/async_fabric.py +4 -4
- exonware/xwsystem/ipc/base.py +6 -5
- exonware/xwsystem/ipc/contracts.py +41 -66
- exonware/xwsystem/ipc/defs.py +2 -1
- exonware/xwsystem/ipc/errors.py +2 -1
- exonware/xwsystem/ipc/message_queue.py +5 -2
- exonware/xwsystem/ipc/pipes.py +70 -34
- exonware/xwsystem/ipc/process_manager.py +7 -5
- exonware/xwsystem/ipc/process_pool.py +6 -5
- exonware/xwsystem/ipc/shared_memory.py +64 -11
- exonware/xwsystem/monitoring/__init__.py +7 -0
- exonware/xwsystem/monitoring/base.py +11 -8
- exonware/xwsystem/monitoring/contracts.py +86 -144
- exonware/xwsystem/monitoring/defs.py +2 -1
- exonware/xwsystem/monitoring/error_recovery.py +16 -3
- exonware/xwsystem/monitoring/errors.py +2 -1
- exonware/xwsystem/monitoring/facade.py +183 -0
- exonware/xwsystem/monitoring/memory_monitor.py +1 -0
- exonware/xwsystem/monitoring/metrics.py +1 -0
- exonware/xwsystem/monitoring/performance_manager_generic.py +7 -7
- exonware/xwsystem/monitoring/performance_monitor.py +1 -0
- exonware/xwsystem/monitoring/performance_validator.py +1 -0
- exonware/xwsystem/monitoring/system_monitor.py +6 -5
- exonware/xwsystem/monitoring/tracing.py +18 -16
- exonware/xwsystem/monitoring/tracker.py +2 -1
- exonware/xwsystem/operations/__init__.py +5 -50
- exonware/xwsystem/operations/base.py +3 -44
- exonware/xwsystem/operations/contracts.py +25 -15
- exonware/xwsystem/operations/defs.py +1 -1
- exonware/xwsystem/operations/diff.py +5 -4
- exonware/xwsystem/operations/errors.py +1 -1
- exonware/xwsystem/operations/merge.py +6 -4
- exonware/xwsystem/operations/patch.py +5 -4
- exonware/xwsystem/patterns/__init__.py +1 -0
- exonware/xwsystem/patterns/base.py +2 -1
- exonware/xwsystem/patterns/context_manager.py +2 -1
- exonware/xwsystem/patterns/contracts.py +215 -256
- exonware/xwsystem/patterns/defs.py +2 -1
- exonware/xwsystem/patterns/dynamic_facade.py +1 -0
- exonware/xwsystem/patterns/errors.py +2 -4
- exonware/xwsystem/patterns/handler_factory.py +2 -3
- exonware/xwsystem/patterns/import_registry.py +1 -0
- exonware/xwsystem/patterns/object_pool.py +1 -0
- exonware/xwsystem/patterns/registry.py +4 -43
- exonware/xwsystem/plugins/__init__.py +2 -1
- exonware/xwsystem/plugins/base.py +6 -5
- exonware/xwsystem/plugins/contracts.py +94 -158
- exonware/xwsystem/plugins/defs.py +2 -1
- exonware/xwsystem/plugins/errors.py +2 -1
- exonware/xwsystem/py.typed +3 -0
- exonware/xwsystem/query/__init__.py +36 -0
- exonware/xwsystem/query/contracts.py +56 -0
- exonware/xwsystem/query/errors.py +22 -0
- exonware/xwsystem/query/registry.py +128 -0
- exonware/xwsystem/runtime/__init__.py +2 -1
- exonware/xwsystem/runtime/base.py +4 -3
- exonware/xwsystem/runtime/contracts.py +39 -60
- exonware/xwsystem/runtime/defs.py +2 -1
- exonware/xwsystem/runtime/env.py +11 -9
- exonware/xwsystem/runtime/errors.py +2 -1
- exonware/xwsystem/runtime/reflection.py +3 -2
- exonware/xwsystem/security/__init__.py +68 -11
- exonware/xwsystem/security/audit.py +167 -0
- exonware/xwsystem/security/base.py +121 -24
- exonware/xwsystem/security/contracts.py +91 -146
- exonware/xwsystem/security/crypto.py +17 -16
- exonware/xwsystem/security/defs.py +2 -1
- exonware/xwsystem/security/errors.py +2 -1
- exonware/xwsystem/security/facade.py +321 -0
- exonware/xwsystem/security/file_security.py +330 -0
- exonware/xwsystem/security/hazmat.py +11 -8
- exonware/xwsystem/security/monitor.py +372 -0
- exonware/xwsystem/security/path_validator.py +140 -18
- exonware/xwsystem/security/policy.py +357 -0
- exonware/xwsystem/security/resource_limits.py +1 -0
- exonware/xwsystem/security/validator.py +455 -0
- exonware/xwsystem/shared/__init__.py +14 -1
- exonware/xwsystem/shared/base.py +285 -2
- exonware/xwsystem/shared/contracts.py +415 -126
- exonware/xwsystem/shared/defs.py +2 -1
- exonware/xwsystem/shared/errors.py +2 -2
- exonware/xwsystem/shared/xwobject.py +316 -0
- exonware/xwsystem/structures/__init__.py +1 -0
- exonware/xwsystem/structures/base.py +3 -2
- exonware/xwsystem/structures/circular_detector.py +15 -14
- exonware/xwsystem/structures/contracts.py +53 -76
- exonware/xwsystem/structures/defs.py +2 -1
- exonware/xwsystem/structures/errors.py +2 -1
- exonware/xwsystem/structures/tree_walker.py +2 -1
- exonware/xwsystem/threading/__init__.py +21 -4
- exonware/xwsystem/threading/async_primitives.py +6 -5
- exonware/xwsystem/threading/base.py +3 -2
- exonware/xwsystem/threading/contracts.py +87 -143
- exonware/xwsystem/threading/defs.py +2 -1
- exonware/xwsystem/threading/errors.py +2 -1
- exonware/xwsystem/threading/facade.py +175 -0
- exonware/xwsystem/threading/locks.py +1 -0
- exonware/xwsystem/threading/safe_factory.py +1 -0
- exonware/xwsystem/utils/__init__.py +40 -0
- exonware/xwsystem/utils/base.py +22 -21
- exonware/xwsystem/utils/contracts.py +50 -73
- exonware/xwsystem/utils/dt/__init__.py +19 -3
- exonware/xwsystem/utils/dt/base.py +5 -4
- exonware/xwsystem/utils/dt/contracts.py +22 -29
- exonware/xwsystem/utils/dt/defs.py +2 -1
- exonware/xwsystem/utils/dt/errors.py +2 -5
- exonware/xwsystem/utils/dt/formatting.py +88 -2
- exonware/xwsystem/utils/dt/humanize.py +10 -9
- exonware/xwsystem/utils/dt/parsing.py +56 -5
- exonware/xwsystem/utils/dt/timezone_utils.py +2 -24
- exonware/xwsystem/utils/errors.py +2 -4
- exonware/xwsystem/utils/paths.py +1 -0
- exonware/xwsystem/utils/string.py +49 -0
- exonware/xwsystem/utils/test_runner.py +185 -0
- exonware/xwsystem/utils/utils_contracts.py +2 -1
- exonware/xwsystem/utils/web.py +110 -0
- exonware/xwsystem/validation/__init__.py +25 -1
- exonware/xwsystem/validation/base.py +6 -5
- exonware/xwsystem/validation/contracts.py +29 -41
- exonware/xwsystem/validation/data_validator.py +1 -0
- exonware/xwsystem/validation/declarative.py +11 -8
- exonware/xwsystem/validation/defs.py +2 -1
- exonware/xwsystem/validation/errors.py +2 -1
- exonware/xwsystem/validation/facade.py +198 -0
- exonware/xwsystem/validation/fluent_validator.py +22 -19
- exonware/xwsystem/validation/schema_discovery.py +210 -0
- exonware/xwsystem/validation/type_safety.py +2 -1
- exonware/xwsystem/version.py +2 -2
- {exonware_xwsystem-0.1.0.1.dist-info → exonware_xwsystem-0.1.0.4.dist-info}/METADATA +71 -4
- exonware_xwsystem-0.1.0.4.dist-info/RECORD +337 -0
- exonware/xwsystem/cli/__init__.py +0 -43
- exonware/xwsystem/cli/console.py +0 -113
- exonware/xwsystem/cli/defs.py +0 -134
- exonware/xwsystem/conf.py +0 -44
- exonware/xwsystem/security/auth.py +0 -484
- exonware_xwsystem-0.1.0.1.dist-info/RECORD +0 -284
- {exonware_xwsystem-0.1.0.1.dist-info → exonware_xwsystem-0.1.0.4.dist-info}/WHEEL +0 -0
- {exonware_xwsystem-0.1.0.1.dist-info → exonware_xwsystem-0.1.0.4.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
|
+
#exonware/xwsystem/src/exonware/xwsystem/config/contracts.py
|
|
2
3
|
"""
|
|
3
4
|
Company: eXonware.com
|
|
4
5
|
Author: Eng. Muhammad AlShehri
|
|
5
6
|
Email: connect@exonware.com
|
|
6
|
-
Version: 0.1.0.
|
|
7
|
+
Version: 0.1.0.4
|
|
7
8
|
Generation Date: September 04, 2025
|
|
8
9
|
|
|
9
10
|
Configuration protocol interfaces for XWSystem.
|
|
10
11
|
"""
|
|
11
12
|
|
|
12
|
-
from
|
|
13
|
-
from typing import Any, Optional, Union, Iterator, Callable, Protocol
|
|
14
|
-
from typing_extensions import runtime_checkable
|
|
13
|
+
from typing import Any, Optional, Iterator, Callable, Protocol, runtime_checkable
|
|
15
14
|
from pathlib import Path
|
|
16
15
|
import os
|
|
17
16
|
|
|
@@ -32,14 +31,14 @@ from .defs import (
|
|
|
32
31
|
# CONFIGURATION INTERFACES
|
|
33
32
|
# ============================================================================
|
|
34
33
|
|
|
35
|
-
|
|
34
|
+
@runtime_checkable
|
|
35
|
+
class IConfigurable(Protocol):
|
|
36
36
|
"""
|
|
37
37
|
Interface for configurable objects.
|
|
38
38
|
|
|
39
39
|
Enforces consistent configuration behavior across XWSystem.
|
|
40
40
|
"""
|
|
41
41
|
|
|
42
|
-
@abstractmethod
|
|
43
42
|
def configure(self, **options: Any) -> None:
|
|
44
43
|
"""
|
|
45
44
|
Configure object with options.
|
|
@@ -47,9 +46,8 @@ class IConfigurable(ABC):
|
|
|
47
46
|
Args:
|
|
48
47
|
**options: Configuration options
|
|
49
48
|
"""
|
|
50
|
-
|
|
49
|
+
...
|
|
51
50
|
|
|
52
|
-
@abstractmethod
|
|
53
51
|
def get_config(self) -> dict[str, Any]:
|
|
54
52
|
"""
|
|
55
53
|
Get current configuration.
|
|
@@ -57,16 +55,14 @@ class IConfigurable(ABC):
|
|
|
57
55
|
Returns:
|
|
58
56
|
Current configuration dictionary
|
|
59
57
|
"""
|
|
60
|
-
|
|
58
|
+
...
|
|
61
59
|
|
|
62
|
-
@abstractmethod
|
|
63
60
|
def reset_config(self) -> None:
|
|
64
61
|
"""
|
|
65
62
|
Reset configuration to defaults.
|
|
66
63
|
"""
|
|
67
|
-
|
|
64
|
+
...
|
|
68
65
|
|
|
69
|
-
@abstractmethod
|
|
70
66
|
def update_config(self, key: str, value: Any) -> None:
|
|
71
67
|
"""
|
|
72
68
|
Update single configuration value.
|
|
@@ -75,9 +71,8 @@ class IConfigurable(ABC):
|
|
|
75
71
|
key: Configuration key
|
|
76
72
|
value: Configuration value
|
|
77
73
|
"""
|
|
78
|
-
|
|
74
|
+
...
|
|
79
75
|
|
|
80
|
-
@abstractmethod
|
|
81
76
|
def has_config(self, key: str) -> bool:
|
|
82
77
|
"""
|
|
83
78
|
Check if configuration key exists.
|
|
@@ -88,9 +83,8 @@ class IConfigurable(ABC):
|
|
|
88
83
|
Returns:
|
|
89
84
|
True if key exists
|
|
90
85
|
"""
|
|
91
|
-
|
|
86
|
+
...
|
|
92
87
|
|
|
93
|
-
@abstractmethod
|
|
94
88
|
def remove_config(self, key: str) -> bool:
|
|
95
89
|
"""
|
|
96
90
|
Remove configuration key.
|
|
@@ -101,9 +95,8 @@ class IConfigurable(ABC):
|
|
|
101
95
|
Returns:
|
|
102
96
|
True if removed
|
|
103
97
|
"""
|
|
104
|
-
|
|
98
|
+
...
|
|
105
99
|
|
|
106
|
-
@abstractmethod
|
|
107
100
|
def merge_config(self, config: dict[str, Any], priority: ConfigPriority = ConfigPriority.NORMAL) -> None:
|
|
108
101
|
"""
|
|
109
102
|
Merge configuration with existing.
|
|
@@ -112,21 +105,21 @@ class IConfigurable(ABC):
|
|
|
112
105
|
config: Configuration to merge
|
|
113
106
|
priority: Merge priority
|
|
114
107
|
"""
|
|
115
|
-
|
|
108
|
+
...
|
|
116
109
|
|
|
117
110
|
|
|
118
111
|
# ============================================================================
|
|
119
112
|
# SETTINGS INTERFACES
|
|
120
113
|
# ============================================================================
|
|
121
114
|
|
|
122
|
-
|
|
115
|
+
@runtime_checkable
|
|
116
|
+
class ISettings(Protocol):
|
|
123
117
|
"""
|
|
124
118
|
Interface for settings management.
|
|
125
119
|
|
|
126
120
|
Enforces consistent settings behavior across XWSystem.
|
|
127
121
|
"""
|
|
128
122
|
|
|
129
|
-
@abstractmethod
|
|
130
123
|
def get_setting(self, key: str, default: Any = None) -> Any:
|
|
131
124
|
"""
|
|
132
125
|
Get setting value.
|
|
@@ -138,9 +131,8 @@ class ISettings(ABC):
|
|
|
138
131
|
Returns:
|
|
139
132
|
Setting value
|
|
140
133
|
"""
|
|
141
|
-
|
|
134
|
+
...
|
|
142
135
|
|
|
143
|
-
@abstractmethod
|
|
144
136
|
def set_setting(self, key: str, value: Any) -> None:
|
|
145
137
|
"""
|
|
146
138
|
Set setting value.
|
|
@@ -149,9 +141,8 @@ class ISettings(ABC):
|
|
|
149
141
|
key: Setting key
|
|
150
142
|
value: Setting value
|
|
151
143
|
"""
|
|
152
|
-
|
|
144
|
+
...
|
|
153
145
|
|
|
154
|
-
@abstractmethod
|
|
155
146
|
def has_setting(self, key: str) -> bool:
|
|
156
147
|
"""
|
|
157
148
|
Check if setting exists.
|
|
@@ -162,9 +153,8 @@ class ISettings(ABC):
|
|
|
162
153
|
Returns:
|
|
163
154
|
True if setting exists
|
|
164
155
|
"""
|
|
165
|
-
|
|
156
|
+
...
|
|
166
157
|
|
|
167
|
-
@abstractmethod
|
|
168
158
|
def remove_setting(self, key: str) -> bool:
|
|
169
159
|
"""
|
|
170
160
|
Remove setting.
|
|
@@ -175,9 +165,8 @@ class ISettings(ABC):
|
|
|
175
165
|
Returns:
|
|
176
166
|
True if removed
|
|
177
167
|
"""
|
|
178
|
-
|
|
168
|
+
...
|
|
179
169
|
|
|
180
|
-
@abstractmethod
|
|
181
170
|
def get_all_settings(self) -> dict[str, Any]:
|
|
182
171
|
"""
|
|
183
172
|
Get all settings.
|
|
@@ -185,27 +174,24 @@ class ISettings(ABC):
|
|
|
185
174
|
Returns:
|
|
186
175
|
Dictionary of all settings
|
|
187
176
|
"""
|
|
188
|
-
|
|
177
|
+
...
|
|
189
178
|
|
|
190
|
-
@abstractmethod
|
|
191
179
|
def clear_settings(self) -> None:
|
|
192
180
|
"""
|
|
193
181
|
Clear all settings.
|
|
194
182
|
"""
|
|
195
|
-
|
|
183
|
+
...
|
|
196
184
|
|
|
197
|
-
|
|
198
|
-
def load_settings(self, source: Union[str, Path, dict[str, Any]]) -> None:
|
|
185
|
+
def load_settings(self, source: str | Path | dict[str, Any]) -> None:
|
|
199
186
|
"""
|
|
200
187
|
Load settings from source.
|
|
201
188
|
|
|
202
189
|
Args:
|
|
203
190
|
source: Settings source (file path, dict, etc.)
|
|
204
191
|
"""
|
|
205
|
-
|
|
192
|
+
...
|
|
206
193
|
|
|
207
|
-
|
|
208
|
-
def save_settings(self, destination: Union[str, Path]) -> bool:
|
|
194
|
+
def save_settings(self, destination: str | Path) -> bool:
|
|
209
195
|
"""
|
|
210
196
|
Save settings to destination.
|
|
211
197
|
|
|
@@ -215,21 +201,21 @@ class ISettings(ABC):
|
|
|
215
201
|
Returns:
|
|
216
202
|
True if saved successfully
|
|
217
203
|
"""
|
|
218
|
-
|
|
204
|
+
...
|
|
219
205
|
|
|
220
206
|
|
|
221
207
|
# ============================================================================
|
|
222
208
|
# ENVIRONMENT INTERFACES
|
|
223
209
|
# ============================================================================
|
|
224
210
|
|
|
225
|
-
|
|
211
|
+
@runtime_checkable
|
|
212
|
+
class IEnvironment(Protocol):
|
|
226
213
|
"""
|
|
227
214
|
Interface for environment variable management.
|
|
228
215
|
|
|
229
216
|
Enforces consistent environment behavior across XWSystem.
|
|
230
217
|
"""
|
|
231
218
|
|
|
232
|
-
@abstractmethod
|
|
233
219
|
def get_env(self, key: str, default: Any = None) -> Any:
|
|
234
220
|
"""
|
|
235
221
|
Get environment variable.
|
|
@@ -241,9 +227,8 @@ class IEnvironment(ABC):
|
|
|
241
227
|
Returns:
|
|
242
228
|
Environment variable value
|
|
243
229
|
"""
|
|
244
|
-
|
|
230
|
+
...
|
|
245
231
|
|
|
246
|
-
@abstractmethod
|
|
247
232
|
def set_env(self, key: str, value: Any) -> None:
|
|
248
233
|
"""
|
|
249
234
|
Set environment variable.
|
|
@@ -252,9 +237,8 @@ class IEnvironment(ABC):
|
|
|
252
237
|
key: Environment variable key
|
|
253
238
|
value: Environment variable value
|
|
254
239
|
"""
|
|
255
|
-
|
|
240
|
+
...
|
|
256
241
|
|
|
257
|
-
@abstractmethod
|
|
258
242
|
def has_env(self, key: str) -> bool:
|
|
259
243
|
"""
|
|
260
244
|
Check if environment variable exists.
|
|
@@ -265,9 +249,8 @@ class IEnvironment(ABC):
|
|
|
265
249
|
Returns:
|
|
266
250
|
True if exists
|
|
267
251
|
"""
|
|
268
|
-
|
|
252
|
+
...
|
|
269
253
|
|
|
270
|
-
@abstractmethod
|
|
271
254
|
def remove_env(self, key: str) -> bool:
|
|
272
255
|
"""
|
|
273
256
|
Remove environment variable.
|
|
@@ -278,20 +261,18 @@ class IEnvironment(ABC):
|
|
|
278
261
|
Returns:
|
|
279
262
|
True if removed
|
|
280
263
|
"""
|
|
281
|
-
|
|
264
|
+
...
|
|
282
265
|
|
|
283
|
-
|
|
284
|
-
def load_env(self, file_path: Union[str, Path]) -> None:
|
|
266
|
+
def load_env(self, file_path: str | Path) -> None:
|
|
285
267
|
"""
|
|
286
268
|
Load environment variables from file.
|
|
287
269
|
|
|
288
270
|
Args:
|
|
289
271
|
file_path: Environment file path
|
|
290
272
|
"""
|
|
291
|
-
|
|
273
|
+
...
|
|
292
274
|
|
|
293
|
-
|
|
294
|
-
def save_env(self, file_path: Union[str, Path]) -> bool:
|
|
275
|
+
def save_env(self, file_path: str | Path) -> bool:
|
|
295
276
|
"""
|
|
296
277
|
Save environment variables to file.
|
|
297
278
|
|
|
@@ -301,9 +282,8 @@ class IEnvironment(ABC):
|
|
|
301
282
|
Returns:
|
|
302
283
|
True if saved successfully
|
|
303
284
|
"""
|
|
304
|
-
|
|
285
|
+
...
|
|
305
286
|
|
|
306
|
-
@abstractmethod
|
|
307
287
|
def get_all_env(self) -> dict[str, str]:
|
|
308
288
|
"""
|
|
309
289
|
Get all environment variables.
|
|
@@ -311,28 +291,27 @@ class IEnvironment(ABC):
|
|
|
311
291
|
Returns:
|
|
312
292
|
Dictionary of environment variables
|
|
313
293
|
"""
|
|
314
|
-
|
|
294
|
+
...
|
|
315
295
|
|
|
316
|
-
@abstractmethod
|
|
317
296
|
def clear_env(self) -> None:
|
|
318
297
|
"""
|
|
319
298
|
Clear all environment variables.
|
|
320
299
|
"""
|
|
321
|
-
|
|
300
|
+
...
|
|
322
301
|
|
|
323
302
|
|
|
324
303
|
# ============================================================================
|
|
325
304
|
# CONFIGURATION VALIDATION INTERFACES
|
|
326
305
|
# ============================================================================
|
|
327
306
|
|
|
328
|
-
|
|
307
|
+
@runtime_checkable
|
|
308
|
+
class IConfigValidator(Protocol):
|
|
329
309
|
"""
|
|
330
310
|
Interface for configuration validation.
|
|
331
311
|
|
|
332
312
|
Enforces consistent configuration validation across XWSystem.
|
|
333
313
|
"""
|
|
334
314
|
|
|
335
|
-
@abstractmethod
|
|
336
315
|
def validate_config(self, config: dict[str, Any]) -> bool:
|
|
337
316
|
"""
|
|
338
317
|
Validate configuration.
|
|
@@ -343,9 +322,8 @@ class IConfigValidator(ABC):
|
|
|
343
322
|
Returns:
|
|
344
323
|
True if valid
|
|
345
324
|
"""
|
|
346
|
-
|
|
325
|
+
...
|
|
347
326
|
|
|
348
|
-
@abstractmethod
|
|
349
327
|
def get_validation_errors(self, config: dict[str, Any]) -> list[str]:
|
|
350
328
|
"""
|
|
351
329
|
Get configuration validation errors.
|
|
@@ -356,9 +334,8 @@ class IConfigValidator(ABC):
|
|
|
356
334
|
Returns:
|
|
357
335
|
List of validation error messages
|
|
358
336
|
"""
|
|
359
|
-
|
|
337
|
+
...
|
|
360
338
|
|
|
361
|
-
@abstractmethod
|
|
362
339
|
def add_validation_rule(self, key: str, rule: Callable[[Any], bool], message: str = "") -> None:
|
|
363
340
|
"""
|
|
364
341
|
Add validation rule for configuration key.
|
|
@@ -368,9 +345,8 @@ class IConfigValidator(ABC):
|
|
|
368
345
|
rule: Validation function
|
|
369
346
|
message: Error message if validation fails
|
|
370
347
|
"""
|
|
371
|
-
|
|
348
|
+
...
|
|
372
349
|
|
|
373
|
-
@abstractmethod
|
|
374
350
|
def remove_validation_rule(self, key: str) -> bool:
|
|
375
351
|
"""
|
|
376
352
|
Remove validation rule for configuration key.
|
|
@@ -381,9 +357,8 @@ class IConfigValidator(ABC):
|
|
|
381
357
|
Returns:
|
|
382
358
|
True if removed
|
|
383
359
|
"""
|
|
384
|
-
|
|
360
|
+
...
|
|
385
361
|
|
|
386
|
-
@abstractmethod
|
|
387
362
|
def set_validation_level(self, level: ValidationLevel) -> None:
|
|
388
363
|
"""
|
|
389
364
|
Set validation level.
|
|
@@ -391,9 +366,8 @@ class IConfigValidator(ABC):
|
|
|
391
366
|
Args:
|
|
392
367
|
level: Validation level
|
|
393
368
|
"""
|
|
394
|
-
|
|
369
|
+
...
|
|
395
370
|
|
|
396
|
-
@abstractmethod
|
|
397
371
|
def get_validation_level(self) -> ValidationLevel:
|
|
398
372
|
"""
|
|
399
373
|
Get current validation level.
|
|
@@ -401,21 +375,21 @@ class IConfigValidator(ABC):
|
|
|
401
375
|
Returns:
|
|
402
376
|
Current validation level
|
|
403
377
|
"""
|
|
404
|
-
|
|
378
|
+
...
|
|
405
379
|
|
|
406
380
|
|
|
407
381
|
# ============================================================================
|
|
408
382
|
# CONFIGURATION SOURCE INTERFACES
|
|
409
383
|
# ============================================================================
|
|
410
384
|
|
|
411
|
-
|
|
385
|
+
@runtime_checkable
|
|
386
|
+
class IConfigSource(Protocol):
|
|
412
387
|
"""
|
|
413
388
|
Interface for configuration sources.
|
|
414
389
|
|
|
415
390
|
Enforces consistent configuration source behavior across XWSystem.
|
|
416
391
|
"""
|
|
417
392
|
|
|
418
|
-
@abstractmethod
|
|
419
393
|
def load_config(self) -> dict[str, Any]:
|
|
420
394
|
"""
|
|
421
395
|
Load configuration from source.
|
|
@@ -423,9 +397,8 @@ class IConfigSource(ABC):
|
|
|
423
397
|
Returns:
|
|
424
398
|
Configuration dictionary
|
|
425
399
|
"""
|
|
426
|
-
|
|
400
|
+
...
|
|
427
401
|
|
|
428
|
-
@abstractmethod
|
|
429
402
|
def save_config(self, config: dict[str, Any]) -> bool:
|
|
430
403
|
"""
|
|
431
404
|
Save configuration to source.
|
|
@@ -436,9 +409,8 @@ class IConfigSource(ABC):
|
|
|
436
409
|
Returns:
|
|
437
410
|
True if saved successfully
|
|
438
411
|
"""
|
|
439
|
-
|
|
412
|
+
...
|
|
440
413
|
|
|
441
|
-
@abstractmethod
|
|
442
414
|
def get_source_type(self) -> ConfigSource:
|
|
443
415
|
"""
|
|
444
416
|
Get configuration source type.
|
|
@@ -446,9 +418,8 @@ class IConfigSource(ABC):
|
|
|
446
418
|
Returns:
|
|
447
419
|
Source type
|
|
448
420
|
"""
|
|
449
|
-
|
|
421
|
+
...
|
|
450
422
|
|
|
451
|
-
@abstractmethod
|
|
452
423
|
def get_source_info(self) -> dict[str, Any]:
|
|
453
424
|
"""
|
|
454
425
|
Get source information.
|
|
@@ -456,9 +427,8 @@ class IConfigSource(ABC):
|
|
|
456
427
|
Returns:
|
|
457
428
|
Source information dictionary
|
|
458
429
|
"""
|
|
459
|
-
|
|
430
|
+
...
|
|
460
431
|
|
|
461
|
-
@abstractmethod
|
|
462
432
|
def is_available(self) -> bool:
|
|
463
433
|
"""
|
|
464
434
|
Check if source is available.
|
|
@@ -466,9 +436,8 @@ class IConfigSource(ABC):
|
|
|
466
436
|
Returns:
|
|
467
437
|
True if available
|
|
468
438
|
"""
|
|
469
|
-
|
|
439
|
+
...
|
|
470
440
|
|
|
471
|
-
@abstractmethod
|
|
472
441
|
def get_priority(self) -> ConfigPriority:
|
|
473
442
|
"""
|
|
474
443
|
Get source priority.
|
|
@@ -476,21 +445,21 @@ class IConfigSource(ABC):
|
|
|
476
445
|
Returns:
|
|
477
446
|
Source priority
|
|
478
447
|
"""
|
|
479
|
-
|
|
448
|
+
...
|
|
480
449
|
|
|
481
450
|
|
|
482
451
|
# ============================================================================
|
|
483
452
|
# CONFIGURATION MANAGER INTERFACES
|
|
484
453
|
# ============================================================================
|
|
485
454
|
|
|
486
|
-
|
|
455
|
+
@runtime_checkable
|
|
456
|
+
class IConfigManager(Protocol):
|
|
487
457
|
"""
|
|
488
458
|
Interface for configuration management.
|
|
489
459
|
|
|
490
460
|
Enforces consistent configuration management across XWSystem.
|
|
491
461
|
"""
|
|
492
462
|
|
|
493
|
-
@abstractmethod
|
|
494
463
|
def add_source(self, source: IConfigSource) -> None:
|
|
495
464
|
"""
|
|
496
465
|
Add configuration source.
|
|
@@ -498,9 +467,8 @@ class IConfigManager(ABC):
|
|
|
498
467
|
Args:
|
|
499
468
|
source: Configuration source to add
|
|
500
469
|
"""
|
|
501
|
-
|
|
470
|
+
...
|
|
502
471
|
|
|
503
|
-
@abstractmethod
|
|
504
472
|
def remove_source(self, source_type: ConfigSource) -> bool:
|
|
505
473
|
"""
|
|
506
474
|
Remove configuration source.
|
|
@@ -511,9 +479,8 @@ class IConfigManager(ABC):
|
|
|
511
479
|
Returns:
|
|
512
480
|
True if removed
|
|
513
481
|
"""
|
|
514
|
-
|
|
482
|
+
...
|
|
515
483
|
|
|
516
|
-
@abstractmethod
|
|
517
484
|
def load_all_configs(self) -> dict[str, Any]:
|
|
518
485
|
"""
|
|
519
486
|
Load configuration from all sources.
|
|
@@ -521,9 +488,8 @@ class IConfigManager(ABC):
|
|
|
521
488
|
Returns:
|
|
522
489
|
Merged configuration dictionary
|
|
523
490
|
"""
|
|
524
|
-
|
|
491
|
+
...
|
|
525
492
|
|
|
526
|
-
@abstractmethod
|
|
527
493
|
def save_all_configs(self, config: dict[str, Any]) -> bool:
|
|
528
494
|
"""
|
|
529
495
|
Save configuration to all sources.
|
|
@@ -534,9 +500,8 @@ class IConfigManager(ABC):
|
|
|
534
500
|
Returns:
|
|
535
501
|
True if saved to all sources
|
|
536
502
|
"""
|
|
537
|
-
|
|
503
|
+
...
|
|
538
504
|
|
|
539
|
-
@abstractmethod
|
|
540
505
|
def get_config_value(self, key: str, default: Any = None) -> Any:
|
|
541
506
|
"""
|
|
542
507
|
Get configuration value from all sources.
|
|
@@ -548,9 +513,8 @@ class IConfigManager(ABC):
|
|
|
548
513
|
Returns:
|
|
549
514
|
Configuration value
|
|
550
515
|
"""
|
|
551
|
-
|
|
516
|
+
...
|
|
552
517
|
|
|
553
|
-
@abstractmethod
|
|
554
518
|
def set_config_value(self, key: str, value: Any) -> None:
|
|
555
519
|
"""
|
|
556
520
|
Set configuration value in all sources.
|
|
@@ -559,16 +523,14 @@ class IConfigManager(ABC):
|
|
|
559
523
|
key: Configuration key
|
|
560
524
|
value: Configuration value
|
|
561
525
|
"""
|
|
562
|
-
|
|
526
|
+
...
|
|
563
527
|
|
|
564
|
-
@abstractmethod
|
|
565
528
|
def reload_config(self) -> None:
|
|
566
529
|
"""
|
|
567
530
|
Reload configuration from all sources.
|
|
568
531
|
"""
|
|
569
|
-
|
|
532
|
+
...
|
|
570
533
|
|
|
571
|
-
@abstractmethod
|
|
572
534
|
def get_sources(self) -> list[IConfigSource]:
|
|
573
535
|
"""
|
|
574
536
|
Get all configuration sources.
|
|
@@ -576,35 +538,33 @@ class IConfigManager(ABC):
|
|
|
576
538
|
Returns:
|
|
577
539
|
List of configuration sources
|
|
578
540
|
"""
|
|
579
|
-
|
|
541
|
+
...
|
|
580
542
|
|
|
581
543
|
|
|
582
544
|
# ============================================================================
|
|
583
545
|
# CONFIGURATION WATCHER INTERFACES
|
|
584
546
|
# ============================================================================
|
|
585
547
|
|
|
586
|
-
|
|
548
|
+
@runtime_checkable
|
|
549
|
+
class IConfigWatcher(Protocol):
|
|
587
550
|
"""
|
|
588
551
|
Interface for configuration change watching.
|
|
589
552
|
|
|
590
553
|
Enforces consistent configuration watching across XWSystem.
|
|
591
554
|
"""
|
|
592
555
|
|
|
593
|
-
@abstractmethod
|
|
594
556
|
def start_watching(self) -> None:
|
|
595
557
|
"""
|
|
596
558
|
Start watching for configuration changes.
|
|
597
559
|
"""
|
|
598
|
-
|
|
560
|
+
...
|
|
599
561
|
|
|
600
|
-
@abstractmethod
|
|
601
562
|
def stop_watching(self) -> None:
|
|
602
563
|
"""
|
|
603
564
|
Stop watching for configuration changes.
|
|
604
565
|
"""
|
|
605
|
-
|
|
566
|
+
...
|
|
606
567
|
|
|
607
|
-
@abstractmethod
|
|
608
568
|
def is_watching(self) -> bool:
|
|
609
569
|
"""
|
|
610
570
|
Check if currently watching.
|
|
@@ -612,9 +572,8 @@ class IConfigWatcher(ABC):
|
|
|
612
572
|
Returns:
|
|
613
573
|
True if watching
|
|
614
574
|
"""
|
|
615
|
-
|
|
575
|
+
...
|
|
616
576
|
|
|
617
|
-
@abstractmethod
|
|
618
577
|
def add_change_callback(self, callback: Callable[[str, Any, Any], None]) -> None:
|
|
619
578
|
"""
|
|
620
579
|
Add callback for configuration changes.
|
|
@@ -622,9 +581,8 @@ class IConfigWatcher(ABC):
|
|
|
622
581
|
Args:
|
|
623
582
|
callback: Function to call on changes (key, old_value, new_value)
|
|
624
583
|
"""
|
|
625
|
-
|
|
584
|
+
...
|
|
626
585
|
|
|
627
|
-
@abstractmethod
|
|
628
586
|
def remove_change_callback(self, callback: Callable[[str, Any, Any], None]) -> bool:
|
|
629
587
|
"""
|
|
630
588
|
Remove change callback.
|
|
@@ -635,9 +593,8 @@ class IConfigWatcher(ABC):
|
|
|
635
593
|
Returns:
|
|
636
594
|
True if removed
|
|
637
595
|
"""
|
|
638
|
-
|
|
596
|
+
...
|
|
639
597
|
|
|
640
|
-
@abstractmethod
|
|
641
598
|
def get_watched_keys(self) -> list[str]:
|
|
642
599
|
"""
|
|
643
600
|
Get list of watched configuration keys.
|
|
@@ -645,9 +602,8 @@ class IConfigWatcher(ABC):
|
|
|
645
602
|
Returns:
|
|
646
603
|
List of watched keys
|
|
647
604
|
"""
|
|
648
|
-
|
|
605
|
+
...
|
|
649
606
|
|
|
650
|
-
@abstractmethod
|
|
651
607
|
def watch_key(self, key: str) -> None:
|
|
652
608
|
"""
|
|
653
609
|
Start watching specific configuration key.
|
|
@@ -655,9 +611,8 @@ class IConfigWatcher(ABC):
|
|
|
655
611
|
Args:
|
|
656
612
|
key: Configuration key to watch
|
|
657
613
|
"""
|
|
658
|
-
|
|
614
|
+
...
|
|
659
615
|
|
|
660
|
-
@abstractmethod
|
|
661
616
|
def unwatch_key(self, key: str) -> None:
|
|
662
617
|
"""
|
|
663
618
|
Stop watching specific configuration key.
|
|
@@ -665,21 +620,21 @@ class IConfigWatcher(ABC):
|
|
|
665
620
|
Args:
|
|
666
621
|
key: Configuration key to stop watching
|
|
667
622
|
"""
|
|
668
|
-
|
|
623
|
+
...
|
|
669
624
|
|
|
670
625
|
|
|
671
626
|
# ============================================================================
|
|
672
627
|
# CONFIGURATION TEMPLATE INTERFACES
|
|
673
628
|
# ============================================================================
|
|
674
629
|
|
|
675
|
-
|
|
630
|
+
@runtime_checkable
|
|
631
|
+
class IConfigTemplate(Protocol):
|
|
676
632
|
"""
|
|
677
633
|
Interface for configuration templates.
|
|
678
634
|
|
|
679
635
|
Enforces consistent configuration templating across XWSystem.
|
|
680
636
|
"""
|
|
681
637
|
|
|
682
|
-
@abstractmethod
|
|
683
638
|
def create_template(self, config: dict[str, Any]) -> str:
|
|
684
639
|
"""
|
|
685
640
|
Create configuration template.
|
|
@@ -690,9 +645,8 @@ class IConfigTemplate(ABC):
|
|
|
690
645
|
Returns:
|
|
691
646
|
Template string
|
|
692
647
|
"""
|
|
693
|
-
|
|
648
|
+
...
|
|
694
649
|
|
|
695
|
-
@abstractmethod
|
|
696
650
|
def apply_template(self, template: str, values: dict[str, Any]) -> dict[str, Any]:
|
|
697
651
|
"""
|
|
698
652
|
Apply template with values.
|
|
@@ -704,9 +658,8 @@ class IConfigTemplate(ABC):
|
|
|
704
658
|
Returns:
|
|
705
659
|
Configuration dictionary
|
|
706
660
|
"""
|
|
707
|
-
|
|
661
|
+
...
|
|
708
662
|
|
|
709
|
-
@abstractmethod
|
|
710
663
|
def validate_template(self, template: str) -> bool:
|
|
711
664
|
"""
|
|
712
665
|
Validate template syntax.
|
|
@@ -717,9 +670,8 @@ class IConfigTemplate(ABC):
|
|
|
717
670
|
Returns:
|
|
718
671
|
True if valid
|
|
719
672
|
"""
|
|
720
|
-
|
|
673
|
+
...
|
|
721
674
|
|
|
722
|
-
@abstractmethod
|
|
723
675
|
def get_template_variables(self, template: str) -> list[str]:
|
|
724
676
|
"""
|
|
725
677
|
Get template variables.
|
|
@@ -730,10 +682,9 @@ class IConfigTemplate(ABC):
|
|
|
730
682
|
Returns:
|
|
731
683
|
List of variable names
|
|
732
684
|
"""
|
|
733
|
-
|
|
685
|
+
...
|
|
734
686
|
|
|
735
|
-
|
|
736
|
-
def save_template(self, template: str, path: Union[str, Path]) -> bool:
|
|
687
|
+
def save_template(self, template: str, path: str | Path) -> bool:
|
|
737
688
|
"""
|
|
738
689
|
Save template to file.
|
|
739
690
|
|
|
@@ -744,10 +695,9 @@ class IConfigTemplate(ABC):
|
|
|
744
695
|
Returns:
|
|
745
696
|
True if saved successfully
|
|
746
697
|
"""
|
|
747
|
-
|
|
698
|
+
...
|
|
748
699
|
|
|
749
|
-
|
|
750
|
-
def load_template(self, path: Union[str, Path]) -> str:
|
|
700
|
+
def load_template(self, path: str | Path) -> str:
|
|
751
701
|
"""
|
|
752
702
|
Load template from file.
|
|
753
703
|
|
|
@@ -757,21 +707,21 @@ class IConfigTemplate(ABC):
|
|
|
757
707
|
Returns:
|
|
758
708
|
Template string
|
|
759
709
|
"""
|
|
760
|
-
|
|
710
|
+
...
|
|
761
711
|
|
|
762
712
|
|
|
763
713
|
# ============================================================================
|
|
764
714
|
# CONFIGURATION SECRET INTERFACES
|
|
765
715
|
# ============================================================================
|
|
766
716
|
|
|
767
|
-
|
|
717
|
+
@runtime_checkable
|
|
718
|
+
class IConfigSecrets(Protocol):
|
|
768
719
|
"""
|
|
769
720
|
Interface for configuration secrets management.
|
|
770
721
|
|
|
771
722
|
Enforces consistent secrets handling across XWSystem.
|
|
772
723
|
"""
|
|
773
724
|
|
|
774
|
-
@abstractmethod
|
|
775
725
|
def encrypt_secret(self, value: str) -> str:
|
|
776
726
|
"""
|
|
777
727
|
Encrypt secret value.
|
|
@@ -782,9 +732,8 @@ class IConfigSecrets(ABC):
|
|
|
782
732
|
Returns:
|
|
783
733
|
Encrypted secret
|
|
784
734
|
"""
|
|
785
|
-
|
|
735
|
+
...
|
|
786
736
|
|
|
787
|
-
@abstractmethod
|
|
788
737
|
def decrypt_secret(self, encrypted_value: str) -> str:
|
|
789
738
|
"""
|
|
790
739
|
Decrypt secret value.
|
|
@@ -795,9 +744,8 @@ class IConfigSecrets(ABC):
|
|
|
795
744
|
Returns:
|
|
796
745
|
Decrypted secret
|
|
797
746
|
"""
|
|
798
|
-
|
|
747
|
+
...
|
|
799
748
|
|
|
800
|
-
@abstractmethod
|
|
801
749
|
def is_secret(self, key: str) -> bool:
|
|
802
750
|
"""
|
|
803
751
|
Check if configuration key is secret.
|
|
@@ -808,9 +756,8 @@ class IConfigSecrets(ABC):
|
|
|
808
756
|
Returns:
|
|
809
757
|
True if secret
|
|
810
758
|
"""
|
|
811
|
-
|
|
759
|
+
...
|
|
812
760
|
|
|
813
|
-
@abstractmethod
|
|
814
761
|
def mark_as_secret(self, key: str) -> None:
|
|
815
762
|
"""
|
|
816
763
|
Mark configuration key as secret.
|
|
@@ -818,9 +765,8 @@ class IConfigSecrets(ABC):
|
|
|
818
765
|
Args:
|
|
819
766
|
key: Configuration key to mark
|
|
820
767
|
"""
|
|
821
|
-
|
|
768
|
+
...
|
|
822
769
|
|
|
823
|
-
@abstractmethod
|
|
824
770
|
def unmark_as_secret(self, key: str) -> None:
|
|
825
771
|
"""
|
|
826
772
|
Unmark configuration key as secret.
|
|
@@ -828,9 +774,8 @@ class IConfigSecrets(ABC):
|
|
|
828
774
|
Args:
|
|
829
775
|
key: Configuration key to unmark
|
|
830
776
|
"""
|
|
831
|
-
|
|
777
|
+
...
|
|
832
778
|
|
|
833
|
-
@abstractmethod
|
|
834
779
|
def get_secret_keys(self) -> list[str]:
|
|
835
780
|
"""
|
|
836
781
|
Get list of secret configuration keys.
|
|
@@ -838,9 +783,8 @@ class IConfigSecrets(ABC):
|
|
|
838
783
|
Returns:
|
|
839
784
|
List of secret keys
|
|
840
785
|
"""
|
|
841
|
-
|
|
786
|
+
...
|
|
842
787
|
|
|
843
|
-
@abstractmethod
|
|
844
788
|
def sanitize_config(self, config: dict[str, Any]) -> dict[str, Any]:
|
|
845
789
|
"""
|
|
846
790
|
Sanitize configuration by hiding secrets.
|
|
@@ -851,7 +795,7 @@ class IConfigSecrets(ABC):
|
|
|
851
795
|
Returns:
|
|
852
796
|
Sanitized configuration
|
|
853
797
|
"""
|
|
854
|
-
|
|
798
|
+
...
|
|
855
799
|
|
|
856
800
|
|
|
857
801
|
# ============================================================================
|
|
@@ -859,8 +803,8 @@ class IConfigSecrets(ABC):
|
|
|
859
803
|
# ============================================================================
|
|
860
804
|
|
|
861
805
|
@runtime_checkable
|
|
862
|
-
class
|
|
863
|
-
"""Protocol for objects that support configuration."""
|
|
806
|
+
class IConfigurableSimple(Protocol):
|
|
807
|
+
"""Protocol for objects that support configuration (simpler interface than IConfigurable)."""
|
|
864
808
|
|
|
865
809
|
def configure(self, **config: Any) -> None:
|
|
866
810
|
"""Configure object with parameters."""
|
|
@@ -871,7 +815,3 @@ class Configurable(Protocol):
|
|
|
871
815
|
...
|
|
872
816
|
|
|
873
817
|
|
|
874
|
-
# Aliases for backward compatibility
|
|
875
|
-
IConfig = IConfigurable
|
|
876
|
-
IPerformanceConfig = IConfigurable
|
|
877
|
-
ILoggingConfig = IConfigurable
|