tiferet 1.0.0a19__py3-none-any.whl → 1.0.0b0__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/__init__.py +3 -2
- tiferet/commands/__init__.py +6 -0
- tiferet/commands/app.py +102 -0
- tiferet/commands/core.py +124 -0
- tiferet/commands/dependencies.py +76 -0
- tiferet/commands/settings.py +101 -0
- tiferet/configs/__init__.py +3 -67
- tiferet/configs/error.py +48 -0
- tiferet/configs/settings.py +37 -0
- tiferet/contexts/__init__.py +0 -8
- tiferet/contexts/app.py +215 -182
- tiferet/contexts/cache.py +76 -0
- tiferet/contexts/container.py +92 -190
- tiferet/contexts/error.py +78 -80
- tiferet/contexts/feature.py +120 -83
- tiferet/contracts/__init__.py +4 -0
- tiferet/contracts/app.py +92 -0
- tiferet/contracts/cache.py +70 -0
- tiferet/contracts/container.py +147 -0
- tiferet/contracts/error.py +177 -0
- tiferet/contracts/feature.py +159 -0
- tiferet/contracts/settings.py +34 -0
- tiferet/data/__init__.py +3 -4
- tiferet/data/app.py +71 -208
- tiferet/data/container.py +52 -38
- tiferet/data/error.py +15 -24
- tiferet/data/feature.py +27 -8
- tiferet/{domain/core.py → data/settings.py} +36 -96
- tiferet/handlers/__init__.py +0 -0
- tiferet/handlers/container.py +116 -0
- tiferet/handlers/error.py +49 -0
- tiferet/handlers/feature.py +94 -0
- tiferet/models/__init__.py +4 -0
- tiferet/models/app.py +150 -0
- tiferet/models/container.py +135 -0
- tiferet/{domain → models}/error.py +86 -36
- tiferet/{domain → models}/feature.py +107 -47
- tiferet/models/settings.py +148 -0
- tiferet/proxies/__init__.py +0 -0
- tiferet/proxies/yaml/__init__.py +0 -0
- tiferet/{repos → proxies/yaml}/app.py +13 -41
- tiferet/{repos → proxies/yaml}/container.py +26 -56
- tiferet/{repos → proxies/yaml}/error.py +11 -70
- tiferet/proxies/yaml/feature.py +92 -0
- {tiferet-1.0.0a19.dist-info → tiferet-1.0.0b0.dist-info}/METADATA +12 -3
- tiferet-1.0.0b0.dist-info/RECORD +51 -0
- {tiferet-1.0.0a19.dist-info → tiferet-1.0.0b0.dist-info}/WHEEL +1 -1
- tiferet/commands/container.py +0 -54
- tiferet/commands/error.py +0 -21
- tiferet/commands/feature.py +0 -90
- tiferet/contexts/request.py +0 -110
- tiferet/domain/__init__.py +0 -5
- tiferet/domain/app.py +0 -131
- tiferet/domain/container.py +0 -141
- tiferet/repos/__init__.py +0 -7
- tiferet/repos/feature.py +0 -151
- tiferet-1.0.0a19.dist-info/RECORD +0 -35
- {tiferet-1.0.0a19.dist-info → tiferet-1.0.0b0.dist-info/licenses}/LICENSE +0 -0
- {tiferet-1.0.0a19.dist-info → tiferet-1.0.0b0.dist-info}/top_level.txt +0 -0
tiferet/commands/container.py
DELETED
@@ -1,54 +0,0 @@
|
|
1
|
-
from ..repos.container import ContainerRepository
|
2
|
-
from ..domain.container import ContainerAttribute, ContainerDependency
|
3
|
-
from ..services import container as container_service
|
4
|
-
|
5
|
-
|
6
|
-
class SetContainerAttribute(object):
|
7
|
-
'''
|
8
|
-
Command to set a new container attribute
|
9
|
-
'''
|
10
|
-
|
11
|
-
container_repo: ContainerRepository
|
12
|
-
|
13
|
-
def __init__(self, container_repo: ContainerRepository):
|
14
|
-
'''
|
15
|
-
Initialize the command to set a new container attribute.
|
16
|
-
|
17
|
-
:param container_repo: The container repository.
|
18
|
-
:type container_repo: ContainerRepository
|
19
|
-
'''
|
20
|
-
|
21
|
-
self.container_repo = container_repo
|
22
|
-
|
23
|
-
def execute(self, attribute_id: str, type: str, **kwargs):
|
24
|
-
'''
|
25
|
-
Execute the command to set a new container attribute.
|
26
|
-
|
27
|
-
:param attribute_id: The attribute id.
|
28
|
-
:type attribute_id: str
|
29
|
-
:param type: The attribute type.
|
30
|
-
:type type: str
|
31
|
-
:param kwargs: Additional keyword arguments.
|
32
|
-
:type kwargs: dict
|
33
|
-
'''
|
34
|
-
|
35
|
-
# Look up the container attribute.
|
36
|
-
attribute: ContainerAttribute = self.container_repo.get_attribute(attribute_id, type)
|
37
|
-
|
38
|
-
# If not attribute is found, create a new one.
|
39
|
-
if not attribute:
|
40
|
-
attribute = ContainerAttribute.new(
|
41
|
-
id=attribute_id,
|
42
|
-
type=type,
|
43
|
-
dependencies=[ContainerDependency.new(**kwargs)])
|
44
|
-
|
45
|
-
# Otherwise, create the container depenedency and add it to the attribute.
|
46
|
-
else:
|
47
|
-
dependency = ContainerDependency.new(**kwargs)
|
48
|
-
attribute.set_dependency(dependency)
|
49
|
-
|
50
|
-
# Save the container attribute.
|
51
|
-
self.container_repo.save_attribute(attribute=attribute)
|
52
|
-
|
53
|
-
# Return the new container attribute.
|
54
|
-
return attribute
|
tiferet/commands/error.py
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
from ..domain.error import Error
|
2
|
-
from ..repos.error import ErrorRepository
|
3
|
-
|
4
|
-
class AddNewError(object):
|
5
|
-
|
6
|
-
def __init__(self, error_repo: ErrorRepository):
|
7
|
-
self.error_repo = error_repo
|
8
|
-
|
9
|
-
def execute(self, **kwargs) -> Error:
|
10
|
-
|
11
|
-
# Create a new error.
|
12
|
-
error: Error = Error.new(**kwargs)
|
13
|
-
|
14
|
-
# Assert that the error does not already exist.
|
15
|
-
assert not self.error_repo.exists(error.id), f'ERROR_ALREADY_EXISTS: {error.id}'
|
16
|
-
|
17
|
-
# Save the error.
|
18
|
-
self.error_repo.save(error)
|
19
|
-
|
20
|
-
# Return the new error.
|
21
|
-
return error
|
tiferet/commands/feature.py
DELETED
@@ -1,90 +0,0 @@
|
|
1
|
-
from ..domain.feature import Feature
|
2
|
-
from ..domain.feature import FeatureHandler
|
3
|
-
from ..repos.feature import FeatureRepository
|
4
|
-
|
5
|
-
|
6
|
-
class AddNewFeature(object):
|
7
|
-
'''
|
8
|
-
Add a new feature.
|
9
|
-
'''
|
10
|
-
|
11
|
-
def __init__(self, feature_repo: FeatureRepository):
|
12
|
-
'''
|
13
|
-
Initialize the command.
|
14
|
-
|
15
|
-
:param feature_repo: The feature repository.
|
16
|
-
:type feature_repo: FeatureRepository
|
17
|
-
'''
|
18
|
-
|
19
|
-
# Set the feature repository.
|
20
|
-
self.feature_repo = feature_repo
|
21
|
-
|
22
|
-
def execute(self, **kwargs) -> Feature:
|
23
|
-
'''
|
24
|
-
Execute the command to add a new feature.
|
25
|
-
|
26
|
-
:param kwargs: The keyword arguments.
|
27
|
-
:type kwargs: dict
|
28
|
-
:return: The new feature.
|
29
|
-
'''
|
30
|
-
|
31
|
-
# Create a new feature.
|
32
|
-
feature = Feature.new(**kwargs)
|
33
|
-
|
34
|
-
# Assert that the feature does not already exist.
|
35
|
-
assert not self.feature_repo.exists(
|
36
|
-
feature.id), f'FEATURE_ALREADY_EXISTS: {feature.id}'
|
37
|
-
|
38
|
-
# Save and return the feature.
|
39
|
-
self.feature_repo.save(feature)
|
40
|
-
return feature
|
41
|
-
|
42
|
-
|
43
|
-
class AddFeatureHandler(object):
|
44
|
-
'''
|
45
|
-
Adds a feature handler to a feature.
|
46
|
-
'''
|
47
|
-
|
48
|
-
def __init__(self, feature_repo: FeatureRepository):
|
49
|
-
'''
|
50
|
-
Initialize the command.
|
51
|
-
|
52
|
-
:param feature_repo: The feature repository.
|
53
|
-
:type feature_repo: FeatureRepository
|
54
|
-
'''
|
55
|
-
|
56
|
-
# Set the feature repository.
|
57
|
-
self.feature_repo = feature_repo
|
58
|
-
|
59
|
-
def execute(self, feature_id: str, position: int = None, **kwargs):
|
60
|
-
'''
|
61
|
-
Execute the command to add a feature handler to a feature.
|
62
|
-
|
63
|
-
:param feature_id: The feature ID.
|
64
|
-
:type feature_id: str
|
65
|
-
:param position: The position of the handler.
|
66
|
-
:type position: int
|
67
|
-
:param kwargs: Additional keyword arguments.
|
68
|
-
:type kwargs: dict
|
69
|
-
:return: The updated feature.
|
70
|
-
:rtype: Feature
|
71
|
-
'''
|
72
|
-
|
73
|
-
# Create a new feature handler instance.
|
74
|
-
handler = FeatureHandler.new(**kwargs)
|
75
|
-
|
76
|
-
# Get the feature using the feature ID.
|
77
|
-
feature = self.feature_repo.get(feature_id)
|
78
|
-
|
79
|
-
# Assert that the feature was successfully found.
|
80
|
-
assert feature is not None, f'FEATURE_NOT_FOUND: {feature_id}'
|
81
|
-
|
82
|
-
# Add the feature handler to the feature.
|
83
|
-
feature.add_handler(
|
84
|
-
handler,
|
85
|
-
position=position
|
86
|
-
)
|
87
|
-
|
88
|
-
# Save and return the feature.
|
89
|
-
self.feature_repo.save(feature)
|
90
|
-
return feature
|
tiferet/contexts/request.py
DELETED
@@ -1,110 +0,0 @@
|
|
1
|
-
# *** imports
|
2
|
-
|
3
|
-
# ** core
|
4
|
-
from typing import Dict
|
5
|
-
|
6
|
-
# ** app
|
7
|
-
from ..domain import *
|
8
|
-
|
9
|
-
|
10
|
-
# *** contexts
|
11
|
-
|
12
|
-
# ** context: request_context
|
13
|
-
class RequestContext(Model):
|
14
|
-
'''
|
15
|
-
The context for an application request.
|
16
|
-
'''
|
17
|
-
|
18
|
-
# * attribute: feature_id
|
19
|
-
feature_id = StringType(
|
20
|
-
required=True,
|
21
|
-
metadata=dict(
|
22
|
-
description='The feature identifier for the request.'
|
23
|
-
)
|
24
|
-
)
|
25
|
-
|
26
|
-
# * attribute: headers
|
27
|
-
headers = DictType(
|
28
|
-
StringType(),
|
29
|
-
metadata=dict(
|
30
|
-
description='The request headers.'
|
31
|
-
)
|
32
|
-
)
|
33
|
-
|
34
|
-
# * attribute: data
|
35
|
-
data = DictType(
|
36
|
-
StringType(),
|
37
|
-
metadata=dict(
|
38
|
-
description='The request data.'
|
39
|
-
)
|
40
|
-
)
|
41
|
-
|
42
|
-
# * attribute: result
|
43
|
-
result = StringType(
|
44
|
-
metadata=dict(
|
45
|
-
description='The request result.'
|
46
|
-
)
|
47
|
-
)
|
48
|
-
|
49
|
-
# * method: init
|
50
|
-
def __init__(self, feature_id: str, headers: Dict[str, str], data: Dict[str, str]):
|
51
|
-
'''
|
52
|
-
Initialize the request context object.
|
53
|
-
|
54
|
-
:param feature_id: The feature identifier.
|
55
|
-
:type feature_id: str
|
56
|
-
:param headers: The request headers.
|
57
|
-
:type headers: dict
|
58
|
-
:param data: The request data.
|
59
|
-
:type data: dict
|
60
|
-
:param kwargs: Additional keyword arguments.
|
61
|
-
:type kwargs: dict
|
62
|
-
'''
|
63
|
-
|
64
|
-
# Set the context attributes.
|
65
|
-
super().__init__(dict(
|
66
|
-
feature_id=feature_id,
|
67
|
-
headers=headers,
|
68
|
-
data=data
|
69
|
-
))
|
70
|
-
|
71
|
-
# Validate the context.
|
72
|
-
self.validate()
|
73
|
-
|
74
|
-
# * method: set_result
|
75
|
-
def set_result(self, result: Any):
|
76
|
-
'''
|
77
|
-
Set the serialized result value.
|
78
|
-
|
79
|
-
:param result: The result object.
|
80
|
-
:type result: Any
|
81
|
-
'''
|
82
|
-
|
83
|
-
# Import the json module.
|
84
|
-
import json
|
85
|
-
|
86
|
-
# Set the result as a serialized empty dictionary if it is None.
|
87
|
-
if not result:
|
88
|
-
self.result = json.dumps({})
|
89
|
-
return
|
90
|
-
|
91
|
-
# If the result is a Model, convert it to a primitive dictionary and serialize it.
|
92
|
-
if isinstance(result, Model):
|
93
|
-
self.result = json.dumps(result.to_primitive())
|
94
|
-
return
|
95
|
-
|
96
|
-
# If the result is not a list, it must be a dict, so serialize it and set it.
|
97
|
-
if type(result) != list:
|
98
|
-
self.result = json.dumps(result)
|
99
|
-
return
|
100
|
-
|
101
|
-
# If the result is a list, convert each item to a primitive dictionary.
|
102
|
-
result_list = []
|
103
|
-
for item in result:
|
104
|
-
if isinstance(item, Model):
|
105
|
-
result_list.append(item.to_primitive())
|
106
|
-
else:
|
107
|
-
result_list.append(item)
|
108
|
-
|
109
|
-
# Serialize the result and set it.
|
110
|
-
self.result = json.dumps(result_list)
|
tiferet/domain/__init__.py
DELETED
tiferet/domain/app.py
DELETED
@@ -1,131 +0,0 @@
|
|
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
|
-
default='core',
|
64
|
-
metadata=dict(
|
65
|
-
description='The feature flag.'
|
66
|
-
),
|
67
|
-
)
|
68
|
-
|
69
|
-
# attribute: data_flag
|
70
|
-
data_flag = StringType(
|
71
|
-
required=True,
|
72
|
-
metadata=dict(
|
73
|
-
description='The data flag.'
|
74
|
-
),
|
75
|
-
)
|
76
|
-
|
77
|
-
# * attribute: dependencies
|
78
|
-
dependencies = ListType(
|
79
|
-
ModelType(AppDependency),
|
80
|
-
required=True,
|
81
|
-
default=[],
|
82
|
-
metadata=dict(
|
83
|
-
description='The application interface dependencies.'
|
84
|
-
),
|
85
|
-
)
|
86
|
-
|
87
|
-
# * attribute: constants
|
88
|
-
constants = DictType(
|
89
|
-
StringType,
|
90
|
-
default=dict(
|
91
|
-
container_config_file='app/configs/container.yml',
|
92
|
-
feature_config_file='app/configs/features.yml',
|
93
|
-
error_config_file='app/configs/errors.yml',
|
94
|
-
),
|
95
|
-
metadata=dict(
|
96
|
-
description='The application dependency constants.'
|
97
|
-
),
|
98
|
-
)
|
99
|
-
|
100
|
-
# * method: new
|
101
|
-
@staticmethod
|
102
|
-
def new(**kwargs) -> 'AppInterface':
|
103
|
-
'''
|
104
|
-
Initializes a new AppInterface object.
|
105
|
-
|
106
|
-
:param kwargs: Additional keyword arguments.
|
107
|
-
:type kwargs: dict
|
108
|
-
:return: A new AppInterface object.
|
109
|
-
:rtype: AppInterface
|
110
|
-
'''
|
111
|
-
|
112
|
-
# Create and return a new AppInterface object.
|
113
|
-
return super(AppInterface, AppInterface).new(
|
114
|
-
AppInterface,
|
115
|
-
**kwargs
|
116
|
-
)
|
117
|
-
|
118
|
-
# * method: get_dependency
|
119
|
-
def get_dependency(self, attribute_id: str) -> AppDependency:
|
120
|
-
'''
|
121
|
-
Get the dependency by attribute id.
|
122
|
-
|
123
|
-
:param attribute_id: The attribute id of the dependency.
|
124
|
-
:type attribute_id: str
|
125
|
-
:return: The dependency.
|
126
|
-
:rtype: AppDependency
|
127
|
-
'''
|
128
|
-
|
129
|
-
# Get the dependency by attribute id.
|
130
|
-
return next((dep for dep in self.dependencies if dep.attribute_id == attribute_id), None)
|
131
|
-
|
tiferet/domain/container.py
DELETED
@@ -1,141 +0,0 @@
|
|
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 = StringType(
|
26
|
-
required=True,
|
27
|
-
metadata=dict(
|
28
|
-
description='The flag for the container dependency.'
|
29
|
-
)
|
30
|
-
)
|
31
|
-
|
32
|
-
# * attribute: parameters
|
33
|
-
parameters = DictType(
|
34
|
-
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
|
-
return 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 = StringType(
|
67
|
-
required=True,
|
68
|
-
metadata=dict(
|
69
|
-
description='The unique identifier for the container attribute.'
|
70
|
-
)
|
71
|
-
)
|
72
|
-
|
73
|
-
# * attribute: type
|
74
|
-
type = 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 = ListType(
|
84
|
-
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
|
-
return super(ContainerAttribute, ContainerAttribute).new(
|
105
|
-
ContainerAttribute,
|
106
|
-
**kwargs)
|
107
|
-
|
108
|
-
# * method: get_dependency
|
109
|
-
def get_dependency(self, flag: str) -> ContainerDependency:
|
110
|
-
'''
|
111
|
-
Gets a container dependency by flag.
|
112
|
-
|
113
|
-
:param flag: The flag for the container dependency.
|
114
|
-
:type flag: str
|
115
|
-
:return: The container dependency.
|
116
|
-
:rtype: ContainerDependency
|
117
|
-
'''
|
118
|
-
|
119
|
-
# Return the dependency with the matching flag.
|
120
|
-
return next(
|
121
|
-
(dependency for dependency in self.dependencies if dependency.flag == flag),
|
122
|
-
None
|
123
|
-
)
|
124
|
-
|
125
|
-
# * method: set_dependency
|
126
|
-
def set_dependency(self, dependency: ContainerDependency):
|
127
|
-
'''
|
128
|
-
Sets a container dependency.
|
129
|
-
|
130
|
-
:param dependency: The container dependency to set.
|
131
|
-
:type dependency: ContainerDependency
|
132
|
-
'''
|
133
|
-
|
134
|
-
# Replace the value of the dependency if a dependency with the same flag exists.
|
135
|
-
for index, _dependency in enumerate(self.dependencies):
|
136
|
-
if _dependency.flag == dependency.flag:
|
137
|
-
self.dependencies[index] = dependency
|
138
|
-
return
|
139
|
-
|
140
|
-
# Append the dependency otherwise.
|
141
|
-
self.dependencies.append(dependency)
|