orionis 0.393.0__py3-none-any.whl → 0.395.0__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.
- orionis/foundation/application.py +48 -1
- orionis/foundation/contracts/application.py +24 -0
- orionis/metadata/framework.py +1 -1
- orionis/test/kernel.py +11 -2
- {orionis-0.393.0.dist-info → orionis-0.395.0.dist-info}/METADATA +1 -1
- {orionis-0.393.0.dist-info → orionis-0.395.0.dist-info}/RECORD +10 -10
- {orionis-0.393.0.dist-info → orionis-0.395.0.dist-info}/WHEEL +0 -0
- {orionis-0.393.0.dist-info → orionis-0.395.0.dist-info}/licenses/LICENCE +0 -0
- {orionis-0.393.0.dist-info → orionis-0.395.0.dist-info}/top_level.txt +0 -0
- {orionis-0.393.0.dist-info → orionis-0.395.0.dist-info}/zip-safe +0 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
from pathlib import Path
|
|
1
2
|
from typing import Any, List, Type
|
|
2
3
|
from orionis.container.container import Container
|
|
3
4
|
from orionis.container.contracts.service_provider import IServiceProvider
|
|
@@ -951,6 +952,10 @@ class Application(Container, IApplication):
|
|
|
951
952
|
The configuration value or the entire configuration if key is None
|
|
952
953
|
"""
|
|
953
954
|
|
|
955
|
+
# Ensure the application is booted before accessing configuration
|
|
956
|
+
if not self.__booted:
|
|
957
|
+
raise RuntimeError("Application must be booted before accessing configuration. Call create() first.")
|
|
958
|
+
|
|
954
959
|
# If key is None, raise an error to prevent ambiguity
|
|
955
960
|
if key is None:
|
|
956
961
|
raise ValueError("Key cannot be None. Use config() without arguments to get the entire configuration.")
|
|
@@ -973,4 +978,46 @@ class Application(Container, IApplication):
|
|
|
973
978
|
return default
|
|
974
979
|
|
|
975
980
|
# Return the final configuration value
|
|
976
|
-
return config_value
|
|
981
|
+
return config_value
|
|
982
|
+
|
|
983
|
+
def path(
|
|
984
|
+
self,
|
|
985
|
+
key: str,
|
|
986
|
+
default: str = None
|
|
987
|
+
) -> Path:
|
|
988
|
+
"""
|
|
989
|
+
Retrieve a path configuration value by key.
|
|
990
|
+
|
|
991
|
+
Parameters
|
|
992
|
+
----------
|
|
993
|
+
key : str
|
|
994
|
+
The path key to retrieve using dot notation (e.g. "paths.storage")
|
|
995
|
+
default : str, optional
|
|
996
|
+
Default value to return if key is not found
|
|
997
|
+
|
|
998
|
+
Returns
|
|
999
|
+
-------
|
|
1000
|
+
Path
|
|
1001
|
+
The path value as a Path object or None if not found
|
|
1002
|
+
"""
|
|
1003
|
+
|
|
1004
|
+
# Ensure the application is booted before accessing configuration
|
|
1005
|
+
if not self.__booted:
|
|
1006
|
+
raise RuntimeError("Application must be booted before accessing configuration. Call create() first.")
|
|
1007
|
+
|
|
1008
|
+
# If key is None, raise an error to prevent ambiguity
|
|
1009
|
+
if key is None:
|
|
1010
|
+
raise ValueError("Key cannot be None. Use path() without arguments to get the entire configuration.")
|
|
1011
|
+
|
|
1012
|
+
# Get the configuration value for the given key
|
|
1013
|
+
original_paths = self.config('paths')
|
|
1014
|
+
|
|
1015
|
+
# If original_paths is not a dictionary, return the default value as Path
|
|
1016
|
+
if not isinstance(original_paths, dict):
|
|
1017
|
+
return Path(default) if default is not None else None
|
|
1018
|
+
|
|
1019
|
+
# Get the path value from the dictionary
|
|
1020
|
+
path_value = original_paths.get(key, default)
|
|
1021
|
+
|
|
1022
|
+
# Return as Path object if value exists, otherwise return None
|
|
1023
|
+
return Path(path_value) if path_value is not None else None
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
from abc import abstractmethod
|
|
2
|
+
from pathlib import Path
|
|
2
3
|
from typing import Any, List, Type
|
|
3
4
|
from orionis.container.contracts.service_provider import IServiceProvider
|
|
4
5
|
from orionis.container.contracts.container import IContainer
|
|
@@ -540,4 +541,27 @@ class IApplication(IContainer):
|
|
|
540
541
|
IApplication
|
|
541
542
|
The application instance for method chaining
|
|
542
543
|
"""
|
|
544
|
+
pass
|
|
545
|
+
|
|
546
|
+
@abstractmethod
|
|
547
|
+
def path(
|
|
548
|
+
self,
|
|
549
|
+
key: str,
|
|
550
|
+
default: str = None
|
|
551
|
+
) -> Path:
|
|
552
|
+
"""
|
|
553
|
+
Retrieve a path configuration value by key.
|
|
554
|
+
|
|
555
|
+
Parameters
|
|
556
|
+
----------
|
|
557
|
+
key : str
|
|
558
|
+
The path key to retrieve using dot notation (e.g. "paths.storage")
|
|
559
|
+
default : str, optional
|
|
560
|
+
Default value to return if key is not found
|
|
561
|
+
|
|
562
|
+
Returns
|
|
563
|
+
-------
|
|
564
|
+
Path
|
|
565
|
+
The path value as a Path object, or None if not found and no default is provided
|
|
566
|
+
"""
|
|
543
567
|
pass
|
orionis/metadata/framework.py
CHANGED
orionis/test/kernel.py
CHANGED
|
@@ -92,10 +92,19 @@ class TestKernel(ITestKernel):
|
|
|
92
92
|
"""
|
|
93
93
|
# Check if config is None and kwargs are provided
|
|
94
94
|
if config is None:
|
|
95
|
+
|
|
96
|
+
# Try to create a Configuration instance with provided kwargs or default values
|
|
95
97
|
try:
|
|
96
|
-
#
|
|
97
|
-
|
|
98
|
+
# If no kwargs are provided, create a default Configuration instance
|
|
99
|
+
if not kwargs:
|
|
100
|
+
config = Configuration(**self.__app.config('testing'))
|
|
101
|
+
|
|
102
|
+
# If kwargs are provided, create a Configuration instance with them
|
|
103
|
+
else:
|
|
104
|
+
config = Configuration(**kwargs)
|
|
105
|
+
|
|
98
106
|
except TypeError:
|
|
107
|
+
|
|
99
108
|
# If a TypeError occurs, it indicates that the provided arguments do not match the Configuration class
|
|
100
109
|
required_fields = []
|
|
101
110
|
for field in Configuration().getFields():
|
|
@@ -148,7 +148,7 @@ orionis/container/validators/is_subclass.py,sha256=4sBaGLoRs8nUhuWjlP0VJqyTwVHYq
|
|
|
148
148
|
orionis/container/validators/is_valid_alias.py,sha256=4uAYcq8xov7jZbXnpKpjNkxcZtlTNnL5RRctVPMwJes,1424
|
|
149
149
|
orionis/container/validators/lifetime.py,sha256=IQ43fDNrxYHMlZH2zlYDJnlkLO_eS4U7Fs3UJgQBidI,1844
|
|
150
150
|
orionis/foundation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
151
|
-
orionis/foundation/application.py,sha256=
|
|
151
|
+
orionis/foundation/application.py,sha256=lYj2m2B9vbvSjBZtm44CJaM_xtIPEPiV2U_5HL4eonU,32208
|
|
152
152
|
orionis/foundation/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
153
153
|
orionis/foundation/config/startup.py,sha256=zutF-34DkW68bpiTxH9xrmIe1iJdXCF9Y6wueXS6qys,8265
|
|
154
154
|
orionis/foundation/config/app/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -237,7 +237,7 @@ orionis/foundation/config/testing/entities/testing.py,sha256=keU7dSuRv0rgaG-T4Vo
|
|
|
237
237
|
orionis/foundation/config/testing/enums/__init__.py,sha256=tCHed6wBzqHx8o3kWBGm8tZYkYOKdSAx8TvgC-Eauv0,75
|
|
238
238
|
orionis/foundation/config/testing/enums/test_mode.py,sha256=IbFpauu7J-iSAfmC8jDbmTEYl8eZr-AexL-lyOh8_74,337
|
|
239
239
|
orionis/foundation/contracts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
240
|
-
orionis/foundation/contracts/application.py,sha256=
|
|
240
|
+
orionis/foundation/contracts/application.py,sha256=T8BexSV2k8QDcaAO4q_4mJrXaAdY-QIKq8XKGPYMPoI,16585
|
|
241
241
|
orionis/foundation/contracts/config.py,sha256=Rpz6U6t8OXHO9JJKSTnCimytXE-tfCB-1ithP2nG8MQ,628
|
|
242
242
|
orionis/foundation/exceptions/__init__.py,sha256=XtG3MJ_MFNY_dU5mmTyz_N_4QG1jYrcv5RegBso7wuY,163
|
|
243
243
|
orionis/foundation/exceptions/integrity.py,sha256=mc4pL1UMoYRHEmphnpW2oGk5URhu7DJRREyzHaV-cs8,472
|
|
@@ -249,7 +249,7 @@ orionis/foundation/providers/path_resolver_provider.py,sha256=rXvaVc5sSqmDgRzWJo
|
|
|
249
249
|
orionis/foundation/providers/progress_bar_provider.py,sha256=75Jr4iEgUOUGl8Di1DioeP5_HRQlR-1lVzPmS96sWjA,737
|
|
250
250
|
orionis/foundation/providers/workers_provider.py,sha256=WWlji3C69_-Y0c42aZDbR_bmcE_qZEh2SaA_cNkCivI,702
|
|
251
251
|
orionis/metadata/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
252
|
-
orionis/metadata/framework.py,sha256=
|
|
252
|
+
orionis/metadata/framework.py,sha256=PSFs-jy1k9oXgkCjQNgV6nU3KLHJtfrgFiFYMKX6tlc,4960
|
|
253
253
|
orionis/metadata/package.py,sha256=tqLfBRo-w1j_GN4xvzUNFyweWYFS-qhSgAEc-AmCH1M,5452
|
|
254
254
|
orionis/services/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
255
255
|
orionis/services/asynchrony/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -351,7 +351,7 @@ orionis/support/standard/exceptions/value.py,sha256=7xry_TZz3k-BLAZTR_uDiQ0RfXOk
|
|
|
351
351
|
orionis/support/wrapper/__init__.py,sha256=jGoWoIGYuRYqMYQKlrX7Dpcbg-AGkHoB_aM2xhu73yc,62
|
|
352
352
|
orionis/support/wrapper/dot_dict.py,sha256=VdAUH-DO6y86pl_9N6v-vU9mdLraWh5HjVzI5iC1dMs,5295
|
|
353
353
|
orionis/test/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
354
|
-
orionis/test/kernel.py,sha256=
|
|
354
|
+
orionis/test/kernel.py,sha256=HJiGGpMVtjVXL7s0LnFNNWHeLgNUWoe8L49KYtzresg,13650
|
|
355
355
|
orionis/test/arguments/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
356
356
|
orionis/test/arguments/parser.py,sha256=Oz09NCbQ9JrJgviiPJ92WbRa54rXWCsr6RDzPoh05vE,6019
|
|
357
357
|
orionis/test/cases/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -386,7 +386,7 @@ orionis/test/records/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hS
|
|
|
386
386
|
orionis/test/records/logs.py,sha256=EOQcloMVdhlNl2lU9igQz8H4b-OtKtiwh2pgr_QZWOI,13186
|
|
387
387
|
orionis/test/view/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
388
388
|
orionis/test/view/render.py,sha256=zd7xDvVfmQ2HxZamDTzL2-z2PpyL99EaolbbM7wTah4,5014
|
|
389
|
-
orionis-0.
|
|
389
|
+
orionis-0.395.0.dist-info/licenses/LICENCE,sha256=-_4cF2EBKuYVS_SQpy1uapq0oJPUU1vl_RUWSy2jJTo,1111
|
|
390
390
|
tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
391
391
|
tests/example/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
392
392
|
tests/example/test_example.py,sha256=8G7kp74PZZ0Tdnw8WkheZ7lvZVFpdx_9ShOZBN9GEF0,25582
|
|
@@ -487,8 +487,8 @@ tests/support/wrapper/test_services_wrapper_docdict.py,sha256=nTNrvJkMSPx_aopEQ9
|
|
|
487
487
|
tests/testing/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
488
488
|
tests/testing/test_testing_result.py,sha256=fnH7hjumNSErAFGITJgq2LHxSzvPF2tdtmHL9kyAv-Y,4409
|
|
489
489
|
tests/testing/test_testing_unit.py,sha256=d3CRGo6608fMzYcZKIKapjx_af2aigqWiKSiuK9euIY,7600
|
|
490
|
-
orionis-0.
|
|
491
|
-
orionis-0.
|
|
492
|
-
orionis-0.
|
|
493
|
-
orionis-0.
|
|
494
|
-
orionis-0.
|
|
490
|
+
orionis-0.395.0.dist-info/METADATA,sha256=I8g_76lWsv4Cf9y7Z4yoFTwhVazb4qYBNdSPmRf8Ows,4772
|
|
491
|
+
orionis-0.395.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
492
|
+
orionis-0.395.0.dist-info/top_level.txt,sha256=udNmZ4TdfoC-7CBFJO7HLpWggpCM71okNNgNVzgpjt4,21
|
|
493
|
+
orionis-0.395.0.dist-info/zip-safe,sha256=frcCV1k9oG9oKj3dpUqdJg1PxRT2RSN_XKdLCPjaYaY,2
|
|
494
|
+
orionis-0.395.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|