tiferet 1.0.0a4__py3-none-any.whl → 1.0.0a6__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.
@@ -17,6 +17,14 @@ class ContainerContext(Model):
17
17
  A container context is a class that is used to create a container object.
18
18
  '''
19
19
 
20
+ # * attribute: interface_id
21
+ interface_id = StringType(
22
+ required=True,
23
+ metadata=dict(
24
+ description='The interface ID.'
25
+ ),
26
+ )
27
+
20
28
  # * attribute: attributes
21
29
  attributes = DictType(
22
30
  ModelType(ContainerAttribute),
@@ -65,37 +73,38 @@ class ContainerContext(Model):
65
73
  :param interface_flag: The interface flag.
66
74
  :type interface_flag: str
67
75
  :param feature_flag: The feature flag.
68
- :type feature_flag: str
76
+ :type feature_flag: str
69
77
  :param data_flag: The data flag.
70
78
  :type data_flag: str
71
79
  '''
72
80
 
73
- # Then set the interface id and injector flags.
74
- self.interface_id = interface_id
75
- self.feature_flag = feature_flag
76
- self.data_flag = data_flag
77
-
78
81
  # Add the attributes as an empty dictionary.
79
- self.attributes = {}
82
+ attributes = {}
80
83
 
81
84
  # Get and set attributes and constants.
82
85
  attrs, consts = container_repo.list_all()
83
86
 
84
87
  # Add the attributes to the context.
85
88
  for attr in attrs:
86
- attribute: ContainerAttribute = self.attributes[attr.id]
89
+ attribute: ContainerAttribute = attributes[attr.id]
87
90
 
88
91
  # If the attribute already exists, set the dependencies.
89
- if attr.id in self.attributes:
92
+ if attr.id in attributes:
90
93
  for dep in attr.dependencies:
91
94
  attribute.set_dependency(dep)
92
95
  continue
93
96
 
94
97
  # Otherwise, add the attribute.
95
- self.attributes[attr.id] = attr
96
-
97
- # Add the constants to the context.
98
- self.constants = consts
98
+ attributes[attr.id] = attr
99
+
100
+ # Add the constants and attributes to the context.
101
+ super().__init__(dict(
102
+ interface_id=interface_id,
103
+ feature_flag=feature_flag,
104
+ data_flag=data_flag,
105
+ attributes=attributes,
106
+ constants=consts,
107
+ ))
99
108
 
100
109
  # * method: get_dependency
101
110
  def get_dependency(self, attribute_id: str):
tiferet/contexts/env.py CHANGED
@@ -40,7 +40,13 @@ class EnvironmentContext(Model):
40
40
  app_repo = self.load_app_repo()
41
41
 
42
42
  # Load the interface configuration.
43
- self.interfaces = {interface.id: interface for interface in app_repo.list_interfaces()}
43
+ interfaces = {interface.id: interface for interface in app_repo.list_interfaces()}
44
+
45
+ # Set the interfaces.
46
+ super().__init__(dict(
47
+ interfaces=interfaces,
48
+ **kwargs
49
+ ), strict=False)
44
50
 
45
51
  # * method: start
46
52
  def start(self, interface_id: str, **kwargs):
@@ -89,19 +95,25 @@ class EnvironmentContext(Model):
89
95
  # Get the app interface.
90
96
  app_interface: AppInterface = self.interfaces.get(interface_id)
91
97
 
92
- # Get the dependencies for the app interface.
98
+ # Get the default dependencies for the app interface.
93
99
  dependencies = dict(
94
100
  interface_id=app_interface.id,
101
+ app_name=app_interface.name,
95
102
  feature_flag=app_interface.feature_flag,
96
103
  data_flag=app_interface.data_flag,
104
+ app_context=container_service.import_dependency(
105
+ **app_interface.app_context.to_primitive()
106
+ ),
97
107
  **app_interface.constants
98
108
  )
99
- for dep in app_interface.get_dependencies():
109
+
110
+ # Import the dependencies.
111
+ for dep in app_interface.dependencies:
100
112
  dependencies[dep.attribute_id] = container_service.import_dependency(dep.module_path, dep.class_name)
101
113
 
102
114
  # Create the injector from the dependencies, constants, and the app interface.
103
115
  injector = container_service.create_injector(
104
- app_interface.id
116
+ app_interface.id,
105
117
  **dependencies
106
118
  )
107
119
 
@@ -31,13 +31,24 @@ class FeatureContext(Model):
31
31
  )
32
32
 
33
33
  # * method: init
34
- def __init__(self, feature_repo: FeatureRepository, container: ContainerContext):
34
+ def __init__(self, feature_repo: FeatureRepository, container_context: ContainerContext):
35
+ '''
36
+ Initialize the feature context.
37
+
38
+ :param feature_repo: The feature repository.
39
+ :type feature_repo: FeatureRepository
40
+ :param container_context: The container context.
41
+ :type container_context: ContainerContext
42
+ '''
35
43
 
36
- # Set the features.
37
- self.features = {feature.id: feature for feature in feature_repo.list()}
44
+ # Create the features.
45
+ features = {feature.id: feature for feature in feature_repo.list()}
38
46
 
39
- # Set the container context.
40
- self.container = container
47
+ # Set the features and container.
48
+ super().__init__(dict(
49
+ features=features,
50
+ container=container_context,
51
+ ))
41
52
 
42
53
  # * method: execute
43
54
  def execute(self, request: RequestContext, debug: bool = False, **kwargs):
tiferet/data/app.py CHANGED
@@ -1,5 +1,8 @@
1
1
  # *** imports
2
2
 
3
+ # ** core
4
+ from typing import Dict
5
+
3
6
  # ** app
4
7
  from ..configs import *
5
8
  from ..domain import DataObject
@@ -14,6 +17,13 @@ class AppDependencyYamlData(AppDependency, DataObject):
14
17
  A YAML data representation of an app dependency object.
15
18
  '''
16
19
 
20
+ # * attribute: attribute_id
21
+ attribute_id = StringType(
22
+ metadata=dict(
23
+ description='The attribute id for the application dependency.'
24
+ ),
25
+ )
26
+
17
27
  class Options():
18
28
  '''
19
29
  The options for the app dependency data.
@@ -38,9 +48,8 @@ class AppDependencyYamlData(AppDependency, DataObject):
38
48
 
39
49
  # Create a new AppDependencyData object.
40
50
  return AppDependencyYamlData(
41
- super(AppDependencyYamlData, AppDependencyYamlData).new(
42
- **kwargs
43
- )
51
+ dict(**kwargs),
52
+ strict=False,
44
53
  )
45
54
 
46
55
  # * method: map
@@ -72,7 +81,7 @@ class AppInterfaceYamlData(AppInterface, DataObject):
72
81
  '''
73
82
  serialize_when_none = False
74
83
  roles = {
75
- 'to_model': DataObject.allow(),
84
+ 'to_model': DataObject.deny('app_context', 'container_context', 'feature_context', 'error_context', 'feature_repo', 'container_repo', 'error_repo'),
76
85
  'to_data.yaml': DataObject.deny('id')
77
86
  }
78
87
 
@@ -89,6 +98,11 @@ class AppInterfaceYamlData(AppInterface, DataObject):
89
98
  feature_context = ModelType(
90
99
  AppDependencyYamlData,
91
100
  required=True,
101
+ default=AppDependencyYamlData.new(
102
+ attribute_id='feature_context',
103
+ module_path='tiferet.contexts.feature',
104
+ class_name='FeatureContext',
105
+ ),
92
106
  metadata=dict(
93
107
  description='The feature context dependency.'
94
108
  ),
@@ -98,6 +112,11 @@ class AppInterfaceYamlData(AppInterface, DataObject):
98
112
  container_context = ModelType(
99
113
  AppDependencyYamlData,
100
114
  required=True,
115
+ default=AppDependencyYamlData.new(
116
+ attribute_id='container_context',
117
+ module_path='tiferet.contexts.container',
118
+ class_name='ContainerContext',
119
+ ),
101
120
  metadata=dict(
102
121
  description='The container context dependency.'
103
122
  ),
@@ -107,6 +126,11 @@ class AppInterfaceYamlData(AppInterface, DataObject):
107
126
  error_context = ModelType(
108
127
  AppDependencyYamlData,
109
128
  required=True,
129
+ default=AppDependencyYamlData.new(
130
+ attribute_id='error_context',
131
+ module_path='tiferet.contexts.error',
132
+ class_name='ErrorContext',
133
+ ),
110
134
  metadata=dict(
111
135
  description='The error context dependency.'
112
136
  ),
@@ -116,6 +140,11 @@ class AppInterfaceYamlData(AppInterface, DataObject):
116
140
  feature_repo = ModelType(
117
141
  AppDependencyYamlData,
118
142
  required=True,
143
+ default=AppDependencyYamlData.new(
144
+ attribute_id='feature_repo',
145
+ module_path='tiferet.repos.feature',
146
+ class_name='YamlProxy',
147
+ ),
119
148
  metadata=dict(
120
149
  description='The feature repository dependency.'
121
150
  ),
@@ -125,6 +154,11 @@ class AppInterfaceYamlData(AppInterface, DataObject):
125
154
  container_repo = ModelType(
126
155
  AppDependencyYamlData,
127
156
  required=True,
157
+ default=AppDependencyYamlData.new(
158
+ attribute_id='container_repo',
159
+ module_path='tiferet.repos.container',
160
+ class_name='YamlProxy',
161
+ ),
128
162
  metadata=dict(
129
163
  description='The container repository dependency.'
130
164
  ),
@@ -134,6 +168,11 @@ class AppInterfaceYamlData(AppInterface, DataObject):
134
168
  error_repo = ModelType(
135
169
  AppDependencyYamlData,
136
170
  required=True,
171
+ default=AppDependencyYamlData.new(
172
+ attribute_id='error_repo',
173
+ module_path='tiferet.repos.error',
174
+ class_name='YamlProxy',
175
+ ),
137
176
  metadata=dict(
138
177
  description='The error repository dependency.'
139
178
  ),
@@ -141,7 +180,14 @@ class AppInterfaceYamlData(AppInterface, DataObject):
141
180
 
142
181
  # * method: new
143
182
  @staticmethod
144
- def new(**kwargs) -> 'AppInterfaceYamlData':
183
+ def new(app_context: Dict[str, str],
184
+ container_context: Dict[str, str] = None,
185
+ feature_context: Dict[str, str] = None,
186
+ error_context: Dict[str, str] = None,
187
+ feature_repo: Dict[str, str] = None,
188
+ container_repo: Dict[str, str] = None,
189
+ error_repo: Dict[str, str] = None,
190
+ **kwargs) -> 'AppInterfaceYamlData':
145
191
  '''
146
192
  Initializes a new YAML representation of an AppInterface object.
147
193
 
@@ -151,12 +197,33 @@ class AppInterfaceYamlData(AppInterface, DataObject):
151
197
  :rtype: AppInterfaceData
152
198
  '''
153
199
 
200
+ # Format the dependencies.
201
+ dependencies = {}
202
+ if app_context:
203
+ dependencies['app_context'] = AppDependencyYamlData.new(attribute_id='app_context', **app_context)
204
+ if container_context:
205
+ dependencies['container_context'] = AppDependencyYamlData.new(attribute_id='container_context', **container_context)
206
+ if feature_context:
207
+ dependencies['feature_context'] = AppDependencyYamlData.new(attribute_id='feature_context', **feature_context)
208
+ if error_context:
209
+ dependencies['error_context'] = AppDependencyYamlData.new(attribute_id='error_context', **error_context)
210
+ if feature_repo:
211
+ dependencies['feature_repo'] = AppDependencyYamlData.new(attribute_id='feature_repo', **feature_repo)
212
+ if container_repo:
213
+ dependencies['container_repo'] = AppDependencyYamlData.new(attribute_id='container_repo', **container_repo)
214
+ if error_repo:
215
+ dependencies['error_repo'] = AppDependencyYamlData.new(attribute_id='error_repo', **error_repo)
216
+
154
217
  # Create a new AppInterfaceData object.
155
- return AppInterfaceYamlData(
156
- super(AppInterfaceYamlData, AppInterfaceYamlData).new(
157
- **kwargs
158
- )
218
+ data = AppInterfaceYamlData(dict(
219
+ **dependencies,
220
+ **kwargs),
221
+ strict=False,
159
222
  )
223
+
224
+ # Validate and return the new AppInterfaceData object.
225
+ data.validate()
226
+ return data
160
227
 
161
228
  # * method: map
162
229
  def map(self, **kwargs) -> AppInterface:
@@ -171,8 +238,23 @@ class AppInterfaceYamlData(AppInterface, DataObject):
171
238
  :rtype: AppInterface
172
239
  '''
173
240
 
241
+ # Format and map the dependencies.
242
+ dependencies = [
243
+ self.app_context.map(),
244
+ self.container_context.map(),
245
+ self.feature_context.map(),
246
+ self.error_context.map(),
247
+ self.feature_repo.map(),
248
+ self.container_repo.map(),
249
+ self.error_repo.map(),
250
+ ]
251
+
174
252
  # Map the app interface data.
175
- return super().map(AppInterface, **kwargs)
253
+ return super().map(AppInterface,
254
+ dependencies=dependencies,
255
+ **self.to_primitive('to_model'),
256
+ **kwargs
257
+ )
176
258
 
177
259
 
178
260
  # ** data: app_repository_configuration_yaml_data
tiferet/data/error.py CHANGED
@@ -76,24 +76,3 @@ class ErrorData(Error, DataObject):
76
76
  return ErrorData(
77
77
  super(ErrorData, ErrorData).new(**kwargs)
78
78
  )
79
-
80
- # * method: from_yaml_data
81
-
82
- @staticmethod
83
- def from_yaml_data(id: str, **kwargs):
84
- '''
85
- Initializes a new ErrorData object from yaml data.
86
-
87
- :param id: The unique identifier for the error.
88
- :type id: str
89
- :param kwargs: Additional keyword arguments.
90
- :type kwargs: dict
91
- :return: A new ErrorData object.
92
- :rtype: ErrorData
93
- '''
94
-
95
- # Create a new ErrorData object.
96
- return ErrorData.new(
97
- id=id,
98
- **kwargs
99
- )
tiferet/domain/app.py CHANGED
@@ -31,9 +31,9 @@ class AppDependency(ModuleDependency):
31
31
  '''
32
32
 
33
33
  # Create and return a new AppDependency object.
34
- return AppDependency(
35
- super(AppDependency, AppDependency).new(**kwargs),
36
- strict=False,
34
+ return super(AppDependency, AppDependency).new(
35
+ AppDependency,
36
+ **kwargs,
37
37
  )
38
38
 
39
39
  # ** model: app_interface
@@ -60,6 +60,7 @@ class AppInterface(Entity):
60
60
  # attribute: feature_flag
61
61
  feature_flag = StringType(
62
62
  required=True,
63
+ default='core',
63
64
  metadata=dict(
64
65
  description='The feature flag.'
65
66
  ),
@@ -73,96 +74,13 @@ class AppInterface(Entity):
73
74
  ),
74
75
  )
75
76
 
76
- # * attribute: app_context
77
- app_context = ModelType(
78
- AppDependency,
79
- required=True,
80
- metadata=dict(
81
- description='The application context dependency.'
82
- ),
83
- )
84
-
85
- # * attribute: feature_context
86
- feature_context = ModelType(
87
- AppDependency,
77
+ # * attribute: dependencies
78
+ dependencies = ListType(
79
+ ModelType(AppDependency),
88
80
  required=True,
89
- default=AppDependency.new(
90
- attribute_id='feature_context',
91
- module_path='tiferet.contexts.feature',
92
- class_name='FeatureContext',
93
- ),
94
- metadata=dict(
95
- description='The feature context dependency.'
96
- ),
97
- )
98
-
99
- # * attribute: container_context
100
- container_context = ModelType(
101
- AppDependency,
102
- required=True,
103
- default=AppDependency.new(
104
- attribute_id='container_context',
105
- module_path='tiferet.contexts.container',
106
- class_name='ContainerContext',
107
- ),
108
- metadata=dict(
109
- description='The container context dependency.'
110
- ),
111
- )
112
-
113
- # * attribute: error_context
114
- error_context = ModelType(
115
- AppDependency,
116
- required=True,
117
- default=AppDependency.new(
118
- attribute_id='error_context',
119
- module_path='tiferet.contexts.error',
120
- class_name='ErrorContext',
121
- ),
122
- metadata=dict(
123
- description='The error context dependency.'
124
- ),
125
- )
126
-
127
- # * attribute: feature_repo
128
- feature_repo = ModelType(
129
- AppDependency,
130
- required=True,
131
- default=AppDependency.new(
132
- attribute_id='feature_repo',
133
- module_path='tiferet.repos.feature',
134
- class_name='FeatureRepository',
135
- ),
136
- metadata=dict(
137
- description='The feature repository dependency.'
138
- ),
139
- )
140
-
141
- # * attribute: container_repo
142
- container_repo = ModelType(
143
- AppDependency,
144
- required=True,
145
- default=AppDependency.new(
146
- attribute_id='container_repo',
147
- module_path='tiferet.repos.container',
148
- class_name='ContainerRepository',
149
- ),
150
- metadata=dict(
151
- description='The container repository dependency.'
152
- ),
153
- )
154
-
155
- # * attribute: error_repo
156
- error_repo = ModelType(
157
- AppDependency,
158
- required=True,
159
- default=AppDependency.new(
160
- attribute_id='error_repo',
161
- module_path='tiferet.repos.error',
162
- class_name='ErrorRepository',
163
- ),
81
+ default=[],
164
82
  metadata=dict(
165
- description='The error repository dependency.'
83
+ description='The application interface dependencies.'
166
84
  ),
167
85
  )
168
86
 
@@ -197,26 +115,20 @@ class AppInterface(Entity):
197
115
  **kwargs
198
116
  )
199
117
 
200
- # * method: list_dependencies
201
- def get_dependencies(self) -> list:
118
+ # * method: get_dependency
119
+ def get_dependency(self, attribute_id: str) -> AppDependency:
202
120
  '''
203
- Lists the dependencies for the application interface.
121
+ Get the dependency by attribute id.
204
122
 
205
- :return: The list of dependencies for the application interface.
206
- :rtype: list
123
+ :param attribute_id: The attribute id of the dependency.
124
+ :type attribute_id: str
125
+ :return: The dependency.
126
+ :rtype: AppDependency
207
127
  '''
208
128
 
209
- # Return the list of dependencies for the application interface.
210
- return [
211
- self.app_context,
212
- self.feature_context,
213
- self.container_context,
214
- self.error_context,
215
- self.feature_repo,
216
- self.container_repo,
217
- self.error_repo,
218
- ]
219
-
129
+ # Get the dependency by attribute id.
130
+ return next((dep for dep in self.dependencies if dep.attribute_id == attribute_id), None)
131
+
220
132
 
221
133
  # ** model: app_repository_configuration
222
134
  class AppRepositoryConfiguration(ModuleDependency):
@@ -267,7 +179,9 @@ class AppRepositoryConfiguration(ModuleDependency):
267
179
 
268
180
  # Create and return a new AppRepositoryConfiguration object.
269
181
  return AppRepositoryConfiguration(
270
- super(AppRepositoryConfiguration, AppRepositoryConfiguration).new(**kwargs),
182
+ super(AppRepositoryConfiguration, AppRepositoryConfiguration).new(
183
+ AppRepositoryConfiguration,
184
+ **kwargs),
271
185
  strict=False,
272
186
  )
273
187
 
tiferet/domain/core.py CHANGED
@@ -159,7 +159,7 @@ class DataObject(Model):
159
159
 
160
160
 
161
161
  # ** model: module_dependency
162
- class ModuleDependency(Model):
162
+ class ModuleDependency(ValueObject):
163
163
  '''
164
164
  A module dependency.
165
165
  '''
@@ -172,27 +172,10 @@ class ModuleDependency(Model):
172
172
  )
173
173
  )
174
174
 
175
- # ** attribute: class_name
175
+ # * attribute: class_name
176
176
  class_name = StringType(
177
177
  required=True,
178
178
  metadata=dict(
179
179
  description='The class name.'
180
180
  )
181
181
  )
182
-
183
- # * method: new
184
- @staticmethod
185
- def new(**kwargs) -> 'ModuleDependency':
186
- '''
187
- Initializes a new ModuleDependency object.
188
-
189
- :param kwargs: Additional keyword arguments.
190
- :type kwargs: dict
191
- :return: A new ModuleDependency object.
192
- :rtype: ModuleDependency
193
- '''
194
-
195
- # Create a new ModuleDependency object.
196
- return ModuleDependency(dict(
197
- **kwargs
198
- ), strict=False)
tiferet/repos/error.py CHANGED
@@ -127,7 +127,7 @@ class YamlProxy(ErrorRepository):
127
127
  # Load the error data from the yaml configuration file.
128
128
  _data: ErrorData = yaml_client.load(
129
129
  self.config_file,
130
- create_data=lambda data: ErrorData.from_yaml_data(
130
+ create_data=lambda data: ErrorData.new(
131
131
  id=id, **data),
132
132
  start_node=lambda data: data.get('errors').get(id))
133
133
 
@@ -146,8 +146,8 @@ class YamlProxy(ErrorRepository):
146
146
  # Load the error data from the yaml configuration file.
147
147
  _data: Dict[str, ErrorData] = yaml_client.load(
148
148
  self.config_file,
149
- create_data=lambda data: ErrorData.from_yaml_data(
150
- id=id, **data),
149
+ create_data=lambda data: {id: ErrorData.new(
150
+ id=id, **error_data) for id, error_data in data.items()},
151
151
  start_node=lambda data: data.get('errors'))
152
152
 
153
153
  # Return the error object.
tiferet/repos/feature.py CHANGED
@@ -1,16 +1,22 @@
1
- from typing import Dict, Any, List
1
+ # *** imports
2
2
 
3
+ # ** core
4
+ from typing import List
5
+
6
+ # ** app
3
7
  from ..data.feature import FeatureData
4
8
  from ..domain.feature import Feature
9
+ from ..clients import yaml_client
5
10
 
6
- from ..clients import yaml as yaml_client
7
-
11
+ # *** repository
8
12
 
13
+ # ** interface: feature_repository
9
14
  class FeatureRepository(object):
10
15
  '''
11
16
  Feature repository interface.
12
17
  '''
13
18
 
19
+ # * method: exists
14
20
  def exists(self, id: str) -> bool:
15
21
  '''
16
22
  Verifies if the feature exists.
@@ -21,8 +27,10 @@ class FeatureRepository(object):
21
27
  :rtype: bool
22
28
  '''
23
29
 
30
+ # Not implemented.
24
31
  raise NotImplementedError()
25
32
 
33
+ # * method: get
26
34
  def get(self, id: str) -> Feature:
27
35
  '''
28
36
  Get the feature by id.
@@ -33,8 +41,10 @@ class FeatureRepository(object):
33
41
  :rtype: f.Feature
34
42
  '''
35
43
 
44
+ # Not implemented.
36
45
  raise NotImplementedError()
37
-
46
+
47
+ # * method: list
38
48
  def list(self, group_id: str = None) -> List[Feature]:
39
49
  '''
40
50
  List the features.
@@ -45,8 +55,10 @@ class FeatureRepository(object):
45
55
  :rtype: list
46
56
  '''
47
57
 
58
+ # Not implemented.
48
59
  raise NotImplementedError
49
60
 
61
+ # * method: save
50
62
  def save(self, feature: Feature):
51
63
  '''
52
64
  Save the feature.
@@ -55,25 +67,28 @@ class FeatureRepository(object):
55
67
  :type feature: f.Feature
56
68
  '''
57
69
 
70
+ # Not implemented.
58
71
  raise NotImplementedError()
59
72
 
60
-
73
+ # ** repository: yaml_proxy
61
74
  class YamlProxy(FeatureRepository):
62
75
  '''
63
76
  Yaml repository for features.
64
77
  '''
65
78
 
66
- def __init__(self, feature_yaml_base_path: str):
79
+ # * method: init
80
+ def __init__(self, feature_config_file: str):
67
81
  '''
68
82
  Initialize the yaml repository.
69
83
 
70
- :param feature_yaml_base_path: The base path to the yaml file.
71
- :type feature_yaml_base_path: str
84
+ :param feature_config_file: The feature configuration file.
85
+ :type feature_config_file: str
72
86
  '''
73
87
 
74
88
  # Set the base path.
75
- self.base_path = feature_yaml_base_path
89
+ self.config_file = feature_config_file
76
90
 
91
+ # * method: exists
77
92
  def exists(self, id: str) -> bool:
78
93
  '''
79
94
  Verifies if the feature exists.
@@ -90,6 +105,7 @@ class YamlProxy(FeatureRepository):
90
105
  # Return whether the feature exists.
91
106
  return feature is not None
92
107
 
108
+ # * method: get
93
109
  def get(self, id: str) -> Feature:
94
110
  '''
95
111
  Get the feature by id.
@@ -104,7 +120,7 @@ class YamlProxy(FeatureRepository):
104
120
 
105
121
  # Load feature data from yaml.
106
122
  _data: FeatureData = yaml_client.load(
107
- self.base_path,
123
+ self.config_file,
108
124
  create_data=lambda data: FeatureData.from_yaml_data(
109
125
  id=id,
110
126
  group_id=group_id,
@@ -120,6 +136,7 @@ class YamlProxy(FeatureRepository):
120
136
  # Return feature.
121
137
  return _data.map('to_object.yaml')
122
138
 
139
+ # * method: list
123
140
  def list(self, group_id: str = None) -> List[Feature]:
124
141
  '''
125
142
  List the features.
@@ -132,7 +149,7 @@ class YamlProxy(FeatureRepository):
132
149
 
133
150
  # Load all feature data from yaml.
134
151
  features = yaml_client.load(
135
- self.base_path,
152
+ self.config_file,
136
153
  create_data=lambda data: [FeatureData.from_yaml_data(
137
154
  id=id,
138
155
  **feature_data
@@ -147,6 +164,7 @@ class YamlProxy(FeatureRepository):
147
164
  # Return the list of features.
148
165
  return [feature.map('to_object.yaml') for feature in features]
149
166
 
167
+ # * method: save
150
168
  def save(self, feature: Feature):
151
169
  '''
152
170
  Save the feature.
@@ -160,7 +178,7 @@ class YamlProxy(FeatureRepository):
160
178
 
161
179
  # Update the feature data.
162
180
  yaml_client.save(
163
- self.base_path,
181
+ self.config_file,
164
182
  data=feature_data,
165
183
  data_save_path=f'features/{feature.group_id}.{feature_data.feature_key}'
166
184
  )
@@ -10,7 +10,7 @@ from dependencies import Injector
10
10
  # *** functions
11
11
 
12
12
  # ** function: import_dependency
13
- def import_dependency(module_path: str, class_name: str) -> Any:
13
+ def import_dependency(module_path: str, class_name: str, **kwargs) -> Any:
14
14
  '''
15
15
  Import an object dependency from its configured Python module.
16
16
 
@@ -18,6 +18,8 @@ def import_dependency(module_path: str, class_name: str) -> Any:
18
18
  :type module_path: str
19
19
  :param class_name: The class name.
20
20
  :type class_name: str
21
+ :param kwargs: Additional keyword arguments.
22
+ :type kwargs: dict
21
23
  :return: The dependency.
22
24
  :rtype: Any
23
25
  '''
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tiferet
3
- Version: 1.0.0a4
3
+ Version: 1.0.0a6
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
@@ -9,31 +9,31 @@ tiferet/configs/__init__.py,sha256=NfT6XFNcJznOLXjMuNmj3XeaOPVWwbc-N4kVWaVjuD0,8
9
9
  tiferet/configs/app.py,sha256=XMBbwHS2y_Wm-scxVJ2mcAtBy0cRj5e0WLbi1F3R1Q4,299
10
10
  tiferet/contexts/__init__.py,sha256=6ElZETwHoWC-gUEm0XWnXbV_-liIgLGByGh62DO4AY8,140
11
11
  tiferet/contexts/app.py,sha256=MPRFu3ut7DOmc3i3PqLR96ymvWMShW6BUbY9eG8i6Eg,3296
12
- tiferet/contexts/container.py,sha256=zGCGm1lF0mI6AmEa9WK-N_Gwyv1oHSqUCOmLnkqvFyc,4871
13
- tiferet/contexts/env.py,sha256=bbvZzDy075SuKL2ZIfDEE5yD1Hbk-4XLGe4eC_tT8e8,3080
12
+ tiferet/contexts/container.py,sha256=FUZ-JPRj4Y6sEmcZMb_BBGjho93yTzu7Wr4c6gIXADk,5050
13
+ tiferet/contexts/env.py,sha256=yTcymmwo4p-7A8Dg-VJGaYAN7D3Q9yMSQ41MAW9y8lA,3433
14
14
  tiferet/contexts/error.py,sha256=VO3Wgkmf5bdK6LoT0xhQn1WeSAVulQwUhvBAsoUPd1c,2503
15
- tiferet/contexts/feature.py,sha256=u7wEhdfTLeWKIv5i2nzBcu4cAcVkm6iqNNznczPmHjc,2293
15
+ tiferet/contexts/feature.py,sha256=TB1ncuiBKYcMu2eIqbWtenCTjdvPcnHnyYYmmP4_DwI,2654
16
16
  tiferet/contexts/request.py,sha256=TOECa0V1wKuNGCYFIRKxwsZVpLtP0FS_Nm96DaEVsWU,2726
17
17
  tiferet/data/__init__.py,sha256=ts3bkFftArKTgUJj7q65Sob4fC6jOqfYNxm6cqjFr_w,74
18
- tiferet/data/app.py,sha256=8kv7tDJUjl70bqdpiMXXs6e89zDQIvtlDSOq42iyyX0,6312
18
+ tiferet/data/app.py,sha256=GUZz2io__p5wtNB-dwY2TkKBY9y_oJjTHzIZu6BLsoU,9651
19
19
  tiferet/data/container.py,sha256=DMrw-jXTRgRAuxf8zmIftHwQkN9tBxBKj4pmcS7ZpB4,5182
20
- tiferet/data/error.py,sha256=lfGO3SjtsxSv6d7iKDeVw3vXfocCk29g4-uwC3jnaig,2377
20
+ tiferet/data/error.py,sha256=0JUxj1JPP9KWR1dWx5NU0WewWnZ8DSkb-X0V0XlxmWc,1852
21
21
  tiferet/data/feature.py,sha256=s_aqVYhH7VKzXpWM3d-uvSv3_r8A0LgObv3Agg-CKoc,3697
22
22
  tiferet/domain/__init__.py,sha256=uC1lHXzRnpoHqfgPcUraea5F_T1Nsx0wBau0paslsQg,146
23
- tiferet/domain/app.py,sha256=WUTiNHN-1zY7KRxxSuapUKiX56GhgwPccrHT5OaMJAY,8558
23
+ tiferet/domain/app.py,sha256=Okkk8q6CrYjzN_c5GmsMWPuNGukjA25pL62HgwvDDkk,6201
24
24
  tiferet/domain/container.py,sha256=Kw_xNn5_tWghcx3Dl_vPEdwZ2b8u23ZpbgMQ_bkUKaw,3666
25
- tiferet/domain/core.py,sha256=jnf-33uRXrTygYv1aU71Cpf-_4KyN_ES4BodZ7JJq0o,4561
25
+ tiferet/domain/core.py,sha256=iNL5w71FQjbNICSMTZnxFAqWl6b0Cj9V94vBM6NU03Y,4112
26
26
  tiferet/domain/error.py,sha256=myUpdB4rgmbVBwIP8Pa88uastTSjPFGqrSwqR9C-VYg,3371
27
27
  tiferet/domain/feature.py,sha256=RhedOKb8nG1D0J9b_aPVtJc_rQjLXwOpwpIsmzrH21o,4552
28
28
  tiferet/repos/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
29
29
  tiferet/repos/app.py,sha256=0mPPScHy29YIoqYCkTffX3r9OgxvTlGikmfKNV1Yy4M,2767
30
30
  tiferet/repos/container.py,sha256=2Medggn4BZrelnZ-cDZfFFwHaDB80R7iFJ5OF-6E62g,4811
31
- tiferet/repos/error.py,sha256=c3Bs2QTktMuJWGSRF8rKeTN5vFEsaOycUdYD7QSIDEc,4224
32
- tiferet/repos/feature.py,sha256=uR4s-n28J4WCO4Npi6AzOxk5R9I6HuUMHDzoK1Xo_80,4361
31
+ tiferet/repos/error.py,sha256=8CEUd-FVfb4E6_w9gtQcaDv2V95CRZ2mWBRpTHttOcE,4249
32
+ tiferet/repos/feature.py,sha256=Z_S3nQU6wTe6YpXNsqp94EKrPa45w3uL9L93wRCLPHw,4745
33
33
  tiferet/services/__init__.py,sha256=rwaCBwIfhqLkdXage-Q0hl_Ou7MAlGVW1Bg555uAUD8,44
34
- tiferet/services/container.py,sha256=yZU09pziCMz74UIRqiM_gHNqNE4Hml555WEuNoJlEDA,1048
35
- tiferet-1.0.0a4.dist-info/LICENSE,sha256=e8_GutFM0sxbRlgUaeVsGvJ5uE-KvruLApOzIoHy_zU,1513
36
- tiferet-1.0.0a4.dist-info/METADATA,sha256=wQ6c5-Rrgvr1kW7F5h6R-HdrJ-ecYwABZtJNNO2wEKA,422
37
- tiferet-1.0.0a4.dist-info/WHEEL,sha256=R06PA3UVYHThwHvxuRWMqaGcr-PuniXahwjmQRFMEkY,91
38
- tiferet-1.0.0a4.dist-info/top_level.txt,sha256=g19Qw0j_VxPw-fgPF1TMPwbtHjnEhNQs0fa69wJZ6IM,8
39
- tiferet-1.0.0a4.dist-info/RECORD,,
34
+ tiferet/services/container.py,sha256=ISJhkiNLV--nHbAv6Ajd3ug1cGiyazZoePJOCJu5n_s,1130
35
+ tiferet-1.0.0a6.dist-info/LICENSE,sha256=e8_GutFM0sxbRlgUaeVsGvJ5uE-KvruLApOzIoHy_zU,1513
36
+ tiferet-1.0.0a6.dist-info/METADATA,sha256=mIebZDZ0tw4e8dPum3ePSF_f7__cIwvnW8bdybZUnKo,422
37
+ tiferet-1.0.0a6.dist-info/WHEEL,sha256=R06PA3UVYHThwHvxuRWMqaGcr-PuniXahwjmQRFMEkY,91
38
+ tiferet-1.0.0a6.dist-info/top_level.txt,sha256=g19Qw0j_VxPw-fgPF1TMPwbtHjnEhNQs0fa69wJZ6IM,8
39
+ tiferet-1.0.0a6.dist-info/RECORD,,