tiferet 1.0.0b2__tar.gz → 1.0.0b4__tar.gz

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.
Files changed (64) hide show
  1. {tiferet-1.0.0b2/tiferet.egg-info → tiferet-1.0.0b4}/PKG-INFO +1 -1
  2. {tiferet-1.0.0b2 → tiferet-1.0.0b4}/setup.py +1 -1
  3. tiferet-1.0.0b4/tiferet/configs/error.py +104 -0
  4. {tiferet-1.0.0b2 → tiferet-1.0.0b4}/tiferet/contexts/container.py +0 -9
  5. {tiferet-1.0.0b2 → tiferet-1.0.0b4}/tiferet/contexts/feature.py +5 -0
  6. tiferet-1.0.0b4/tiferet/proxies/yaml/__init__.py +79 -0
  7. {tiferet-1.0.0b2 → tiferet-1.0.0b4}/tiferet/proxies/yaml/app.py +38 -18
  8. {tiferet-1.0.0b2 → tiferet-1.0.0b4/tiferet.egg-info}/PKG-INFO +1 -1
  9. {tiferet-1.0.0b2 → tiferet-1.0.0b4}/tiferet.egg-info/SOURCES.txt +1 -0
  10. tiferet-1.0.0b2/tiferet/configs/error.py +0 -48
  11. {tiferet-1.0.0b2 → tiferet-1.0.0b4}/LICENSE +0 -0
  12. {tiferet-1.0.0b2 → tiferet-1.0.0b4}/README.md +0 -0
  13. {tiferet-1.0.0b2 → tiferet-1.0.0b4}/setup.cfg +0 -0
  14. {tiferet-1.0.0b2 → tiferet-1.0.0b4}/tiferet/__init__.py +0 -0
  15. {tiferet-1.0.0b2 → tiferet-1.0.0b4}/tiferet/clients/__init__.py +0 -0
  16. {tiferet-1.0.0b2 → tiferet-1.0.0b4}/tiferet/clients/yaml.py +0 -0
  17. {tiferet-1.0.0b2 → tiferet-1.0.0b4}/tiferet/commands/__init__.py +0 -0
  18. {tiferet-1.0.0b2 → tiferet-1.0.0b4}/tiferet/commands/app.py +0 -0
  19. {tiferet-1.0.0b2 → tiferet-1.0.0b4}/tiferet/commands/core.py +0 -0
  20. {tiferet-1.0.0b2 → tiferet-1.0.0b4}/tiferet/commands/dependencies.py +0 -0
  21. {tiferet-1.0.0b2 → tiferet-1.0.0b4}/tiferet/commands/settings.py +0 -0
  22. {tiferet-1.0.0b2 → tiferet-1.0.0b4}/tiferet/configs/__init__.py +0 -0
  23. /tiferet-1.0.0b2/tiferet/contexts/__init__.py → /tiferet-1.0.0b4/tiferet/configs/container.py +0 -0
  24. {tiferet-1.0.0b2 → tiferet-1.0.0b4}/tiferet/configs/settings.py +0 -0
  25. {tiferet-1.0.0b2/tiferet/handlers → tiferet-1.0.0b4/tiferet/contexts}/__init__.py +0 -0
  26. {tiferet-1.0.0b2 → tiferet-1.0.0b4}/tiferet/contexts/app.py +0 -0
  27. {tiferet-1.0.0b2 → tiferet-1.0.0b4}/tiferet/contexts/cache.py +0 -0
  28. {tiferet-1.0.0b2 → tiferet-1.0.0b4}/tiferet/contexts/error.py +0 -0
  29. {tiferet-1.0.0b2 → tiferet-1.0.0b4}/tiferet/contracts/__init__.py +0 -0
  30. {tiferet-1.0.0b2 → tiferet-1.0.0b4}/tiferet/contracts/app.py +0 -0
  31. {tiferet-1.0.0b2 → tiferet-1.0.0b4}/tiferet/contracts/cache.py +0 -0
  32. {tiferet-1.0.0b2 → tiferet-1.0.0b4}/tiferet/contracts/container.py +0 -0
  33. {tiferet-1.0.0b2 → tiferet-1.0.0b4}/tiferet/contracts/error.py +0 -0
  34. {tiferet-1.0.0b2 → tiferet-1.0.0b4}/tiferet/contracts/feature.py +0 -0
  35. {tiferet-1.0.0b2 → tiferet-1.0.0b4}/tiferet/contracts/settings.py +0 -0
  36. {tiferet-1.0.0b2 → tiferet-1.0.0b4}/tiferet/data/__init__.py +0 -0
  37. {tiferet-1.0.0b2 → tiferet-1.0.0b4}/tiferet/data/app.py +0 -0
  38. {tiferet-1.0.0b2 → tiferet-1.0.0b4}/tiferet/data/container.py +0 -0
  39. {tiferet-1.0.0b2 → tiferet-1.0.0b4}/tiferet/data/error.py +0 -0
  40. {tiferet-1.0.0b2 → tiferet-1.0.0b4}/tiferet/data/feature.py +0 -0
  41. {tiferet-1.0.0b2 → tiferet-1.0.0b4}/tiferet/data/settings.py +0 -0
  42. {tiferet-1.0.0b2 → tiferet-1.0.0b4}/tiferet/domain/__init__.py +0 -0
  43. {tiferet-1.0.0b2 → tiferet-1.0.0b4}/tiferet/domain/app.py +0 -0
  44. {tiferet-1.0.0b2 → tiferet-1.0.0b4}/tiferet/domain/container.py +0 -0
  45. {tiferet-1.0.0b2 → tiferet-1.0.0b4}/tiferet/domain/core.py +0 -0
  46. {tiferet-1.0.0b2 → tiferet-1.0.0b4}/tiferet/domain/error.py +0 -0
  47. {tiferet-1.0.0b2 → tiferet-1.0.0b4}/tiferet/domain/feature.py +0 -0
  48. {tiferet-1.0.0b2/tiferet/proxies → tiferet-1.0.0b4/tiferet/handlers}/__init__.py +0 -0
  49. {tiferet-1.0.0b2 → tiferet-1.0.0b4}/tiferet/handlers/container.py +0 -0
  50. {tiferet-1.0.0b2 → tiferet-1.0.0b4}/tiferet/handlers/error.py +0 -0
  51. {tiferet-1.0.0b2 → tiferet-1.0.0b4}/tiferet/handlers/feature.py +0 -0
  52. {tiferet-1.0.0b2 → tiferet-1.0.0b4}/tiferet/models/__init__.py +0 -0
  53. {tiferet-1.0.0b2 → tiferet-1.0.0b4}/tiferet/models/app.py +0 -0
  54. {tiferet-1.0.0b2 → tiferet-1.0.0b4}/tiferet/models/container.py +0 -0
  55. {tiferet-1.0.0b2 → tiferet-1.0.0b4}/tiferet/models/error.py +0 -0
  56. {tiferet-1.0.0b2 → tiferet-1.0.0b4}/tiferet/models/feature.py +0 -0
  57. {tiferet-1.0.0b2 → tiferet-1.0.0b4}/tiferet/models/settings.py +0 -0
  58. {tiferet-1.0.0b2/tiferet/proxies/yaml → tiferet-1.0.0b4/tiferet/proxies}/__init__.py +0 -0
  59. {tiferet-1.0.0b2 → tiferet-1.0.0b4}/tiferet/proxies/yaml/container.py +0 -0
  60. {tiferet-1.0.0b2 → tiferet-1.0.0b4}/tiferet/proxies/yaml/error.py +0 -0
  61. {tiferet-1.0.0b2 → tiferet-1.0.0b4}/tiferet/proxies/yaml/feature.py +0 -0
  62. {tiferet-1.0.0b2 → tiferet-1.0.0b4}/tiferet.egg-info/dependency_links.txt +0 -0
  63. {tiferet-1.0.0b2 → tiferet-1.0.0b4}/tiferet.egg-info/requires.txt +0 -0
  64. {tiferet-1.0.0b2 → tiferet-1.0.0b4}/tiferet.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tiferet
3
- Version: 1.0.0b2
3
+ Version: 1.0.0b4
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,7 +9,7 @@ config = {
9
9
  'url': r'https://github.com/greatstrength/app',
10
10
  'download_url': r'https://github.com/greatstrength/app',
11
11
  'author_email': 'andrew@greatstrength.me',
12
- 'version': '1.0.0-beta.2',
12
+ 'version': '1.0.0-beta.4',
13
13
  'license': 'BSD 3',
14
14
  'install_requires': [
15
15
  'schematics>=2.1.1',
@@ -0,0 +1,104 @@
1
+ # *** imports
2
+
3
+
4
+ # *** configs
5
+
6
+ # ** config: errors
7
+ ERRORS = [
8
+ dict(
9
+ id='parameter_parsing_failed',
10
+ name='Parameter Parsing Failed',
11
+ error_code='PARAMETER_PARSING_FAILED',
12
+ message=[
13
+ dict(lang='en_US', text='Failed to parse parameter: {}. Error: {}')
14
+ ]
15
+ ),
16
+ dict(
17
+ id='import_dependency_failed',
18
+ name='Import Dependency Failed',
19
+ error_code='IMPORT_DEPENDENCY_FAILED',
20
+ message=[
21
+ dict(lang='en_US', text='Failed to import dependency: {} from module {}. Error: {}')
22
+ ]
23
+ ),
24
+ dict(
25
+ id='invalid_dependency_error',
26
+ name='Invalid Dependency Error',
27
+ error_code='INVALID_DEPENDENCY_ERROR',
28
+ message=[
29
+ dict(lang='en_US', text='Dependency {} could not be resolved: {}')
30
+ ]
31
+ ),
32
+ dict(
33
+ id='app_repository_import_failed',
34
+ name='App Repository Import Failed',
35
+ error_code='APP_REPOSITORY_IMPORT_FAILED',
36
+ message=[
37
+ dict(lang='en_US', text='Failed to import app repository: {}.')
38
+ ]
39
+ ),
40
+ dict(
41
+ id='app_interface_not_found',
42
+ name='App Interface Not Found',
43
+ error_code='APP_INTERFACE_NOT_FOUND',
44
+ message=[
45
+ dict(lang='en_US', text='App interface with ID {} not found.')
46
+ ]
47
+ ),
48
+ dict(
49
+ id='feature_command_loading_failed',
50
+ name='Feature Command Loading Failed',
51
+ error_code='FEATURE_COMMAND_LOADING_FAILED',
52
+ message=[
53
+ dict(lang='en_US', text='Failed to load feature command attribute: {}. Ensure the container attributes are configured with the appropriate default settings/flags. {}')
54
+ ]
55
+ ),
56
+ dict(
57
+ id='error_not_found',
58
+ name='Error Not Found',
59
+ error_code='ERROR_NOT_FOUND',
60
+ message=[
61
+ dict(lang='en_US', text='Error not found: {}.')
62
+ ]
63
+ ),
64
+ dict(
65
+ id='container_attributes_not_found',
66
+ name='Container Attributes Not Found',
67
+ error_code='CONTAINER_ATTRIBUTES_NOT_FOUND',
68
+ message=[
69
+ dict(lang='en_US', text='No container attributes provided to load the container.')
70
+ ]
71
+ ),
72
+ dict(
73
+ id='dependency_type_not_found',
74
+ name='Dependency Type Not Found',
75
+ error_code='DEPENDENCY_TYPE_NOT_FOUND',
76
+ message=[
77
+ dict(lang='en_US', text='No dependency type found for attribute {} with flags {}.')
78
+ ]
79
+ ),
80
+ dict(
81
+ id='request_not_found',
82
+ name='Request Not Found',
83
+ error_code='REQUEST_NOT_FOUND',
84
+ message=[
85
+ dict(lang='en_US', text='Request data is not available for parameter parsing.')
86
+ ]
87
+ ),
88
+ dict(
89
+ id='parameter_not_found',
90
+ name='Parameter Not Found',
91
+ error_code='PARAMETER_NOT_FOUND',
92
+ message=[
93
+ dict(lang='en_US', text='Parameter {} not found in request data.')
94
+ ]
95
+ ),
96
+ dict(
97
+ id='feature_not_found',
98
+ name='Feature Not Found',
99
+ error_code='FEATURE_NOT_FOUND',
100
+ message=[
101
+ dict(lang='en_US', text='Feature with ID {} not found.')
102
+ ]
103
+ ),
104
+ ]
@@ -120,15 +120,6 @@ class ContainerContext(Model):
120
120
  injector=injector,
121
121
  dependency_name=attribute_id,
122
122
  )
123
-
124
- # Raise an error if the dependency is not found.
125
- if not dependency:
126
- raise_error.execute(
127
- 'CONTAINER_DEPENDENCY_NOT_FOUND',
128
- f'Dependency with ID {attribute_id} not found in container with flags {flags}.',
129
- attribute_id,
130
- flags
131
- )
132
123
 
133
124
  # Return the dependency.
134
125
  return dependency
@@ -98,9 +98,14 @@ class FeatureContext(object):
98
98
  **request.data,
99
99
  **kwargs
100
100
  )
101
+
102
+ # If an error occurs during command execution, handle it based on the pass_on_error flag.
101
103
  except Exception as e:
102
104
  if not pass_on_error:
103
105
  raise e
106
+
107
+ # Set the result to None if passing on the error.
108
+ result = None
104
109
 
105
110
  # If a data key is provided, store the result in the request data.
106
111
  if data_key:
@@ -0,0 +1,79 @@
1
+ # *** imports
2
+
3
+ # ** core
4
+ from typing import Dict, Any
5
+
6
+ # ** app
7
+ from ...commands import raise_error
8
+ from ...clients import yaml_client
9
+
10
+
11
+ # *** classes
12
+
13
+ # ** class yaml_proxy
14
+ class YamlProxy(object):
15
+ '''
16
+ A base class for YAML proxies.
17
+ '''
18
+
19
+ # * field: config_file
20
+ config_file: str = None
21
+
22
+ # * method: init
23
+ def __init__(self, config_file: str):
24
+ '''
25
+ Initialize the YAML proxy.
26
+
27
+ :param config_file: The configuration file.
28
+ :type config_file: str
29
+ '''
30
+ self.config_file = config_file
31
+
32
+ # * method: load_yaml
33
+ def load_yaml(self, start_node: str = None, create_data: callable = None) -> any:
34
+ '''
35
+ Load data from the YAML configuration file.
36
+
37
+ :param start_node: The starting node in the YAML file.
38
+ :type start_node: str
39
+ :param create_data: A callable to create data objects from the loaded data.
40
+ :type create_data: callable
41
+ :return: The loaded data.
42
+ :rtype: any
43
+ '''
44
+
45
+ # Load the YAML file using the yaml client.
46
+ try:
47
+ return yaml_client.load(
48
+ self.config_file,
49
+ create_data=create_data,
50
+ start_node=start_node
51
+ )
52
+ except FileNotFoundError as e:
53
+ # If the file is not found, raise an error.
54
+ raise_error.execute(
55
+ 'CONFIG_FILE_NOT_FOUND',
56
+ f'Configuration file {self.config_file} not found.',
57
+ self.config_file
58
+ )
59
+
60
+
61
+ # * method: save_yaml
62
+ def save_yaml(self, data: Dict[str, Any]):
63
+ '''
64
+ Save data to the YAML configuration file.
65
+
66
+ :param data: The data to save.
67
+ :type data: Dict[str, Any]
68
+ '''
69
+
70
+ # Save the data to the YAML file using the yaml client.
71
+ try:
72
+ yaml_client.save(self.config_file, data)
73
+ except FileNotFoundError as e:
74
+ # If the file is not found, raise an error.
75
+ raise_error.execute(
76
+ 'CONFIG_FILE_NOT_FOUND',
77
+ f'Configuration file {self.config_file} not found.',
78
+ self.config_file
79
+ )
@@ -1,6 +1,7 @@
1
1
  # *** imports
2
2
 
3
3
  # ** app
4
+ from ...commands import raise_error
4
5
  from ...data import DataObject
5
6
  from ...data.app import AppInterfaceYamlData
6
7
  from ...contracts.app import AppRepository, AppInterface
@@ -37,15 +38,24 @@ class AppYamlProxy(AppRepository):
37
38
  '''
38
39
 
39
40
  # Load the app interface data from the yaml configuration file and map it to the app interface object.
40
- interfaces = yaml_client.load(
41
- self.config_file,
42
- create_data=lambda data: [
43
- DataObject.from_data(
44
- AppInterfaceYamlData,
45
- id=interface_id,
46
- **record
47
- ).map() for interface_id, record in data.items()],
48
- start_node=lambda data: data.get('interfaces'))
41
+ try:
42
+ interfaces = yaml_client.load(
43
+ self.config_file,
44
+ create_data=lambda data: [
45
+ DataObject.from_data(
46
+ AppInterfaceYamlData,
47
+ id=interface_id,
48
+ **record
49
+ ).map() for interface_id, record in data.items()],
50
+ start_node=lambda data: data.get('interfaces'))
51
+
52
+ # If the file is not found, raise an error.
53
+ except FileNotFoundError:
54
+ raise_error.execute(
55
+ 'APP_CONFIG_FILE_NOT_FOUND',
56
+ f'App configuration file {self.config_file} not found.',
57
+ self.config_file
58
+ )
49
59
 
50
60
  # Return the list of app interface objects.
51
61
  return interfaces
@@ -62,15 +72,25 @@ class AppYamlProxy(AppRepository):
62
72
  '''
63
73
 
64
74
  # Load the app interface data from the yaml configuration file.
65
- _data: AppInterface = yaml_client.load(
66
- self.config_file,
67
- create_data=lambda data: DataObject.from_data(
68
- AppInterfaceYamlData,
69
- id=id,
70
- **data
71
- ),
72
- start_node=lambda data: data.get('interfaces').get(id))
73
-
75
+ try:
76
+ _data: AppInterface = yaml_client.load(
77
+ self.config_file,
78
+ create_data=lambda data: DataObject.from_data(
79
+ AppInterfaceYamlData,
80
+ id=id,
81
+ **data
82
+ ),
83
+ start_node=lambda data: data.get('interfaces').get(id)
84
+ )
85
+
86
+ # If the file is not found, raise an error.
87
+ except FileNotFoundError:
88
+ raise_error.execute(
89
+ 'APP_CONFIG_FILE_NOT_FOUND',
90
+ f'App configuration file {self.config_file} not found.',
91
+ self.config_file
92
+ )
93
+
74
94
  # Return the app interface object.
75
95
  # If the data is None, return None.
76
96
  try:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tiferet
3
- Version: 1.0.0b2
3
+ Version: 1.0.0b4
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
@@ -15,6 +15,7 @@ tiferet/commands/core.py
15
15
  tiferet/commands/dependencies.py
16
16
  tiferet/commands/settings.py
17
17
  tiferet/configs/__init__.py
18
+ tiferet/configs/container.py
18
19
  tiferet/configs/error.py
19
20
  tiferet/configs/settings.py
20
21
  tiferet/contexts/__init__.py
@@ -1,48 +0,0 @@
1
- # *** imports
2
-
3
-
4
- # *** configs
5
-
6
- # ** config: errors
7
- ERRORS = [
8
- dict(
9
- id='parameter_parsing_failed',
10
- name='Parameter Parsing Failed',
11
- error_code='PARAMETER_PARSING_FAILED',
12
- message=[
13
- dict(lang='en_US', text='Failed to parse parameter: {}. Error: {}')
14
- ]
15
- ),
16
- dict(
17
- id='import_dependency_failed',
18
- name='Import Dependency Failed',
19
- error_code='IMPORT_DEPENDENCY_FAILED',
20
- message=[
21
- dict(lang='en_US', text='Failed to import dependency: {} from module {}. Error: {}')
22
- ]
23
- ),
24
- dict(
25
- id='app_repository_import_failed',
26
- name='App Repository Import Failed',
27
- error_code='APP_REPOSITORY_IMPORT_FAILED',
28
- message=[
29
- dict(lang='en_US', text='Failed to import app repository: {}.')
30
- ]
31
- ),
32
- dict(
33
- id='app_interface_not_found',
34
- name='App Interface Not Found',
35
- error_code='APP_INTERFACE_NOT_FOUND',
36
- message=[
37
- dict(lang='en_US', text='App interface with ID {} not found.')
38
- ]
39
- ),
40
- dict(
41
- id='feature_command_loading_failed',
42
- name='Feature Command Loading Failed',
43
- error_code='FEATURE_COMMAND_LOADING_FAILED',
44
- message=[
45
- dict(lang='en_US', text='Failed to load feature command attribute: {}. Ensure the container attributes are configured with the appropriate default settings/flags. {}')
46
- ]
47
- )
48
- ]
File without changes
File without changes
File without changes
File without changes
File without changes