tiferet 1.0.0a0__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.
- app/__init__.py +0 -0
- app/clients/__init__.py +0 -0
- app/clients/yaml.py +93 -0
- app/commands/__init__.py +0 -0
- app/commands/container.py +54 -0
- app/commands/error.py +21 -0
- app/commands/feature.py +90 -0
- app/configs/__init__.py +69 -0
- app/configs/app.py +16 -0
- app/configs/container.py +91 -0
- app/contexts/__init__.py +2 -0
- app/contexts/app.py +130 -0
- app/contexts/container.py +167 -0
- app/contexts/env.py +109 -0
- app/contexts/error.py +95 -0
- app/contexts/feature.py +79 -0
- app/contexts/request.py +108 -0
- app/data/__init__.py +4 -0
- app/data/app.py +227 -0
- app/data/container.py +179 -0
- app/data/error.py +99 -0
- app/data/feature.py +132 -0
- app/domain/__init__.py +5 -0
- app/domain/app.py +330 -0
- app/domain/container.py +141 -0
- app/domain/core.py +199 -0
- app/domain/error.py +136 -0
- app/domain/feature.py +176 -0
- app/repos/__init__.py +0 -0
- app/repos/app.py +102 -0
- app/repos/container.py +164 -0
- app/repos/error.py +173 -0
- app/repos/feature.py +169 -0
- app/services/__init__.py +4 -0
- app/services/cli.py +186 -0
- app/services/container.py +44 -0
- tiferet-1.0.0a0.dist-info/LICENSE +28 -0
- tiferet-1.0.0a0.dist-info/METADATA +13 -0
- tiferet-1.0.0a0.dist-info/RECORD +41 -0
- tiferet-1.0.0a0.dist-info/WHEEL +5 -0
- tiferet-1.0.0a0.dist-info/top_level.txt +1 -0
app/domain/app.py
ADDED
@@ -0,0 +1,330 @@
|
|
1
|
+
# *** imports
|
2
|
+
|
3
|
+
# ** app
|
4
|
+
from ..configs import *
|
5
|
+
from ..domain import *
|
6
|
+
|
7
|
+
|
8
|
+
# *** models
|
9
|
+
|
10
|
+
# ** model: app_dependency
|
11
|
+
class AppDependency(ModuleDependency):
|
12
|
+
|
13
|
+
# * attribute: attribute_id
|
14
|
+
attribute_id = StringType(
|
15
|
+
required=True,
|
16
|
+
metadata=dict(
|
17
|
+
description='The attribute id for the application dependency.'
|
18
|
+
),
|
19
|
+
)
|
20
|
+
|
21
|
+
# * method: new
|
22
|
+
@staticmethod
|
23
|
+
def new(**kwargs) -> 'AppDependency':
|
24
|
+
'''
|
25
|
+
Initializes a new AppDependency object.
|
26
|
+
|
27
|
+
:param kwargs: Additional keyword arguments.
|
28
|
+
:type kwargs: dict
|
29
|
+
:return: A new AppDependency object.
|
30
|
+
:rtype: AppDependency
|
31
|
+
'''
|
32
|
+
|
33
|
+
# Create and return a new AppDependency object.
|
34
|
+
return super(AppDependency, AppDependency).new(
|
35
|
+
AppDependency,
|
36
|
+
**kwargs
|
37
|
+
)
|
38
|
+
|
39
|
+
# ** model: app_interface
|
40
|
+
class AppInterface(Entity):
|
41
|
+
'''
|
42
|
+
The base application interface object.
|
43
|
+
'''
|
44
|
+
|
45
|
+
# * attribute: name
|
46
|
+
name = StringType(
|
47
|
+
required=True,
|
48
|
+
metadata=dict(
|
49
|
+
description='The name of the application interface.'
|
50
|
+
),
|
51
|
+
)
|
52
|
+
|
53
|
+
# * attribute: description
|
54
|
+
description = StringType(
|
55
|
+
metadata=dict(
|
56
|
+
description='The description of the application interface.'
|
57
|
+
),
|
58
|
+
)
|
59
|
+
|
60
|
+
# attribute: feature_flag
|
61
|
+
feature_flag = StringType(
|
62
|
+
required=True,
|
63
|
+
metadata=dict(
|
64
|
+
description='The feature flag.'
|
65
|
+
),
|
66
|
+
)
|
67
|
+
|
68
|
+
# attribute: data_flag
|
69
|
+
data_flag = StringType(
|
70
|
+
required=True,
|
71
|
+
metadata=dict(
|
72
|
+
description='The data flag.'
|
73
|
+
),
|
74
|
+
)
|
75
|
+
|
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,
|
88
|
+
required=True,
|
89
|
+
default=AppDependency.new(
|
90
|
+
attribute_id='feature_context',
|
91
|
+
module_path='app.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='app.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='app.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='app.repositories.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='app.repositories.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='app.repositories.error',
|
162
|
+
class_name='ErrorRepository',
|
163
|
+
),
|
164
|
+
metadata=dict(
|
165
|
+
description='The error repository dependency.'
|
166
|
+
),
|
167
|
+
)
|
168
|
+
|
169
|
+
# * attribute: constants
|
170
|
+
constants = DictType(
|
171
|
+
StringType,
|
172
|
+
default=dict(
|
173
|
+
container_config_file='app/configs/container.yml',
|
174
|
+
feature_config_file='app/configs/features.yml',
|
175
|
+
error_config_file='app/configs/errors.yml',
|
176
|
+
),
|
177
|
+
metadata=dict(
|
178
|
+
description='The application dependency constants.'
|
179
|
+
),
|
180
|
+
)
|
181
|
+
|
182
|
+
# * method: new
|
183
|
+
@staticmethod
|
184
|
+
def new(**kwargs) -> 'AppInterface':
|
185
|
+
'''
|
186
|
+
Initializes a new AppInterface object.
|
187
|
+
|
188
|
+
:param kwargs: Additional keyword arguments.
|
189
|
+
:type kwargs: dict
|
190
|
+
:return: A new AppInterface object.
|
191
|
+
:rtype: AppInterface
|
192
|
+
'''
|
193
|
+
|
194
|
+
# Create and return a new AppInterface object.
|
195
|
+
return super(AppInterface, AppInterface).new(
|
196
|
+
AppInterface,
|
197
|
+
**kwargs
|
198
|
+
)
|
199
|
+
|
200
|
+
# * method: list_dependencies
|
201
|
+
def get_dependencies(self) -> list:
|
202
|
+
'''
|
203
|
+
Lists the dependencies for the application interface.
|
204
|
+
|
205
|
+
:return: The list of dependencies for the application interface.
|
206
|
+
:rtype: list
|
207
|
+
'''
|
208
|
+
|
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
|
+
|
220
|
+
|
221
|
+
# ** model: app_repository_configuration
|
222
|
+
class AppRepositoryConfiguration(ModuleDependency):
|
223
|
+
'''
|
224
|
+
The import configuration for the application repository.
|
225
|
+
'''
|
226
|
+
|
227
|
+
# * attribute: module_path
|
228
|
+
module_path = StringType(
|
229
|
+
required=True,
|
230
|
+
default='app.repositories.app',
|
231
|
+
metadata=dict(
|
232
|
+
description='The module path for the application repository.'
|
233
|
+
),
|
234
|
+
)
|
235
|
+
|
236
|
+
# * attribute: class_name
|
237
|
+
class_name = StringType(
|
238
|
+
required=True,
|
239
|
+
default='YamlProxy',
|
240
|
+
metadata=dict(
|
241
|
+
description='The class name for the application repository.'
|
242
|
+
),
|
243
|
+
)
|
244
|
+
|
245
|
+
# * attribute: params
|
246
|
+
params = DictType(
|
247
|
+
StringType,
|
248
|
+
default=dict(
|
249
|
+
app_config_file='app/configs/app.yml',
|
250
|
+
),
|
251
|
+
metadata=dict(
|
252
|
+
description='The application repository configuration parameters.'
|
253
|
+
),
|
254
|
+
)
|
255
|
+
|
256
|
+
# * method: new
|
257
|
+
@staticmethod
|
258
|
+
def new(**kwargs) -> 'AppRepositoryConfiguration':
|
259
|
+
'''
|
260
|
+
Initializes a new AppRepositoryConfiguration object.
|
261
|
+
|
262
|
+
:param kwargs: Additional keyword arguments.
|
263
|
+
:type kwargs: dict
|
264
|
+
:return: A new AppRepositoryConfiguration object.
|
265
|
+
:rtype: AppRepositoryConfiguration
|
266
|
+
'''
|
267
|
+
|
268
|
+
# Create and return a new AppRepositoryConfiguration object.
|
269
|
+
return super(AppRepositoryConfiguration, AppRepositoryConfiguration).new(
|
270
|
+
AppRepositoryConfiguration,
|
271
|
+
**kwargs
|
272
|
+
)
|
273
|
+
|
274
|
+
|
275
|
+
# ** model: app_configuration
|
276
|
+
class AppConfiguration(Entity):
|
277
|
+
'''
|
278
|
+
The application configuration object.
|
279
|
+
'''
|
280
|
+
|
281
|
+
# * attribute: name
|
282
|
+
name = StringType(
|
283
|
+
required=True,
|
284
|
+
metadata=dict(
|
285
|
+
description='The name of the application.'
|
286
|
+
)
|
287
|
+
)
|
288
|
+
|
289
|
+
# * attribute: description
|
290
|
+
description = StringType(
|
291
|
+
metadata=dict(
|
292
|
+
description='The description of the application.'
|
293
|
+
)
|
294
|
+
)
|
295
|
+
|
296
|
+
# * attribute: app_repo
|
297
|
+
app_repo = ModelType(AppRepositoryConfiguration,
|
298
|
+
required=True,
|
299
|
+
metadata=dict(
|
300
|
+
description='The application repository configuration.'
|
301
|
+
),
|
302
|
+
)
|
303
|
+
|
304
|
+
# * attribute: interfaces
|
305
|
+
interfaces = ListType(
|
306
|
+
ModelType(AppInterface),
|
307
|
+
required=True,
|
308
|
+
default=[],
|
309
|
+
metadata=dict(
|
310
|
+
description='The application interfaces.'
|
311
|
+
)
|
312
|
+
)
|
313
|
+
|
314
|
+
# * method: new
|
315
|
+
@staticmethod
|
316
|
+
def new(**kwargs) -> 'AppConfiguration':
|
317
|
+
'''
|
318
|
+
Initializes a new AppConfiguration object.
|
319
|
+
|
320
|
+
:param kwargs: Additional keyword arguments.
|
321
|
+
:type kwargs: dict
|
322
|
+
:return: A new AppConfiguration object.
|
323
|
+
:rtype: AppConfiguration
|
324
|
+
'''
|
325
|
+
|
326
|
+
# Create and return a new AppConfiguration object.
|
327
|
+
return super(AppConfiguration, AppConfiguration).new(
|
328
|
+
AppConfiguration,
|
329
|
+
**kwargs
|
330
|
+
)
|
app/domain/container.py
ADDED
@@ -0,0 +1,141 @@
|
|
1
|
+
# *** imports
|
2
|
+
|
3
|
+
# ** app
|
4
|
+
from ..domain import *
|
5
|
+
|
6
|
+
# *** constants
|
7
|
+
|
8
|
+
# */ list[str]
|
9
|
+
CONTAINER_ATTRIBUTE_TYPE_CHOICES = [
|
10
|
+
'interface',
|
11
|
+
'feature',
|
12
|
+
'data'
|
13
|
+
]
|
14
|
+
|
15
|
+
|
16
|
+
# *** models
|
17
|
+
|
18
|
+
# ** model: container_depenedency
|
19
|
+
class ContainerDependency(ModuleDependency):
|
20
|
+
'''
|
21
|
+
A container dependency object.
|
22
|
+
'''
|
23
|
+
|
24
|
+
# * attribute: flag
|
25
|
+
flag = t.StringType(
|
26
|
+
required=True,
|
27
|
+
metadata=dict(
|
28
|
+
description='The flag for the container dependency.'
|
29
|
+
)
|
30
|
+
)
|
31
|
+
|
32
|
+
# * attribute: parameters
|
33
|
+
parameters = t.DictType(
|
34
|
+
t.StringType,
|
35
|
+
default={},
|
36
|
+
metadata=dict(
|
37
|
+
description='The container dependency parameters.'
|
38
|
+
)
|
39
|
+
)
|
40
|
+
|
41
|
+
# * method: new
|
42
|
+
@staticmethod
|
43
|
+
def new(**kwargs) -> 'ContainerDependency':
|
44
|
+
'''
|
45
|
+
Initializes a new ContainerDependency object.
|
46
|
+
|
47
|
+
:param kwargs: Additional keyword arguments.
|
48
|
+
:type kwargs: dict
|
49
|
+
:return: A new ContainerDependency object.
|
50
|
+
:rtype: ContainerDependency
|
51
|
+
'''
|
52
|
+
|
53
|
+
# Create and return a new ContainerDependency object.
|
54
|
+
super(ContainerDependency, ContainerDependency).new(
|
55
|
+
ContainerDependency,
|
56
|
+
**kwargs)
|
57
|
+
|
58
|
+
|
59
|
+
# ** model: container_attribute
|
60
|
+
class ContainerAttribute(Entity):
|
61
|
+
'''
|
62
|
+
An attribute that defines container injectior behavior.
|
63
|
+
'''
|
64
|
+
|
65
|
+
# * attribute: id
|
66
|
+
id = t.StringType(
|
67
|
+
required=True,
|
68
|
+
metadata=dict(
|
69
|
+
description='The unique identifier for the container attribute.'
|
70
|
+
)
|
71
|
+
)
|
72
|
+
|
73
|
+
# * attribute: type
|
74
|
+
type = t.StringType(
|
75
|
+
required=True,
|
76
|
+
choices=CONTAINER_ATTRIBUTE_TYPE_CHOICES,
|
77
|
+
metadata=dict(
|
78
|
+
description='The type of container attribute.'
|
79
|
+
)
|
80
|
+
)
|
81
|
+
|
82
|
+
# * attribute: dependencies
|
83
|
+
dependencies = t.ListType(
|
84
|
+
t.ModelType(ContainerDependency),
|
85
|
+
default=[],
|
86
|
+
metadata=dict(
|
87
|
+
description='The container attribute dependencies.'
|
88
|
+
)
|
89
|
+
)
|
90
|
+
|
91
|
+
# * method: new
|
92
|
+
@staticmethod
|
93
|
+
def new(**kwargs) -> 'ContainerAttribute':
|
94
|
+
'''
|
95
|
+
Initializes a new ContainerAttribute object.
|
96
|
+
|
97
|
+
:param kwargs: Additional keyword arguments.
|
98
|
+
:type kwargs: dict
|
99
|
+
:return: A new ContainerAttribute object.
|
100
|
+
:rtype: ContainerAttribute
|
101
|
+
'''
|
102
|
+
|
103
|
+
# Create and return a new ContainerAttribute object.
|
104
|
+
super(ContainerAttribute, ContainerAttribute).new(
|
105
|
+
ContainerAttribute,
|
106
|
+
**kwargs)
|
107
|
+
|
108
|
+
# * method: set_dependency
|
109
|
+
def set_dependency(self, dependency: ContainerDependency):
|
110
|
+
'''
|
111
|
+
Sets a container dependency.
|
112
|
+
|
113
|
+
:param dependency: The container dependency to set.
|
114
|
+
:type dependency: ContainerDependency
|
115
|
+
'''
|
116
|
+
|
117
|
+
# Replace the value of the dependency if a dependency with the same flag exists.
|
118
|
+
for index, _dependency in enumerate(self.dependencies):
|
119
|
+
if _dependency.flag == dependency.flag:
|
120
|
+
self.dependencies[index] = dependency
|
121
|
+
return
|
122
|
+
|
123
|
+
# Append the dependency otherwise.
|
124
|
+
self.dependencies.append(dependency)
|
125
|
+
|
126
|
+
# * method: get_dependency
|
127
|
+
def get_dependency(self, flag: str) -> ContainerDependency:
|
128
|
+
'''
|
129
|
+
Gets a container dependency by flag.
|
130
|
+
|
131
|
+
:param flag: The flag for the container dependency.
|
132
|
+
:type flag: str
|
133
|
+
:return: The container dependency.
|
134
|
+
:rtype: ContainerDependency
|
135
|
+
'''
|
136
|
+
|
137
|
+
# Return the dependency with the matching flag.
|
138
|
+
return next(
|
139
|
+
(dependency for dependency in self.dependencies if dependency.flag == flag),
|
140
|
+
None
|
141
|
+
)
|
app/domain/core.py
ADDED
@@ -0,0 +1,199 @@
|
|
1
|
+
# *** imports
|
2
|
+
|
3
|
+
# ** core
|
4
|
+
from typing import Any
|
5
|
+
|
6
|
+
# ** infra
|
7
|
+
from schematics import Model
|
8
|
+
|
9
|
+
# ** app
|
10
|
+
from ..configs import *
|
11
|
+
|
12
|
+
|
13
|
+
# *** models
|
14
|
+
|
15
|
+
# ** model: model_object
|
16
|
+
class ModelObject(Model):
|
17
|
+
'''
|
18
|
+
A domain model object.
|
19
|
+
'''
|
20
|
+
|
21
|
+
# * method: new
|
22
|
+
@staticmethod
|
23
|
+
def new(
|
24
|
+
model_type: type,
|
25
|
+
validate: bool = True,
|
26
|
+
strict: bool = True,
|
27
|
+
**kwargs
|
28
|
+
) -> Any:
|
29
|
+
'''
|
30
|
+
Initializes a new model object.
|
31
|
+
|
32
|
+
:param model_type: The type of model object to create.
|
33
|
+
:type model_type: type
|
34
|
+
:param validate: True to validate the model object.
|
35
|
+
:type validate: bool
|
36
|
+
:param strict: True to enforce strict mode for the model object.
|
37
|
+
:type strict: bool
|
38
|
+
:param kwargs: Keyword arguments.
|
39
|
+
:type kwargs: dict
|
40
|
+
:return: A new model object.
|
41
|
+
:rtype: Any
|
42
|
+
'''
|
43
|
+
|
44
|
+
# Create a new model object.
|
45
|
+
_object = model_type(dict(
|
46
|
+
**kwargs
|
47
|
+
), strict=strict)
|
48
|
+
|
49
|
+
# Validate if specified.
|
50
|
+
if validate:
|
51
|
+
_object.validate()
|
52
|
+
|
53
|
+
# Return the new model object.
|
54
|
+
return _object
|
55
|
+
|
56
|
+
|
57
|
+
# ** model: entity
|
58
|
+
class Entity(ModelObject):
|
59
|
+
'''
|
60
|
+
A domain model entity.
|
61
|
+
'''
|
62
|
+
|
63
|
+
# ** attribute: id
|
64
|
+
id = StringType(
|
65
|
+
required=True,
|
66
|
+
metadata=dict(
|
67
|
+
description='The entity unique identifier.'
|
68
|
+
)
|
69
|
+
)
|
70
|
+
|
71
|
+
|
72
|
+
# ** model: value_object
|
73
|
+
class ValueObject(ModelObject):
|
74
|
+
'''
|
75
|
+
A domain model value object.
|
76
|
+
'''
|
77
|
+
|
78
|
+
pass
|
79
|
+
|
80
|
+
|
81
|
+
# ** model: data_object
|
82
|
+
class DataObject(Model):
|
83
|
+
'''
|
84
|
+
A data representation object.
|
85
|
+
'''
|
86
|
+
|
87
|
+
# ** method: map
|
88
|
+
def map(self,
|
89
|
+
type: ModelObject,
|
90
|
+
role: str = 'to_model',
|
91
|
+
**kwargs
|
92
|
+
) -> ModelObject:
|
93
|
+
'''
|
94
|
+
Maps the model data to a model object.
|
95
|
+
|
96
|
+
:param type: The type of model object to map to.
|
97
|
+
:type type: type
|
98
|
+
:param role: The role for the mapping.
|
99
|
+
:type role: str
|
100
|
+
:param kwargs: Additional keyword arguments for mapping.
|
101
|
+
:type kwargs: dict
|
102
|
+
:return: A new model object.
|
103
|
+
:rtype: ModelObject
|
104
|
+
'''
|
105
|
+
|
106
|
+
# Get primitive of the model data and merge with the keyword arguments.
|
107
|
+
# Give priority to the keyword arguments.
|
108
|
+
_data = self.to_primitive(role=role)
|
109
|
+
for key, value in kwargs.items():
|
110
|
+
_data[key] = value
|
111
|
+
|
112
|
+
# Map the data object to a model object.
|
113
|
+
_object = type.new(**_data, strict=False)
|
114
|
+
|
115
|
+
# Return the model data.
|
116
|
+
return _object
|
117
|
+
|
118
|
+
# ** method: from_model
|
119
|
+
@staticmethod
|
120
|
+
def from_model(
|
121
|
+
model: ModelObject,
|
122
|
+
**kwargs
|
123
|
+
) -> 'DataObject':
|
124
|
+
'''
|
125
|
+
Initializes a new data object from a model object.
|
126
|
+
|
127
|
+
:param model: The type of model object to map from.
|
128
|
+
:type model: type
|
129
|
+
:param kwargs: Keyword arguments.
|
130
|
+
:type kwargs: dict
|
131
|
+
:return: A new data object.
|
132
|
+
:rtype: DataObject
|
133
|
+
'''
|
134
|
+
|
135
|
+
# Create a new data object.
|
136
|
+
return DataObject(
|
137
|
+
model.new(**kwargs, strict=False),
|
138
|
+
strict=False,
|
139
|
+
)
|
140
|
+
|
141
|
+
# ** method: allow
|
142
|
+
@staticmethod
|
143
|
+
def allow(*args) -> Any:
|
144
|
+
|
145
|
+
# Create a whitelist transform.
|
146
|
+
# Create a wholelist transform if no arguments are specified.
|
147
|
+
from schematics.transforms import whitelist, wholelist
|
148
|
+
if args:
|
149
|
+
return whitelist(*args)
|
150
|
+
return wholelist()
|
151
|
+
|
152
|
+
# ** method: deny
|
153
|
+
@staticmethod
|
154
|
+
def deny(*args) -> Any:
|
155
|
+
|
156
|
+
# Create a blacklist transform.
|
157
|
+
from schematics.transforms import blacklist
|
158
|
+
return blacklist(*args)
|
159
|
+
|
160
|
+
|
161
|
+
# ** model: module_dependency
|
162
|
+
class ModuleDependency(Model):
|
163
|
+
'''
|
164
|
+
A module dependency.
|
165
|
+
'''
|
166
|
+
|
167
|
+
# * attribute: module_path
|
168
|
+
module_path = StringType(
|
169
|
+
required=True,
|
170
|
+
metadata=dict(
|
171
|
+
description='The module path.'
|
172
|
+
)
|
173
|
+
)
|
174
|
+
|
175
|
+
# ** attribute: class_name
|
176
|
+
class_name = StringType(
|
177
|
+
required=True,
|
178
|
+
metadata=dict(
|
179
|
+
description='The class name.'
|
180
|
+
)
|
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 super(ModuleDependency, ModuleDependency).new(
|
197
|
+
ModuleDependency,
|
198
|
+
**kwargs
|
199
|
+
)
|