tiferet 1.0.0a2__py3-none-any.whl → 1.0.0a4__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 +1 -0
- tiferet/clients/__init__.py +1 -0
- tiferet/contexts/__init__.py +4 -2
- tiferet/data/container.py +2 -2
- tiferet/domain/app.py +6 -6
- tiferet/domain/core.py +2 -3
- tiferet/repos/app.py +5 -4
- tiferet/services/__init__.py +1 -4
- {tiferet-1.0.0a2.dist-info → tiferet-1.0.0a4.dist-info}/METADATA +2 -1
- {tiferet-1.0.0a2.dist-info → tiferet-1.0.0a4.dist-info}/RECORD +13 -14
- tiferet/services/cli.py +0 -186
- {tiferet-1.0.0a2.dist-info → tiferet-1.0.0a4.dist-info}/LICENSE +0 -0
- {tiferet-1.0.0a2.dist-info → tiferet-1.0.0a4.dist-info}/WHEEL +0 -0
- {tiferet-1.0.0a2.dist-info → tiferet-1.0.0a4.dist-info}/top_level.txt +0 -0
tiferet/__init__.py
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
from .contexts import *
|
tiferet/clients/__init__.py
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
from . import yaml as yaml_client
|
tiferet/contexts/__init__.py
CHANGED
tiferet/data/container.py
CHANGED
@@ -36,7 +36,7 @@ class ContainerDependencyYamlData(ContainerDependency, DataObject):
|
|
36
36
|
parameters = DictType(
|
37
37
|
StringType,
|
38
38
|
default={},
|
39
|
-
|
39
|
+
serialized_name='params',
|
40
40
|
deserialize_from=['params'],
|
41
41
|
metadata=dict(
|
42
42
|
description='The parameters need to now account for new data names in the YAML format.'
|
@@ -117,7 +117,7 @@ class ContainerAttributeYamlData(ContainerAttribute, DataObject):
|
|
117
117
|
dependencies = DictType(
|
118
118
|
ModelType(ContainerDependencyYamlData),
|
119
119
|
default=[],
|
120
|
-
|
120
|
+
serialized_name='deps',
|
121
121
|
deserialize_from=['deps', 'dependencies'],
|
122
122
|
metadata=dict(
|
123
123
|
description='The dependencies are now a key-value pair keyed by the flags.'
|
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
|
35
|
-
AppDependency,
|
36
|
-
|
34
|
+
return AppDependency(
|
35
|
+
super(AppDependency, AppDependency).new(**kwargs),
|
36
|
+
strict=False,
|
37
37
|
)
|
38
38
|
|
39
39
|
# ** model: app_interface
|
@@ -266,9 +266,9 @@ class AppRepositoryConfiguration(ModuleDependency):
|
|
266
266
|
'''
|
267
267
|
|
268
268
|
# Create and return a new AppRepositoryConfiguration object.
|
269
|
-
return
|
270
|
-
AppRepositoryConfiguration,
|
271
|
-
|
269
|
+
return AppRepositoryConfiguration(
|
270
|
+
super(AppRepositoryConfiguration, AppRepositoryConfiguration).new(**kwargs),
|
271
|
+
strict=False,
|
272
272
|
)
|
273
273
|
|
274
274
|
|
tiferet/domain/core.py
CHANGED
tiferet/repos/app.py
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
# ** app
|
4
4
|
from ..domain.app import AppInterface
|
5
|
-
from ..data.app import
|
5
|
+
from ..data.app import AppInterfaceYamlData
|
6
6
|
from ..clients import yaml as yaml_client
|
7
7
|
|
8
8
|
|
@@ -72,9 +72,10 @@ class YamlProxy(object):
|
|
72
72
|
interfaces = yaml_client.load(
|
73
73
|
self.config_file,
|
74
74
|
create_data=lambda data: [
|
75
|
-
|
75
|
+
AppInterfaceYamlData.new(
|
76
|
+
id=interface_id,
|
76
77
|
**record
|
77
|
-
).map() for record in data],
|
78
|
+
).map() for interface_id, record in data.items()],
|
78
79
|
start_node=lambda data: data.get('interfaces'))
|
79
80
|
|
80
81
|
# Return the list of app interface objects.
|
@@ -94,7 +95,7 @@ class YamlProxy(object):
|
|
94
95
|
# Load the app interface data from the yaml configuration file.
|
95
96
|
_data: AppInterface = yaml_client.load(
|
96
97
|
self.config_file,
|
97
|
-
create_data=lambda data:
|
98
|
+
create_data=lambda data: AppInterfaceYamlData.new (
|
98
99
|
id=id, **data),
|
99
100
|
start_node=lambda data: data.get('interfaces').get(id))
|
100
101
|
|
tiferet/services/__init__.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: tiferet
|
3
|
-
Version: 1.0.
|
3
|
+
Version: 1.0.0a4
|
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
|
@@ -10,4 +10,5 @@ License: BSD 3
|
|
10
10
|
License-File: LICENSE
|
11
11
|
Requires-Dist: schematics >=2.1.1
|
12
12
|
Requires-Dist: pyyaml >=6.0.1
|
13
|
+
Requires-Dist: dependencies >=7.7.0
|
13
14
|
|
@@ -1,5 +1,5 @@
|
|
1
|
-
tiferet/__init__.py,sha256=
|
2
|
-
tiferet/clients/__init__.py,sha256=
|
1
|
+
tiferet/__init__.py,sha256=XtrOOpLk8fjC_CY-UZFmzYQ6Q9mL73D_6scuWpEJXZU,23
|
2
|
+
tiferet/clients/__init__.py,sha256=hSa_PgXM2jw9iVRrJH_SQUlSVISK-T4tTfgRKnXKkzA,33
|
3
3
|
tiferet/clients/yaml.py,sha256=-Eo8PX2oPpVxv1c-cpkNOrGhxx9T7XPYoAyGi1DxMi4,2454
|
4
4
|
tiferet/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
5
5
|
tiferet/commands/container.py,sha256=L2IKJqEbRglw_LC144oYAkARr2Rixj8IFuC6Ro1jAqA,1789
|
@@ -7,7 +7,7 @@ tiferet/commands/error.py,sha256=ixMYH0yrEWlMAVGDSRke3IGoWaOShfmiXntrUC2b3wY,573
|
|
7
7
|
tiferet/commands/feature.py,sha256=tXa-MDf14ByIJqwQFeSUu2QLUjHPdsyvFNhj1XeaQVk,2507
|
8
8
|
tiferet/configs/__init__.py,sha256=NfT6XFNcJznOLXjMuNmj3XeaOPVWwbc-N4kVWaVjuD0,845
|
9
9
|
tiferet/configs/app.py,sha256=XMBbwHS2y_Wm-scxVJ2mcAtBy0cRj5e0WLbi1F3R1Q4,299
|
10
|
-
tiferet/contexts/__init__.py,sha256=
|
10
|
+
tiferet/contexts/__init__.py,sha256=6ElZETwHoWC-gUEm0XWnXbV_-liIgLGByGh62DO4AY8,140
|
11
11
|
tiferet/contexts/app.py,sha256=MPRFu3ut7DOmc3i3PqLR96ymvWMShW6BUbY9eG8i6Eg,3296
|
12
12
|
tiferet/contexts/container.py,sha256=zGCGm1lF0mI6AmEa9WK-N_Gwyv1oHSqUCOmLnkqvFyc,4871
|
13
13
|
tiferet/contexts/env.py,sha256=bbvZzDy075SuKL2ZIfDEE5yD1Hbk-4XLGe4eC_tT8e8,3080
|
@@ -16,25 +16,24 @@ tiferet/contexts/feature.py,sha256=u7wEhdfTLeWKIv5i2nzBcu4cAcVkm6iqNNznczPmHjc,2
|
|
16
16
|
tiferet/contexts/request.py,sha256=TOECa0V1wKuNGCYFIRKxwsZVpLtP0FS_Nm96DaEVsWU,2726
|
17
17
|
tiferet/data/__init__.py,sha256=ts3bkFftArKTgUJj7q65Sob4fC6jOqfYNxm6cqjFr_w,74
|
18
18
|
tiferet/data/app.py,sha256=8kv7tDJUjl70bqdpiMXXs6e89zDQIvtlDSOq42iyyX0,6312
|
19
|
-
tiferet/data/container.py,sha256=
|
19
|
+
tiferet/data/container.py,sha256=DMrw-jXTRgRAuxf8zmIftHwQkN9tBxBKj4pmcS7ZpB4,5182
|
20
20
|
tiferet/data/error.py,sha256=lfGO3SjtsxSv6d7iKDeVw3vXfocCk29g4-uwC3jnaig,2377
|
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=
|
23
|
+
tiferet/domain/app.py,sha256=WUTiNHN-1zY7KRxxSuapUKiX56GhgwPccrHT5OaMJAY,8558
|
24
24
|
tiferet/domain/container.py,sha256=Kw_xNn5_tWghcx3Dl_vPEdwZ2b8u23ZpbgMQ_bkUKaw,3666
|
25
|
-
tiferet/domain/core.py,sha256=
|
25
|
+
tiferet/domain/core.py,sha256=jnf-33uRXrTygYv1aU71Cpf-_4KyN_ES4BodZ7JJq0o,4561
|
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
|
-
tiferet/repos/app.py,sha256=
|
29
|
+
tiferet/repos/app.py,sha256=0mPPScHy29YIoqYCkTffX3r9OgxvTlGikmfKNV1Yy4M,2767
|
30
30
|
tiferet/repos/container.py,sha256=2Medggn4BZrelnZ-cDZfFFwHaDB80R7iFJ5OF-6E62g,4811
|
31
31
|
tiferet/repos/error.py,sha256=c3Bs2QTktMuJWGSRF8rKeTN5vFEsaOycUdYD7QSIDEc,4224
|
32
32
|
tiferet/repos/feature.py,sha256=uR4s-n28J4WCO4Npi6AzOxk5R9I6HuUMHDzoK1Xo_80,4361
|
33
|
-
tiferet/services/__init__.py,sha256=
|
34
|
-
tiferet/services/cli.py,sha256=aqrn7kxqe2xTJWBSs5hDiyD0ND50mPVDIJf_C87YgRk,5364
|
33
|
+
tiferet/services/__init__.py,sha256=rwaCBwIfhqLkdXage-Q0hl_Ou7MAlGVW1Bg555uAUD8,44
|
35
34
|
tiferet/services/container.py,sha256=yZU09pziCMz74UIRqiM_gHNqNE4Hml555WEuNoJlEDA,1048
|
36
|
-
tiferet-1.0.
|
37
|
-
tiferet-1.0.
|
38
|
-
tiferet-1.0.
|
39
|
-
tiferet-1.0.
|
40
|
-
tiferet-1.0.
|
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,,
|
tiferet/services/cli.py
DELETED
@@ -1,186 +0,0 @@
|
|
1
|
-
from typing import List, Dict, Any
|
2
|
-
import argparse
|
3
|
-
|
4
|
-
from ..contexts.request import RequestContext
|
5
|
-
from ..domain.cli import CliInterface
|
6
|
-
from ..domain.cli import CliArgument
|
7
|
-
|
8
|
-
|
9
|
-
def create_argument_data(cli_argument: CliArgument):
|
10
|
-
|
11
|
-
# List fields to be excluded.
|
12
|
-
exclude_fields = ['name_or_flags', 'arg_type', 'to_data']
|
13
|
-
|
14
|
-
# Exclude unneeded fields if the argument contains an action.
|
15
|
-
if cli_argument.action:
|
16
|
-
exclude_fields.append('nargs')
|
17
|
-
exclude_fields.append('type')
|
18
|
-
exclude_fields.append('choices')
|
19
|
-
|
20
|
-
# Set the data type for the argument.
|
21
|
-
if cli_argument.type == 'str':
|
22
|
-
data_type = str
|
23
|
-
elif cli_argument.type == 'int':
|
24
|
-
data_type = int
|
25
|
-
elif cli_argument.type == 'float':
|
26
|
-
data_type = float
|
27
|
-
|
28
|
-
# For each name or flag in the argument,
|
29
|
-
for name in cli_argument.name_or_flags:
|
30
|
-
|
31
|
-
# If the name or flag is a positional argument,
|
32
|
-
if not name.startswith('--'):
|
33
|
-
|
34
|
-
# Remove the required field.
|
35
|
-
exclude_fields.append('required')
|
36
|
-
|
37
|
-
# Assemble the argument data.
|
38
|
-
argument_data = cli_argument.to_primitive()
|
39
|
-
|
40
|
-
# Set the data type.
|
41
|
-
argument_data['type'] = data_type
|
42
|
-
|
43
|
-
# For each field in the excluded fields,
|
44
|
-
for field in exclude_fields:
|
45
|
-
|
46
|
-
# Remove the field from the argument data if it is present.
|
47
|
-
try:
|
48
|
-
del argument_data[field]
|
49
|
-
except KeyError:
|
50
|
-
pass
|
51
|
-
|
52
|
-
# Return the argument data.
|
53
|
-
return argument_data
|
54
|
-
|
55
|
-
|
56
|
-
def create_headers(data: dict):
|
57
|
-
headers = dict(
|
58
|
-
group_id=data.pop('group'),
|
59
|
-
command_id=data.pop('command'),
|
60
|
-
)
|
61
|
-
headers['id'] = f"{headers['group_id']}.{headers['command_id']}".replace(
|
62
|
-
'-', '_')
|
63
|
-
return headers
|
64
|
-
|
65
|
-
|
66
|
-
def create_cli_parser(cli_interface: CliInterface):
|
67
|
-
|
68
|
-
# Format commands into a dictionary lookup by group id.
|
69
|
-
commands = {}
|
70
|
-
for command in cli_interface.commands:
|
71
|
-
group_id = command.group_id
|
72
|
-
if group_id not in commands:
|
73
|
-
commands[group_id] = []
|
74
|
-
commands[group_id].append(command)
|
75
|
-
|
76
|
-
# Create parser.
|
77
|
-
parser = argparse.ArgumentParser()
|
78
|
-
|
79
|
-
# Add command subparsers
|
80
|
-
command_subparsers = parser.add_subparsers(dest='group')
|
81
|
-
for group_id, commands in commands.items():
|
82
|
-
group_name = group_id.replace('_', '-')
|
83
|
-
command_subparser = command_subparsers.add_parser(
|
84
|
-
group_name)
|
85
|
-
subcommand_subparsers = command_subparser.add_subparsers(
|
86
|
-
dest='command')
|
87
|
-
for command in commands:
|
88
|
-
command_name = command.id.split('.')[-1].replace('_', '-')
|
89
|
-
subcommand_subparser = subcommand_subparsers.add_parser(
|
90
|
-
command_name)
|
91
|
-
for argument in command.arguments:
|
92
|
-
subcommand_subparser.add_argument(
|
93
|
-
*argument.name_or_flags, **create_argument_data(argument))
|
94
|
-
for argument in cli_interface.parent_arguments:
|
95
|
-
subcommand_subparser.add_argument(
|
96
|
-
*argument.name_or_flags, **create_argument_data(argument))
|
97
|
-
|
98
|
-
return parser
|
99
|
-
|
100
|
-
|
101
|
-
def create_request(request: argparse.Namespace, cli_interface: CliInterface, **kwargs) -> RequestContext:
|
102
|
-
|
103
|
-
# Convert argparse.Namespace to dictionary.
|
104
|
-
data = vars(request)
|
105
|
-
|
106
|
-
# Create header values.
|
107
|
-
headers = create_headers(data)
|
108
|
-
|
109
|
-
# Get the command from the CLI interface.
|
110
|
-
command = cli_interface.get_command(**headers)
|
111
|
-
|
112
|
-
# Create map of arguments to their data attribute names.
|
113
|
-
argument_map = {arg.get_name(): arg for arg in command.arguments}
|
114
|
-
|
115
|
-
# Map the data to the request context.
|
116
|
-
for key, value in data.items():
|
117
|
-
if value is None:
|
118
|
-
continue
|
119
|
-
argument = argument_map.get(key)
|
120
|
-
data[key] = map_object_input(value, argument)
|
121
|
-
|
122
|
-
# Create request context.
|
123
|
-
return RequestContext(
|
124
|
-
feature_id=command.feature_id,
|
125
|
-
data=data,
|
126
|
-
headers=headers,
|
127
|
-
**headers,
|
128
|
-
**kwargs
|
129
|
-
)
|
130
|
-
|
131
|
-
|
132
|
-
def map_object_input(data: Any, argument: CliArgument):
|
133
|
-
|
134
|
-
# If the argument is not input to data,
|
135
|
-
if not argument.to_data:
|
136
|
-
|
137
|
-
# Return the data.
|
138
|
-
return data
|
139
|
-
|
140
|
-
# If the argument is a dictionary,
|
141
|
-
if argument.nargs:
|
142
|
-
|
143
|
-
# If the argument is a list, split the data by the delimiter.
|
144
|
-
result = {}
|
145
|
-
|
146
|
-
# For each item in the data, split the item into key and value.
|
147
|
-
for item in data:
|
148
|
-
|
149
|
-
# Split the item into key and value.
|
150
|
-
key, value = item.split('=')
|
151
|
-
|
152
|
-
# Add the key and value to the result.
|
153
|
-
result[key] = value
|
154
|
-
|
155
|
-
# Return result.
|
156
|
-
return result
|
157
|
-
|
158
|
-
# If the argument is an object list,
|
159
|
-
if argument.action == 'append':
|
160
|
-
|
161
|
-
# Create a list to store the result.
|
162
|
-
result = []
|
163
|
-
|
164
|
-
# For each row object in the data,
|
165
|
-
for row in data:
|
166
|
-
|
167
|
-
# Create an object to store the key value pairs.
|
168
|
-
obj = {}
|
169
|
-
|
170
|
-
# Split the row by the delimiter.
|
171
|
-
items = row.split(';')
|
172
|
-
|
173
|
-
# For each item in the row,
|
174
|
-
for item in items:
|
175
|
-
|
176
|
-
# Split the item into key and value.
|
177
|
-
key, value = item.split('=')
|
178
|
-
|
179
|
-
# Add the key and value to the object.
|
180
|
-
obj[key] = value
|
181
|
-
|
182
|
-
# Add the object to the result.
|
183
|
-
result.append(obj)
|
184
|
-
|
185
|
-
# Return result.
|
186
|
-
return result
|
File without changes
|
File without changes
|
File without changes
|