dyngle 0.4.3__py3-none-any.whl → 0.5.0__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.
Potentially problematic release.
This version of dyngle might be problematic. Click here for more details.
- dyngle/__init__.py +36 -1
- dyngle/command/run_command.py +3 -3
- {dyngle-0.4.3.dist-info → dyngle-0.5.0.dist-info}/METADATA +1 -1
- {dyngle-0.4.3.dist-info → dyngle-0.5.0.dist-info}/RECORD +6 -6
- {dyngle-0.4.3.dist-info → dyngle-0.5.0.dist-info}/WHEEL +0 -0
- {dyngle-0.4.3.dist-info → dyngle-0.5.0.dist-info}/entry_points.txt +0 -0
dyngle/__init__.py
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
from functools import cached_property
|
|
2
|
+
from pathlib import Path
|
|
2
3
|
from wizlib.app import WizApp
|
|
3
4
|
from wizlib.stream_handler import StreamHandler
|
|
4
5
|
from wizlib.config_handler import ConfigHandler
|
|
5
6
|
from wizlib.ui_handler import UIHandler
|
|
6
7
|
|
|
7
8
|
from dyngle.command import DyngleCommand
|
|
9
|
+
from dyngle.error import DyngleError
|
|
8
10
|
from dyngle.expression import expression
|
|
9
11
|
|
|
10
12
|
|
|
@@ -14,9 +16,42 @@ class DyngleApp(WizApp):
|
|
|
14
16
|
name = 'dyngle'
|
|
15
17
|
handlers = [StreamHandler, ConfigHandler, UIHandler]
|
|
16
18
|
|
|
19
|
+
# For possible upstreaming to WizLib, a mechanism to "import" configuration
|
|
20
|
+
# settings from external files.
|
|
21
|
+
|
|
22
|
+
@property
|
|
23
|
+
def _imported_configrations(self):
|
|
24
|
+
if not hasattr(self, '__imported_configurations'):
|
|
25
|
+
imports = self.config.get('dyngle-imports')
|
|
26
|
+
confs = []
|
|
27
|
+
if imports:
|
|
28
|
+
for filename in imports:
|
|
29
|
+
full_filename = Path(filename).expanduser()
|
|
30
|
+
confs.append(ConfigHandler(full_filename))
|
|
31
|
+
self.__imported_configurations = confs
|
|
32
|
+
return self.__imported_configurations
|
|
33
|
+
|
|
34
|
+
def _get_configuration_details(self, type: str):
|
|
35
|
+
label = f'dyngle-{type}'
|
|
36
|
+
details = {}
|
|
37
|
+
for conf in self._imported_configrations:
|
|
38
|
+
if (imported_details := conf.get(label)):
|
|
39
|
+
details |= imported_details
|
|
40
|
+
configured_details = self.config.get(label)
|
|
41
|
+
if configured_details:
|
|
42
|
+
details |= configured_details
|
|
43
|
+
return details
|
|
44
|
+
|
|
45
|
+
@cached_property
|
|
46
|
+
def operations(self):
|
|
47
|
+
operations = self._get_configuration_details('operations')
|
|
48
|
+
if not operations:
|
|
49
|
+
raise DyngleError("No operations defined")
|
|
50
|
+
return operations
|
|
51
|
+
|
|
17
52
|
@cached_property
|
|
18
53
|
def expressions(self):
|
|
19
|
-
expr_texts = self.
|
|
54
|
+
expr_texts = self._get_configuration_details('expressions')
|
|
20
55
|
if expr_texts:
|
|
21
56
|
return {k: expression(t) for k, t in expr_texts.items()}
|
|
22
57
|
else:
|
dyngle/command/run_command.py
CHANGED
|
@@ -29,13 +29,13 @@ class RunCommand(DyngleCommand):
|
|
|
29
29
|
if self.operation not in operations:
|
|
30
30
|
available_operations = ', '.join(operations.keys())
|
|
31
31
|
raise DyngleError(
|
|
32
|
-
f
|
|
33
|
-
|
|
32
|
+
f"Operation '{self.operation}' not found. " +
|
|
33
|
+
f"Available operations: {available_operations}")
|
|
34
34
|
|
|
35
35
|
@DyngleCommand.wrap
|
|
36
36
|
def execute(self):
|
|
37
37
|
expressions = self.app.expressions
|
|
38
|
-
operations = self.app.
|
|
38
|
+
operations = self.app.operations
|
|
39
39
|
self._validate_operation_exists(operations)
|
|
40
40
|
steps = operations[self.operation]
|
|
41
41
|
data_string = self.app.stream.text
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
dyngle/__init__.py,sha256=
|
|
1
|
+
dyngle/__init__.py,sha256=Ld1T1kc6zJch8jUHKFP2GPp650b4TR8IKpkrPdZmLwg,1949
|
|
2
2
|
dyngle/__main__.py,sha256=pYRIwzix_AL8CdJaDDis_8yMBBWO2N72NNwkroo1dQo,95
|
|
3
3
|
dyngle/command/__init__.py,sha256=1S86gbef8MYvG-TWD5JRIWzFg7qV5xKhp9QXx9zEx5c,94
|
|
4
|
-
dyngle/command/run_command.py,sha256=
|
|
4
|
+
dyngle/command/run_command.py,sha256=icdc0YaILB33Zy-wzJIlCGTnUVnk-p6eQT8j1kxa1rg,1827
|
|
5
5
|
dyngle/error.py,sha256=CGcTa8L4O1qsHEYnzp_JBbkvntJTv2Qz46wj_TI8NLk,39
|
|
6
6
|
dyngle/expression.py,sha256=-uLVbrO8ovNZGGLNqMZWIy_StCK-0laZqcQ1gOPhU6w,3476
|
|
7
7
|
dyngle/safe_path.py,sha256=Hk2AhP6e3yKGh3kKrLLwhvAlMNx-j2jObBYJL-_doAU,3339
|
|
8
8
|
dyngle/template.py,sha256=XM5VtOiuMVzNjMTsUdMMfugiygcOuAh-8MedfhEbGn0,1435
|
|
9
|
-
dyngle-0.
|
|
10
|
-
dyngle-0.
|
|
11
|
-
dyngle-0.
|
|
12
|
-
dyngle-0.
|
|
9
|
+
dyngle-0.5.0.dist-info/METADATA,sha256=TYWz-gVzI2QZzn_JY-YmHRtOpEhyi2pmXrJqgZsBc7g,4544
|
|
10
|
+
dyngle-0.5.0.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
|
11
|
+
dyngle-0.5.0.dist-info/entry_points.txt,sha256=rekiGhtweiHKm9g1jdGb3FhzqDrk1kigJDeSNollZSA,48
|
|
12
|
+
dyngle-0.5.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|