pre-commit autoupdate
This commit is contained in:
parent
c306e2eaae
commit
d129b1f756
|
@ -4,12 +4,12 @@ ci:
|
|||
|
||||
repos:
|
||||
- repo: https://github.com/psf/black
|
||||
rev: 24.2.0
|
||||
rev: 24.3.0
|
||||
hooks:
|
||||
- id: black
|
||||
|
||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||
rev: v0.2.2
|
||||
rev: v0.3.3
|
||||
hooks:
|
||||
- id: ruff
|
||||
args: [--fix, --exit-non-zero-on-fix]
|
||||
|
|
|
@ -97,12 +97,7 @@ class _InstanceOfValidator:
|
|||
We use a callable class to be able to change the ``__repr__``.
|
||||
"""
|
||||
if not isinstance(value, self.type):
|
||||
msg = "'{name}' must be {type!r} (got {value!r} that is a {actual!r}).".format(
|
||||
name=attr.name,
|
||||
type=self.type,
|
||||
actual=value.__class__,
|
||||
value=value,
|
||||
)
|
||||
msg = f"'{attr.name}' must be {self.type!r} (got {value!r} that is a {value.__class__!r})."
|
||||
raise TypeError(
|
||||
msg,
|
||||
attr,
|
||||
|
@ -140,9 +135,7 @@ class _MatchesReValidator:
|
|||
We use a callable class to be able to change the ``__repr__``.
|
||||
"""
|
||||
if not self.match_func(value):
|
||||
msg = "'{name}' must match regex {pattern!r} ({value!r} doesn't)".format(
|
||||
name=attr.name, pattern=self.pattern.pattern, value=value
|
||||
)
|
||||
msg = f"'{attr.name}' must match regex {self.pattern.pattern!r} ({value!r} doesn't)"
|
||||
raise ValueError(
|
||||
msg,
|
||||
attr,
|
||||
|
@ -206,9 +199,7 @@ class _ProvidesValidator:
|
|||
We use a callable class to be able to change the ``__repr__``.
|
||||
"""
|
||||
if not self.interface.providedBy(value):
|
||||
msg = "'{name}' must provide {interface!r} which {value!r} doesn't.".format(
|
||||
name=attr.name, interface=self.interface, value=value
|
||||
)
|
||||
msg = f"'{attr.name}' must provide {self.interface!r} which {value!r} doesn't."
|
||||
raise TypeError(
|
||||
msg,
|
||||
attr,
|
||||
|
@ -426,9 +417,7 @@ class _DeepMapping:
|
|||
self.value_validator(inst, attr, value[key])
|
||||
|
||||
def __repr__(self):
|
||||
return (
|
||||
"<deep_mapping validator for objects mapping {key!r} to {value!r}>"
|
||||
).format(key=self.key_validator, value=self.value_validator)
|
||||
return f"<deep_mapping validator for objects mapping {self.key_validator!r} to {self.value_validator!r}>"
|
||||
|
||||
|
||||
def deep_mapping(key_validator, value_validator, mapping_validator=None):
|
||||
|
@ -640,12 +629,7 @@ class _NotValidator:
|
|||
)
|
||||
|
||||
def __repr__(self):
|
||||
return (
|
||||
"<not_ validator wrapping {what!r}, capturing {exc_types!r}>"
|
||||
).format(
|
||||
what=self.validator,
|
||||
exc_types=self.exc_types,
|
||||
)
|
||||
return f"<not_ validator wrapping {self.validator!r}, capturing {self.exc_types!r}>"
|
||||
|
||||
|
||||
def not_(validator, *, msg=None, exc_types=(ValueError, TypeError)):
|
||||
|
|
|
@ -443,14 +443,14 @@ class TestOptional:
|
|||
|
||||
if isinstance(validator, list):
|
||||
repr_s = (
|
||||
"<optional validator for _AndValidator(_validators=[{func}, "
|
||||
f"<optional validator for _AndValidator(_validators=[{always_pass!r}, "
|
||||
"<instance_of validator for type <class 'int'>>]) or None>"
|
||||
).format(func=repr(always_pass))
|
||||
)
|
||||
elif isinstance(validator, tuple):
|
||||
repr_s = (
|
||||
"<optional validator for _AndValidator(_validators=({func}, "
|
||||
f"<optional validator for _AndValidator(_validators=({always_pass!r}, "
|
||||
"<instance_of validator for type <class 'int'>>)) or None>"
|
||||
).format(func=repr(always_pass))
|
||||
)
|
||||
else:
|
||||
repr_s = (
|
||||
"<optional validator for <instance_of validator for type "
|
||||
|
@ -1180,8 +1180,8 @@ class TestNot_:
|
|||
|
||||
assert (
|
||||
(
|
||||
"not_ validator child '{!r}' did not raise a captured error"
|
||||
).format(always_passes),
|
||||
f"not_ validator child '{always_passes!r}' did not raise a captured error"
|
||||
),
|
||||
a,
|
||||
always_passes,
|
||||
input_value,
|
||||
|
@ -1276,8 +1276,8 @@ class TestNot_:
|
|||
|
||||
assert (
|
||||
(
|
||||
"not_ validator child '{!r}' did not raise a captured error"
|
||||
).format(instance_of((int, float))),
|
||||
f"not_ validator child '{instance_of((int, float))!r}' did not raise a captured error"
|
||||
),
|
||||
a,
|
||||
wrapped,
|
||||
input_value,
|
||||
|
|
Loading…
Reference in New Issue