batchfetch 1.3.1__tar.gz → 1.3.3__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.
- {batchfetch-1.3.1 → batchfetch-1.3.3}/PKG-INFO +1 -1
- {batchfetch-1.3.1 → batchfetch-1.3.3}/batchfetch/batchfetch_base.py +20 -18
- {batchfetch-1.3.1 → batchfetch-1.3.3}/batchfetch.egg-info/PKG-INFO +1 -1
- {batchfetch-1.3.1 → batchfetch-1.3.3}/setup.py +1 -1
- {batchfetch-1.3.1 → batchfetch-1.3.3}/LICENSE +0 -0
- {batchfetch-1.3.1 → batchfetch-1.3.3}/README.md +0 -0
- {batchfetch-1.3.1 → batchfetch-1.3.3}/batchfetch/__init__.py +0 -0
- {batchfetch-1.3.1 → batchfetch-1.3.3}/batchfetch/batchfetch_cli.py +0 -0
- {batchfetch-1.3.1 → batchfetch-1.3.3}/batchfetch/batchfetch_git.py +0 -0
- {batchfetch-1.3.1 → batchfetch-1.3.3}/batchfetch/helpers.py +0 -0
- {batchfetch-1.3.1 → batchfetch-1.3.3}/batchfetch.egg-info/SOURCES.txt +0 -0
- {batchfetch-1.3.1 → batchfetch-1.3.3}/batchfetch.egg-info/dependency_links.txt +0 -0
- {batchfetch-1.3.1 → batchfetch-1.3.3}/batchfetch.egg-info/entry_points.txt +0 -0
- {batchfetch-1.3.1 → batchfetch-1.3.3}/batchfetch.egg-info/requires.txt +0 -0
- {batchfetch-1.3.1 → batchfetch-1.3.3}/batchfetch.egg-info/top_level.txt +0 -0
- {batchfetch-1.3.1 → batchfetch-1.3.3}/setup.cfg +0 -0
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
import os
|
|
22
22
|
from copy import deepcopy
|
|
23
23
|
from pathlib import Path
|
|
24
|
-
from typing import Any, Dict
|
|
24
|
+
from typing import Any, Dict, List
|
|
25
25
|
|
|
26
26
|
from schema import Optional, Or, Schema
|
|
27
27
|
|
|
@@ -39,13 +39,12 @@ class DataAlreadyInitialized(Exception):
|
|
|
39
39
|
class TaskBase:
|
|
40
40
|
def __init__(self, data: Dict[str, Any], options: Dict[str, Any]):
|
|
41
41
|
self.global_options_schema: Dict[Any, Any] = {}
|
|
42
|
-
self.global_options_values: Dict[str, Any] =
|
|
42
|
+
self.global_options_values: Dict[str, Any] = options
|
|
43
43
|
|
|
44
44
|
self.task_schema: Dict[Any, Any] = {}
|
|
45
45
|
self.task_default_values: Dict[str, Any] = {}
|
|
46
46
|
|
|
47
47
|
self._item_values = data
|
|
48
|
-
self._item_options = options
|
|
49
48
|
|
|
50
49
|
# Variables
|
|
51
50
|
self.values: Dict[str, Any] = {}
|
|
@@ -59,13 +58,14 @@ class TaskBase:
|
|
|
59
58
|
# Options
|
|
60
59
|
self.options = {}
|
|
61
60
|
self.options.update(deepcopy(self.global_options_values))
|
|
62
|
-
|
|
61
|
+
|
|
63
62
|
schema = Schema(self.global_options_schema)
|
|
64
63
|
schema.validate(self.options)
|
|
65
64
|
|
|
66
65
|
# Data
|
|
67
66
|
self.values = {}
|
|
68
67
|
self.values.update(deepcopy(self.task_default_values))
|
|
68
|
+
self.values.update(deepcopy(self.options))
|
|
69
69
|
self.values.update(deepcopy(self._item_values))
|
|
70
70
|
schema = Schema(self.task_schema)
|
|
71
71
|
schema.validate(self.values)
|
|
@@ -88,9 +88,6 @@ class TaskBase:
|
|
|
88
88
|
if key in self.options:
|
|
89
89
|
return self.options[key]
|
|
90
90
|
|
|
91
|
-
if key in self.global_options_values:
|
|
92
|
-
return self.global_options_values[key]
|
|
93
|
-
|
|
94
91
|
raise KeyError(f"The item '{key}' was not found in '{self.values}")
|
|
95
92
|
|
|
96
93
|
|
|
@@ -98,6 +95,12 @@ class TaskBatchFetch(TaskBase):
|
|
|
98
95
|
"""Plugin downloader base class."""
|
|
99
96
|
|
|
100
97
|
def __init__(self, data: Dict[str, Any], options: Dict[str, Any]):
|
|
98
|
+
new_options: Dict[str, Any] = {"exec_before": [],
|
|
99
|
+
"exec_after": [],
|
|
100
|
+
"ignore_untracked": []}
|
|
101
|
+
new_options.update(options)
|
|
102
|
+
options = new_options
|
|
103
|
+
|
|
101
104
|
super().__init__(data=data, options=options)
|
|
102
105
|
self.indent = 4
|
|
103
106
|
self.indent_spaces = " " * self.indent
|
|
@@ -116,12 +119,9 @@ class TaskBatchFetch(TaskBase):
|
|
|
116
119
|
|
|
117
120
|
Optional("exec_before"): Or([str], str),
|
|
118
121
|
Optional("exec_after"): Or([str], str),
|
|
119
|
-
}
|
|
120
122
|
|
|
121
|
-
|
|
122
|
-
"
|
|
123
|
-
"exec_after": [],
|
|
124
|
-
"ignore_untracked": [],
|
|
123
|
+
# Global options (unused locally)
|
|
124
|
+
Optional("ignore_untracked"): Or([str], str),
|
|
125
125
|
}
|
|
126
126
|
|
|
127
127
|
self.task_default_values: Dict[str, Any] = {
|
|
@@ -151,13 +151,14 @@ class TaskBatchFetch(TaskBase):
|
|
|
151
151
|
return
|
|
152
152
|
|
|
153
153
|
# Global
|
|
154
|
-
cmd = self.
|
|
155
|
-
if "exec_before" in self.
|
|
154
|
+
cmd = self.global_options_values["exec_before"] \
|
|
155
|
+
if "exec_before" in self.global_options_values else None
|
|
156
156
|
if cmd:
|
|
157
157
|
self._local_task_exec(cmd, cwd=str(cwd))
|
|
158
158
|
|
|
159
159
|
# Local
|
|
160
|
-
cmd = self["exec_before"]
|
|
160
|
+
cmd = self._item_values["exec_before"] if "exec_before" \
|
|
161
|
+
in self._item_values else None
|
|
161
162
|
if cmd:
|
|
162
163
|
self._local_task_exec(cmd, cwd=str(cwd))
|
|
163
164
|
|
|
@@ -167,13 +168,14 @@ class TaskBatchFetch(TaskBase):
|
|
|
167
168
|
return
|
|
168
169
|
|
|
169
170
|
# Local
|
|
170
|
-
cmd = self.
|
|
171
|
-
if "exec_after" in self.
|
|
171
|
+
cmd = self.global_options_values["exec_after"] \
|
|
172
|
+
if "exec_after" in self.global_options_values else None
|
|
172
173
|
if cmd:
|
|
173
174
|
self._local_task_exec(cmd, cwd=str(cwd))
|
|
174
175
|
|
|
175
176
|
# Local
|
|
176
|
-
cmd = self["exec_after"]
|
|
177
|
+
cmd = self._item_values["exec_after"] if "exec_after" \
|
|
178
|
+
in self._item_values else None
|
|
177
179
|
if cmd:
|
|
178
180
|
self._local_task_exec(cmd, cwd=str(cwd))
|
|
179
181
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|