summaryrefslogtreecommitdiffstats
path: root/cfgv.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-08-14 10:18:53 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-08-14 10:18:53 +0000
commit82bb919828cbe531a83835b87dade5a3a74c7c9c (patch)
tree67c33bb03cc7bbd4854d3e8e73209b9193e92204 /cfgv.py
parentAdding upstream version 3.3.1. (diff)
downloadcfgv-82bb919828cbe531a83835b87dade5a3a74c7c9c.tar.xz
cfgv-82bb919828cbe531a83835b87dade5a3a74c7c9c.zip
Adding upstream version 3.4.0.upstream/3.4.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'cfgv.py')
-rw-r--r--cfgv.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/cfgv.py b/cfgv.py
index 701d944..27ddd98 100644
--- a/cfgv.py
+++ b/cfgv.py
@@ -1,3 +1,5 @@
+from __future__ import annotations
+
import collections
import contextlib
import os.path
@@ -390,12 +392,15 @@ def load_from_filename(
schema,
load_strategy,
exc_tp=ValidationError,
+ *,
+ display_filename=None,
):
+ display_filename = display_filename or filename
with reraise_as(exc_tp):
if not os.path.isfile(filename):
- raise ValidationError(f'{filename} is not a file')
+ raise ValidationError(f'{display_filename} is not a file')
- with validate_context(f'File {filename}'):
+ with validate_context(f'File {display_filename}'):
try:
with open(filename, encoding='utf-8') as f:
contents = f.read()