xenfra 0.3.6__py3-none-any.whl → 0.3.7__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.
xenfra/utils/config.py
CHANGED
|
@@ -29,18 +29,8 @@ def read_xenfra_yaml(filename: str = "xenfra.yaml") -> dict:
|
|
|
29
29
|
Raises:
|
|
30
30
|
FileNotFoundError: If the config file doesn't exist
|
|
31
31
|
yaml.YAMLError: If the YAML is malformed
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
Read and parse xenfra.yaml configuration file.
|
|
35
|
-
|
|
36
|
-
Args:
|
|
37
|
-
filename: Path to the config file (default: xenfra.yaml)
|
|
38
|
-
|
|
39
|
-
Returns:
|
|
40
|
-
Dictionary containing the configuration
|
|
41
|
-
|
|
42
|
-
Raises:
|
|
43
|
-
FileNotFoundError: If the config file doesn't exist
|
|
32
|
+
ValueError: If the YAML is invalid
|
|
33
|
+
IOError: If reading fails
|
|
44
34
|
"""
|
|
45
35
|
if not Path(filename).exists():
|
|
46
36
|
raise FileNotFoundError(
|
|
@@ -162,17 +152,7 @@ def apply_patch(patch: dict, target_file: str = None, create_backup_file: bool =
|
|
|
162
152
|
raise ValueError(
|
|
163
153
|
f"Invalid patch operation: {operation}. Must be 'add', 'replace', or 'remove'"
|
|
164
154
|
)
|
|
165
|
-
"""
|
|
166
|
-
Apply a JSON patch to a configuration file with automatic backup.
|
|
167
155
|
|
|
168
|
-
Args:
|
|
169
|
-
patch: Patch object with file, operation, path, value
|
|
170
|
-
target_file: Optional override for the file to patch
|
|
171
|
-
create_backup_file: Whether to create a backup before patching (default: True)
|
|
172
|
-
|
|
173
|
-
Returns:
|
|
174
|
-
Path to the backup file if created, None otherwise
|
|
175
|
-
"""
|
|
176
156
|
file_to_patch = target_file or patch.get("file")
|
|
177
157
|
|
|
178
158
|
if not file_to_patch:
|
|
@@ -193,7 +173,7 @@ def apply_patch(patch: dict, target_file: str = None, create_backup_file: bool =
|
|
|
193
173
|
|
|
194
174
|
# Apply patch based on operation
|
|
195
175
|
operation = patch.get("operation")
|
|
196
|
-
path = patch.get("path"
|
|
176
|
+
path = (patch.get("path") or "").strip("/")
|
|
197
177
|
value = patch.get("value")
|
|
198
178
|
|
|
199
179
|
if operation == "add":
|
|
@@ -235,7 +215,7 @@ def apply_patch(patch: dict, target_file: str = None, create_backup_file: bool =
|
|
|
235
215
|
config_data = json.load(f)
|
|
236
216
|
|
|
237
217
|
operation = patch.get("operation")
|
|
238
|
-
path = patch.get("path"
|
|
218
|
+
path = (patch.get("path") or "").strip("/")
|
|
239
219
|
value = patch.get("value")
|
|
240
220
|
|
|
241
221
|
if operation == "add":
|
|
@@ -289,7 +269,7 @@ def apply_patch(patch: dict, target_file: str = None, create_backup_file: bool =
|
|
|
289
269
|
config_data = toml.load(f)
|
|
290
270
|
|
|
291
271
|
operation = patch.get("operation")
|
|
292
|
-
path = patch.get("path"
|
|
272
|
+
path = (patch.get("path") or "").strip("/")
|
|
293
273
|
value = patch.get("value")
|
|
294
274
|
|
|
295
275
|
if operation == "add":
|
|
@@ -10,11 +10,11 @@ xenfra/main.py,sha256=2EPPuIdxjhW-I-e-Mc0i2ayeLaSJdmzddNThkXq7B7c,2033
|
|
|
10
10
|
xenfra/utils/__init__.py,sha256=4ZRYkrb--vzoXjBHG8zRxz2jCXNGtAoKNtkyu2WRI2A,45
|
|
11
11
|
xenfra/utils/auth.py,sha256=9JbFnv0-rdlJF-4hKD2uWd9h9ehqC1iIHee1O5e-3RM,13769
|
|
12
12
|
xenfra/utils/codebase.py,sha256=GMrqhOJWX8q5ZXSLI9P3hJZBpufXMQA3Z4fKh2XSTNo,5949
|
|
13
|
-
xenfra/utils/config.py,sha256=
|
|
13
|
+
xenfra/utils/config.py,sha256=BylyzHLkL6rmvNNW9zxCaSvk1dV0yzJQPaW-dP7E5j0,13931
|
|
14
14
|
xenfra/utils/errors.py,sha256=6G91YzzDDNkKHANTgfAMiOiMElEyi57wo6-FzRa4VuQ,4211
|
|
15
15
|
xenfra/utils/security.py,sha256=EA8CIPLt8Y-QP5uZ7c5NuC6ZLRV1aZS8NapS9ix_vok,11479
|
|
16
16
|
xenfra/utils/validation.py,sha256=cvuL_AEFJ2oCoP0abCqoOIABOwz79Gkf-jh_dcFIQlM,6912
|
|
17
|
-
xenfra-0.3.
|
|
18
|
-
xenfra-0.3.
|
|
19
|
-
xenfra-0.3.
|
|
20
|
-
xenfra-0.3.
|
|
17
|
+
xenfra-0.3.7.dist-info/WHEEL,sha256=KSLUh82mDPEPk0Bx0ScXlWL64bc8KmzIPNcpQZFV-6E,79
|
|
18
|
+
xenfra-0.3.7.dist-info/entry_points.txt,sha256=a_2cGhYK__X6eW05Ba8uB6RIM_61c2sHtXsPY8N0mic,45
|
|
19
|
+
xenfra-0.3.7.dist-info/METADATA,sha256=P2qLV0wwwrioPQtkXda94RA7FUOBSmKmzOooQCNiD8Q,3898
|
|
20
|
+
xenfra-0.3.7.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|