tiferet 1.0.0b2__py3-none-any.whl → 1.0.0b4__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.
- tiferet/configs/container.py +0 -0
- tiferet/configs/error.py +57 -1
- tiferet/contexts/container.py +0 -9
- tiferet/contexts/feature.py +5 -0
- tiferet/proxies/yaml/__init__.py +79 -0
- tiferet/proxies/yaml/app.py +38 -18
- {tiferet-1.0.0b2.dist-info → tiferet-1.0.0b4.dist-info}/METADATA +1 -1
- {tiferet-1.0.0b2.dist-info → tiferet-1.0.0b4.dist-info}/RECORD +11 -10
- {tiferet-1.0.0b2.dist-info → tiferet-1.0.0b4.dist-info}/WHEEL +0 -0
- {tiferet-1.0.0b2.dist-info → tiferet-1.0.0b4.dist-info}/licenses/LICENSE +0 -0
- {tiferet-1.0.0b2.dist-info → tiferet-1.0.0b4.dist-info}/top_level.txt +0 -0
File without changes
|
tiferet/configs/error.py
CHANGED
@@ -21,6 +21,14 @@ ERRORS = [
|
|
21
21
|
dict(lang='en_US', text='Failed to import dependency: {} from module {}. Error: {}')
|
22
22
|
]
|
23
23
|
),
|
24
|
+
dict(
|
25
|
+
id='invalid_dependency_error',
|
26
|
+
name='Invalid Dependency Error',
|
27
|
+
error_code='INVALID_DEPENDENCY_ERROR',
|
28
|
+
message=[
|
29
|
+
dict(lang='en_US', text='Dependency {} could not be resolved: {}')
|
30
|
+
]
|
31
|
+
),
|
24
32
|
dict(
|
25
33
|
id='app_repository_import_failed',
|
26
34
|
name='App Repository Import Failed',
|
@@ -44,5 +52,53 @@ ERRORS = [
|
|
44
52
|
message=[
|
45
53
|
dict(lang='en_US', text='Failed to load feature command attribute: {}. Ensure the container attributes are configured with the appropriate default settings/flags. {}')
|
46
54
|
]
|
47
|
-
)
|
55
|
+
),
|
56
|
+
dict(
|
57
|
+
id='error_not_found',
|
58
|
+
name='Error Not Found',
|
59
|
+
error_code='ERROR_NOT_FOUND',
|
60
|
+
message=[
|
61
|
+
dict(lang='en_US', text='Error not found: {}.')
|
62
|
+
]
|
63
|
+
),
|
64
|
+
dict(
|
65
|
+
id='container_attributes_not_found',
|
66
|
+
name='Container Attributes Not Found',
|
67
|
+
error_code='CONTAINER_ATTRIBUTES_NOT_FOUND',
|
68
|
+
message=[
|
69
|
+
dict(lang='en_US', text='No container attributes provided to load the container.')
|
70
|
+
]
|
71
|
+
),
|
72
|
+
dict(
|
73
|
+
id='dependency_type_not_found',
|
74
|
+
name='Dependency Type Not Found',
|
75
|
+
error_code='DEPENDENCY_TYPE_NOT_FOUND',
|
76
|
+
message=[
|
77
|
+
dict(lang='en_US', text='No dependency type found for attribute {} with flags {}.')
|
78
|
+
]
|
79
|
+
),
|
80
|
+
dict(
|
81
|
+
id='request_not_found',
|
82
|
+
name='Request Not Found',
|
83
|
+
error_code='REQUEST_NOT_FOUND',
|
84
|
+
message=[
|
85
|
+
dict(lang='en_US', text='Request data is not available for parameter parsing.')
|
86
|
+
]
|
87
|
+
),
|
88
|
+
dict(
|
89
|
+
id='parameter_not_found',
|
90
|
+
name='Parameter Not Found',
|
91
|
+
error_code='PARAMETER_NOT_FOUND',
|
92
|
+
message=[
|
93
|
+
dict(lang='en_US', text='Parameter {} not found in request data.')
|
94
|
+
]
|
95
|
+
),
|
96
|
+
dict(
|
97
|
+
id='feature_not_found',
|
98
|
+
name='Feature Not Found',
|
99
|
+
error_code='FEATURE_NOT_FOUND',
|
100
|
+
message=[
|
101
|
+
dict(lang='en_US', text='Feature with ID {} not found.')
|
102
|
+
]
|
103
|
+
),
|
48
104
|
]
|
tiferet/contexts/container.py
CHANGED
@@ -120,15 +120,6 @@ class ContainerContext(Model):
|
|
120
120
|
injector=injector,
|
121
121
|
dependency_name=attribute_id,
|
122
122
|
)
|
123
|
-
|
124
|
-
# Raise an error if the dependency is not found.
|
125
|
-
if not dependency:
|
126
|
-
raise_error.execute(
|
127
|
-
'CONTAINER_DEPENDENCY_NOT_FOUND',
|
128
|
-
f'Dependency with ID {attribute_id} not found in container with flags {flags}.',
|
129
|
-
attribute_id,
|
130
|
-
flags
|
131
|
-
)
|
132
123
|
|
133
124
|
# Return the dependency.
|
134
125
|
return dependency
|
tiferet/contexts/feature.py
CHANGED
@@ -98,9 +98,14 @@ class FeatureContext(object):
|
|
98
98
|
**request.data,
|
99
99
|
**kwargs
|
100
100
|
)
|
101
|
+
|
102
|
+
# If an error occurs during command execution, handle it based on the pass_on_error flag.
|
101
103
|
except Exception as e:
|
102
104
|
if not pass_on_error:
|
103
105
|
raise e
|
106
|
+
|
107
|
+
# Set the result to None if passing on the error.
|
108
|
+
result = None
|
104
109
|
|
105
110
|
# If a data key is provided, store the result in the request data.
|
106
111
|
if data_key:
|
tiferet/proxies/yaml/__init__.py
CHANGED
@@ -0,0 +1,79 @@
|
|
1
|
+
# *** imports
|
2
|
+
|
3
|
+
# ** core
|
4
|
+
from typing import Dict, Any
|
5
|
+
|
6
|
+
# ** app
|
7
|
+
from ...commands import raise_error
|
8
|
+
from ...clients import yaml_client
|
9
|
+
|
10
|
+
|
11
|
+
# *** classes
|
12
|
+
|
13
|
+
# ** class yaml_proxy
|
14
|
+
class YamlProxy(object):
|
15
|
+
'''
|
16
|
+
A base class for YAML proxies.
|
17
|
+
'''
|
18
|
+
|
19
|
+
# * field: config_file
|
20
|
+
config_file: str = None
|
21
|
+
|
22
|
+
# * method: init
|
23
|
+
def __init__(self, config_file: str):
|
24
|
+
'''
|
25
|
+
Initialize the YAML proxy.
|
26
|
+
|
27
|
+
:param config_file: The configuration file.
|
28
|
+
:type config_file: str
|
29
|
+
'''
|
30
|
+
self.config_file = config_file
|
31
|
+
|
32
|
+
# * method: load_yaml
|
33
|
+
def load_yaml(self, start_node: str = None, create_data: callable = None) -> any:
|
34
|
+
'''
|
35
|
+
Load data from the YAML configuration file.
|
36
|
+
|
37
|
+
:param start_node: The starting node in the YAML file.
|
38
|
+
:type start_node: str
|
39
|
+
:param create_data: A callable to create data objects from the loaded data.
|
40
|
+
:type create_data: callable
|
41
|
+
:return: The loaded data.
|
42
|
+
:rtype: any
|
43
|
+
'''
|
44
|
+
|
45
|
+
# Load the YAML file using the yaml client.
|
46
|
+
try:
|
47
|
+
return yaml_client.load(
|
48
|
+
self.config_file,
|
49
|
+
create_data=create_data,
|
50
|
+
start_node=start_node
|
51
|
+
)
|
52
|
+
except FileNotFoundError as e:
|
53
|
+
# If the file is not found, raise an error.
|
54
|
+
raise_error.execute(
|
55
|
+
'CONFIG_FILE_NOT_FOUND',
|
56
|
+
f'Configuration file {self.config_file} not found.',
|
57
|
+
self.config_file
|
58
|
+
)
|
59
|
+
|
60
|
+
|
61
|
+
# * method: save_yaml
|
62
|
+
def save_yaml(self, data: Dict[str, Any]):
|
63
|
+
'''
|
64
|
+
Save data to the YAML configuration file.
|
65
|
+
|
66
|
+
:param data: The data to save.
|
67
|
+
:type data: Dict[str, Any]
|
68
|
+
'''
|
69
|
+
|
70
|
+
# Save the data to the YAML file using the yaml client.
|
71
|
+
try:
|
72
|
+
yaml_client.save(self.config_file, data)
|
73
|
+
except FileNotFoundError as e:
|
74
|
+
# If the file is not found, raise an error.
|
75
|
+
raise_error.execute(
|
76
|
+
'CONFIG_FILE_NOT_FOUND',
|
77
|
+
f'Configuration file {self.config_file} not found.',
|
78
|
+
self.config_file
|
79
|
+
)
|
tiferet/proxies/yaml/app.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# *** imports
|
2
2
|
|
3
3
|
# ** app
|
4
|
+
from ...commands import raise_error
|
4
5
|
from ...data import DataObject
|
5
6
|
from ...data.app import AppInterfaceYamlData
|
6
7
|
from ...contracts.app import AppRepository, AppInterface
|
@@ -37,15 +38,24 @@ class AppYamlProxy(AppRepository):
|
|
37
38
|
'''
|
38
39
|
|
39
40
|
# Load the app interface data from the yaml configuration file and map it to the app interface object.
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
41
|
+
try:
|
42
|
+
interfaces = yaml_client.load(
|
43
|
+
self.config_file,
|
44
|
+
create_data=lambda data: [
|
45
|
+
DataObject.from_data(
|
46
|
+
AppInterfaceYamlData,
|
47
|
+
id=interface_id,
|
48
|
+
**record
|
49
|
+
).map() for interface_id, record in data.items()],
|
50
|
+
start_node=lambda data: data.get('interfaces'))
|
51
|
+
|
52
|
+
# If the file is not found, raise an error.
|
53
|
+
except FileNotFoundError:
|
54
|
+
raise_error.execute(
|
55
|
+
'APP_CONFIG_FILE_NOT_FOUND',
|
56
|
+
f'App configuration file {self.config_file} not found.',
|
57
|
+
self.config_file
|
58
|
+
)
|
49
59
|
|
50
60
|
# Return the list of app interface objects.
|
51
61
|
return interfaces
|
@@ -62,15 +72,25 @@ class AppYamlProxy(AppRepository):
|
|
62
72
|
'''
|
63
73
|
|
64
74
|
# Load the app interface data from the yaml configuration file.
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
75
|
+
try:
|
76
|
+
_data: AppInterface = yaml_client.load(
|
77
|
+
self.config_file,
|
78
|
+
create_data=lambda data: DataObject.from_data(
|
79
|
+
AppInterfaceYamlData,
|
80
|
+
id=id,
|
81
|
+
**data
|
82
|
+
),
|
83
|
+
start_node=lambda data: data.get('interfaces').get(id)
|
84
|
+
)
|
85
|
+
|
86
|
+
# If the file is not found, raise an error.
|
87
|
+
except FileNotFoundError:
|
88
|
+
raise_error.execute(
|
89
|
+
'APP_CONFIG_FILE_NOT_FOUND',
|
90
|
+
f'App configuration file {self.config_file} not found.',
|
91
|
+
self.config_file
|
92
|
+
)
|
93
|
+
|
74
94
|
# Return the app interface object.
|
75
95
|
# If the data is None, return None.
|
76
96
|
try:
|
@@ -7,14 +7,15 @@ tiferet/commands/core.py,sha256=4MSty0qM9v8sKihoLGFoPHFOyprVQ-MlPHvPqEO3hY8,3367
|
|
7
7
|
tiferet/commands/dependencies.py,sha256=bYwQXcT8HLyPRAavdSkrWI4vImsJ2H4Lr7AG9q3zxUw,2035
|
8
8
|
tiferet/commands/settings.py,sha256=W_HdOF5QV33DczHQu5iXHOhPKwaE6DUG4KPd5m6fm_Y,2605
|
9
9
|
tiferet/configs/__init__.py,sha256=aSp8zTjuQK6gKyOAlsobhVcrzz7MNagPvc7K1b2DFu8,80
|
10
|
-
tiferet/configs/
|
10
|
+
tiferet/configs/container.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
11
|
+
tiferet/configs/error.py,sha256=Yod_8vx8nK5d_qUtbEZv_k8gnFHki5yCD1k_cwAxIC0,3169
|
11
12
|
tiferet/configs/settings.py,sha256=U4Do6BNCodMBT2_Qi49Zk-saRFzCkKGx-nCs9hJETe0,867
|
12
13
|
tiferet/contexts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
13
14
|
tiferet/contexts/app.py,sha256=EFjcz3VxBDdCSPTpSxNyyloIeOIFXoRaOv796oMDQOk,8970
|
14
15
|
tiferet/contexts/cache.py,sha256=RsklfFmZTnFxzxh7hiKD3nuEg50LX-JuWcie7P6xfTo,1758
|
15
|
-
tiferet/contexts/container.py,sha256=
|
16
|
+
tiferet/contexts/container.py,sha256=v1HHEWx0Anw7xg1zsyl--uo6Zs80In-mgmR7qU8Z4Vc,3646
|
16
17
|
tiferet/contexts/error.py,sha256=Yr0rJgUTnDSxq5rSobVxUcoibehyYfKT5SrcXClBA48,3804
|
17
|
-
tiferet/contexts/feature.py,sha256=
|
18
|
+
tiferet/contexts/feature.py,sha256=46HKXq4ZmoVLrwVTQnKj6jcsE4FAgEarZaJ9OtXRaKw,5580
|
18
19
|
tiferet/contracts/__init__.py,sha256=a8e7mleeLr0s554mRd1K0O0q2clisR7wGpeex1-9hsI,47
|
19
20
|
tiferet/contracts/app.py,sha256=x1biqBRAKhYJtljG6M1MtbVxRk5nAHSGU8X1O16W_sE,1928
|
20
21
|
tiferet/contracts/cache.py,sha256=mr_sHGSe_k5GuE22f8NfX_2ppgHHCiZrnkCK07M53cc,1653
|
@@ -39,13 +40,13 @@ tiferet/models/error.py,sha256=perVK1nfot8QVaowT3tUHlr-nh8Hy9E6rTE5p3Hhv28,5627
|
|
39
40
|
tiferet/models/feature.py,sha256=SDnK3WsisSh5cfaEcX0WXV1Y4N2WsaGfhkDl7NL9B6s,6423
|
40
41
|
tiferet/models/settings.py,sha256=nsdRY5IYv6TKxbBbxmpE6ujwmZxJPdF6VxlJkmt1P-k,2497
|
41
42
|
tiferet/proxies/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
42
|
-
tiferet/proxies/yaml/__init__.py,sha256=
|
43
|
-
tiferet/proxies/yaml/app.py,sha256=
|
43
|
+
tiferet/proxies/yaml/__init__.py,sha256=rk_PyhBgbQ5mg62SPs1_JTJvXbaDJeoEsBl9SSqkfgs,2167
|
44
|
+
tiferet/proxies/yaml/app.py,sha256=Xg6nVojuSX2DjoSJYd1HJbYepZnjdiqvFczJWU8blvU,2998
|
44
45
|
tiferet/proxies/yaml/container.py,sha256=raOeZ2CIAbNHTzPNqL2tgPvuad7-LcPL0a1NJ-nmUYY,2971
|
45
46
|
tiferet/proxies/yaml/error.py,sha256=fFAFxbtVZ9dguvYb08TzrIBir1H0NYoe5JHjGm5HuTU,2885
|
46
47
|
tiferet/proxies/yaml/feature.py,sha256=CKIsAqil27U0VjtVIHTiq3U9chNOZM6HAuUyH5VDF_o,2471
|
47
|
-
tiferet-1.0.
|
48
|
-
tiferet-1.0.
|
49
|
-
tiferet-1.0.
|
50
|
-
tiferet-1.0.
|
51
|
-
tiferet-1.0.
|
48
|
+
tiferet-1.0.0b4.dist-info/licenses/LICENSE,sha256=e8_GutFM0sxbRlgUaeVsGvJ5uE-KvruLApOzIoHy_zU,1513
|
49
|
+
tiferet-1.0.0b4.dist-info/METADATA,sha256=QAHfiuwljCxrs65JxFkleNT4neHk2B5tEvLhrIxR5no,741
|
50
|
+
tiferet-1.0.0b4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
51
|
+
tiferet-1.0.0b4.dist-info/top_level.txt,sha256=g19Qw0j_VxPw-fgPF1TMPwbtHjnEhNQs0fa69wJZ6IM,8
|
52
|
+
tiferet-1.0.0b4.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|