Merging upstream version 3.4.0.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
0baf3577f1
commit
ba12874741
11 changed files with 94 additions and 68 deletions
9
cfgv.py
9
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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue