Linux cesa-www-main 6.1.0-49-cloud-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.174-1 (2026-05-26) x86_64
Apache/2.4.68 (Debian)
Server IP : 10.218.0.2 & Your IP : 216.73.216.28
Domains :
Cant Read [ /etc/named.conf ]
User : www-data
Terminal
Auto Root
Create File
Create Folder
Localroot Suggester
Backdoor Destroyer
Readme
/
usr /
lib /
google-cloud-sdk /
lib /
third_party /
cattrs /
Delete
Unzip
Name
Size
Permission
Date
Action
__pycache__
[ DIR ]
drwxr-xr-x
2026-06-08 18:08
gen
[ DIR ]
drwxr-xr-x
2026-06-08 18:08
preconf
[ DIR ]
drwxr-xr-x
2026-06-08 18:08
strategies
[ DIR ]
drwxr-xr-x
2026-06-08 18:08
LICENSE
1.05
KB
-rw-r--r--
1980-01-01 08:00
__init__.py
1.86
KB
-rw-r--r--
1980-01-01 08:00
_compat.py
12.66
KB
-rw-r--r--
1980-01-01 08:00
_generics.py
966
B
-rw-r--r--
1980-01-01 08:00
cols.py
10.11
KB
-rw-r--r--
1980-01-01 08:00
converters.py
53.97
KB
-rw-r--r--
1980-01-01 08:00
disambiguators.py
6.7
KB
-rw-r--r--
1980-01-01 08:00
dispatch.py
6.62
KB
-rw-r--r--
1980-01-01 08:00
errors.py
4.24
KB
-rw-r--r--
1980-01-01 08:00
fns.py
626
B
-rw-r--r--
1980-01-01 08:00
literals.py
331
B
-rw-r--r--
1980-01-01 08:00
py.typed
0
B
-rw-r--r--
1980-01-01 08:00
subclasses.py
783
B
-rw-r--r--
1980-01-01 08:00
typealiases.py
1.58
KB
-rw-r--r--
1980-01-01 08:00
types.py
278
B
-rw-r--r--
1980-01-01 08:00
v.py
4.03
KB
-rw-r--r--
1980-01-01 08:00
Save
Rename
"""Cattrs validation.""" from typing import Callable, Union from .errors import ( ClassValidationError, ForbiddenExtraKeysError, IterableValidationError, ) __all__ = ["format_exception", "transform_error"] def format_exception(exc: BaseException, type: Union[type, None]) -> str: """The default exception formatter, handling the most common exceptions. The following exceptions are handled specially: * `KeyErrors` (`required field missing`) * `ValueErrors` (`invalid value for type, expected <type>` or just `invalid value`) * `TypeErrors` (`invalid value for type, expected <type>` and a couple special cases for iterables) * `cattrs.ForbiddenExtraKeysError` * some `AttributeErrors` (special cased for structing mappings) """ if isinstance(exc, KeyError): res = "required field missing" elif isinstance(exc, ValueError): if type is not None: tn = type.__name__ if hasattr(type, "__name__") else repr(type) res = f"invalid value for type, expected {tn}" else: res = "invalid value" elif isinstance(exc, TypeError): if type is None: if exc.args[0].endswith("object is not iterable"): res = "invalid value for type, expected an iterable" else: res = f"invalid type ({exc})" else: tn = type.__name__ if hasattr(type, "__name__") else repr(type) res = f"invalid value for type, expected {tn}" elif isinstance(exc, ForbiddenExtraKeysError): res = f"extra fields found ({', '.join(exc.extra_fields)})" elif isinstance(exc, AttributeError) and exc.args[0].endswith( "object has no attribute 'items'" ): # This was supposed to be a mapping (and have .items()) but it something else. res = "expected a mapping" else: res = f"unknown error ({exc})" return res def transform_error( exc: Union[ClassValidationError, IterableValidationError, BaseException], path: str = "$", format_exception: Callable[ [BaseException, Union[type, None]], str ] = format_exception, ) -> list[str]: """Transform an exception into a list of error messages. To get detailed error messages, the exception should be produced by a converter with `detailed_validation` set. By default, the error messages are in the form of `{description} @ {path}`. While traversing the exception and subexceptions, the path is formed: * by appending `.{field_name}` for fields in classes * by appending `[{int}]` for indices in iterables, like lists * by appending `[{str}]` for keys in mappings, like dictionaries :param exc: The exception to transform into error messages. :param path: The root path to use. :param format_exception: A callable to use to transform `Exceptions` into string descriptions of errors. .. versionadded:: 23.1.0 """ errors = [] if isinstance(exc, IterableValidationError): with_notes, without = exc.group_exceptions() for exc, note in with_notes: p = f"{path}[{note.index!r}]" if isinstance(exc, (ClassValidationError, IterableValidationError)): errors.extend(transform_error(exc, p, format_exception)) else: errors.append(f"{format_exception(exc, note.type)} @ {p}") for exc in without: errors.append(f"{format_exception(exc, None)} @ {path}") elif isinstance(exc, ClassValidationError): with_notes, without = exc.group_exceptions() for exc, note in with_notes: p = f"{path}.{note.name}" if isinstance(exc, (ClassValidationError, IterableValidationError)): errors.extend(transform_error(exc, p, format_exception)) else: errors.append(f"{format_exception(exc, note.type)} @ {p}") for exc in without: errors.append(f"{format_exception(exc, None)} @ {path}") else: errors.append(f"{format_exception(exc, None)} @ {path}") return errors