tiferet 1.0.0a10__py3-none-any.whl → 1.0.0a11__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/contexts/container.py +19 -3
- tiferet/contexts/feature.py +24 -1
- {tiferet-1.0.0a10.dist-info → tiferet-1.0.0a11.dist-info}/METADATA +4 -1
- {tiferet-1.0.0a10.dist-info → tiferet-1.0.0a11.dist-info}/RECORD +7 -7
- {tiferet-1.0.0a10.dist-info → tiferet-1.0.0a11.dist-info}/LICENSE +0 -0
- {tiferet-1.0.0a10.dist-info → tiferet-1.0.0a11.dist-info}/WHEEL +0 -0
- {tiferet-1.0.0a10.dist-info → tiferet-1.0.0a11.dist-info}/top_level.txt +0 -0
tiferet/contexts/container.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# *** imports
|
2
2
|
|
3
3
|
# ** core
|
4
|
+
import os
|
4
5
|
from typing import Any
|
5
6
|
|
6
7
|
# ** app
|
@@ -78,11 +79,15 @@ class ContainerContext(Model):
|
|
78
79
|
:type data_flag: str
|
79
80
|
'''
|
80
81
|
|
81
|
-
# Add the attributes as
|
82
|
+
# Add the attributes and constants as empty dictionaries.
|
82
83
|
attributes = {}
|
84
|
+
constants = {}
|
83
85
|
|
84
86
|
# Get and set attributes and constants.
|
85
87
|
attrs, consts = container_repo.list_all()
|
88
|
+
|
89
|
+
# Parse the constants.
|
90
|
+
constants.update({key: self.parse_parameter(consts[key]) for key in consts})
|
86
91
|
|
87
92
|
# Add the attributes to the context.
|
88
93
|
for attr in attrs:
|
@@ -99,7 +104,7 @@ class ContainerContext(Model):
|
|
99
104
|
# Add any parameters as constants.
|
100
105
|
for dep in attr.dependencies:
|
101
106
|
for key in dep.parameters:
|
102
|
-
|
107
|
+
constants[key] = self.parse_parameter(dep.parameters[key])
|
103
108
|
|
104
109
|
# Add the constants and attributes to the context.
|
105
110
|
super().__init__(dict(
|
@@ -107,9 +112,20 @@ class ContainerContext(Model):
|
|
107
112
|
feature_flag=feature_flag,
|
108
113
|
data_flag=data_flag,
|
109
114
|
attributes=attributes,
|
110
|
-
constants=
|
115
|
+
constants=constants,
|
111
116
|
))
|
112
117
|
|
118
|
+
|
119
|
+
# * method: parse_environment_parameter
|
120
|
+
def parse_parameter(self, parameter: str) -> str:
|
121
|
+
|
122
|
+
# If the parameter is an environment variable, get the value.
|
123
|
+
if parameter.startswith('$env.'):
|
124
|
+
return os.getenv(parameter[5:])
|
125
|
+
|
126
|
+
# Otherwise, return the parameter.
|
127
|
+
return parameter
|
128
|
+
|
113
129
|
# * method: get_dependency
|
114
130
|
def get_dependency(self, attribute_id: str):
|
115
131
|
'''
|
tiferet/contexts/feature.py
CHANGED
@@ -51,6 +51,20 @@ class FeatureContext(Model):
|
|
51
51
|
features=features,
|
52
52
|
))
|
53
53
|
self.container = container_context
|
54
|
+
|
55
|
+
# * method: parse_parameter
|
56
|
+
def parse_parameter(self, parameter: str) -> str:
|
57
|
+
'''
|
58
|
+
Parse a parameter.
|
59
|
+
|
60
|
+
:param parameter: The parameter to parse.
|
61
|
+
:type parameter: str
|
62
|
+
:return: The parsed parameter.
|
63
|
+
:rtype: str
|
64
|
+
'''
|
65
|
+
|
66
|
+
# Parse the parameter.
|
67
|
+
return self.container.parse_parameter(parameter)
|
54
68
|
|
55
69
|
# * method: execute
|
56
70
|
def execute(self, request: RequestContext, debug: bool = False, **kwargs):
|
@@ -71,12 +85,21 @@ class FeatureContext(Model):
|
|
71
85
|
# Get the feature command handler instance.
|
72
86
|
handler = self.container.get_dependency(command.attribute_id)
|
73
87
|
|
88
|
+
# Parse the command parameters
|
89
|
+
params = {
|
90
|
+
param:
|
91
|
+
self.parse_parameter(
|
92
|
+
command.params.get(param)
|
93
|
+
)
|
94
|
+
for param in command.params
|
95
|
+
}
|
96
|
+
|
74
97
|
# Execute the handler function.
|
75
98
|
# Handle assertion errors if pass on error is not set.
|
76
99
|
try:
|
77
100
|
result = handler.execute(
|
78
101
|
**request.data,
|
79
|
-
**
|
102
|
+
**params,
|
80
103
|
debug=debug,
|
81
104
|
**kwargs)
|
82
105
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: tiferet
|
3
|
-
Version: 1.0.
|
3
|
+
Version: 1.0.0a11
|
4
4
|
Summary: A multi-purpose application framework embodying beauty in form.
|
5
5
|
Home-page: https://github.com/greatstrength/app
|
6
6
|
Download-URL: https://github.com/greatstrength/app
|
@@ -11,3 +11,6 @@ License-File: LICENSE
|
|
11
11
|
Requires-Dist: schematics>=2.1.1
|
12
12
|
Requires-Dist: pyyaml>=6.0.1
|
13
13
|
Requires-Dist: dependencies>=7.7.0
|
14
|
+
Provides-Extra: test
|
15
|
+
Requires-Dist: pytest>=8.3.3; extra == "test"
|
16
|
+
Requires-Dist: pytest_env>=1.1.5; extra == "test"
|
@@ -8,9 +8,9 @@ tiferet/commands/feature.py,sha256=tXa-MDf14ByIJqwQFeSUu2QLUjHPdsyvFNhj1XeaQVk,2
|
|
8
8
|
tiferet/configs/__init__.py,sha256=NfT6XFNcJznOLXjMuNmj3XeaOPVWwbc-N4kVWaVjuD0,845
|
9
9
|
tiferet/contexts/__init__.py,sha256=HjI-9n29mFxN6ILSa3LBhLSVPRe-1V36ffQXSP9RavM,204
|
10
10
|
tiferet/contexts/app.py,sha256=9VxWliIX_Y0Y8CZXQzYLgzN89MabkFzkW2e7-3P5KrQ,3781
|
11
|
-
tiferet/contexts/container.py,sha256=
|
11
|
+
tiferet/contexts/container.py,sha256=qQzrAxGoq5yNqijMnVzE2wVwKprBmEVgiaBunnNcMd8,5704
|
12
12
|
tiferet/contexts/error.py,sha256=mS72JU7rlxs9yEeDj5ZW3DuJftYqmkyp8DOhzNUwtMw,2562
|
13
|
-
tiferet/contexts/feature.py,sha256=
|
13
|
+
tiferet/contexts/feature.py,sha256=CnfgvYvApjkOa2fpZw9Vz6a7fsmiVx7mXaeZT2g9HGc,3589
|
14
14
|
tiferet/contexts/request.py,sha256=EwTyXVYi8z1t1ns_0yDrjY6qICIMPn1UvZpV7ULKReY,2756
|
15
15
|
tiferet/data/__init__.py,sha256=JKaeCw508WY15-etqdFJxPUUJxMxCAi6ASmA472D1_s,93
|
16
16
|
tiferet/data/app.py,sha256=TWWwP0MDpQ-LSKg9166CyPSeI7jjcklIfwBlLW_rT5c,9619
|
@@ -31,8 +31,8 @@ tiferet/repos/feature.py,sha256=GxOV8XHNwz9YY3I8Wch6GaDskvkdi8l1hM9E9fCg1y0,3644
|
|
31
31
|
tiferet/services/__init__.py,sha256=zB5elAFApNH435JLExPmWxvBmZcCtbAyai-KawUjr4E,101
|
32
32
|
tiferet/services/app.py,sha256=92GvC-Vh8FDZoYMLdgzQ3iS1TVL4uyIErk7NJ4rpYPI,1462
|
33
33
|
tiferet/services/container.py,sha256=ISJhkiNLV--nHbAv6Ajd3ug1cGiyazZoePJOCJu5n_s,1130
|
34
|
-
tiferet-1.0.
|
35
|
-
tiferet-1.0.
|
36
|
-
tiferet-1.0.
|
37
|
-
tiferet-1.0.
|
38
|
-
tiferet-1.0.
|
34
|
+
tiferet-1.0.0a11.dist-info/LICENSE,sha256=e8_GutFM0sxbRlgUaeVsGvJ5uE-KvruLApOzIoHy_zU,1513
|
35
|
+
tiferet-1.0.0a11.dist-info/METADATA,sha256=E1LI8jIwaqNUYA7rDRg-Sj7qeLwZ0voMKFZlS9hCtVU,536
|
36
|
+
tiferet-1.0.0a11.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
37
|
+
tiferet-1.0.0a11.dist-info/top_level.txt,sha256=g19Qw0j_VxPw-fgPF1TMPwbtHjnEhNQs0fa69wJZ6IM,8
|
38
|
+
tiferet-1.0.0a11.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|