Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make cattrs and cattr.errors namespaces contain all error types from cattrs.errors #252

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ History
* Uncap the required Python version, to avoid problems detailed in https://iscinumpy.dev/post/bound-version-constraints/#pinning-the-python-version-is-special (`#275 <https://github.com/python-attrs/cattrs/issues/275>`_)
* Fix `Converter.register_structure_hook_factory` and `cattrs.gen.make_dict_unstructure_fn` type annotations.
(`#281 <https://github.com/python-attrs/cattrs/issues/281>`_)
* Expose all error classes in the `cattr.errors` namespace. Note that it is deprecated, just use `cattrs.errors`. (`#252 <https://github.com/python-attrs/cattrs/issues/252>`_)

22.1.0 (2022-04-03)
-------------------
Expand Down
16 changes: 14 additions & 2 deletions src/cattr/errors.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
from cattrs.errors import StructureHandlerNotFoundError
from cattrs.errors import (
BaseValidationError,
ClassValidationError,
ForbiddenExtraKeysError,
IterableValidationError,
StructureHandlerNotFoundError,
)

__all__ = ["StructureHandlerNotFoundError"]
__all__ = [
"BaseValidationError",
"ClassValidationError",
"ForbiddenExtraKeysError",
"IterableValidationError",
"StructureHandlerNotFoundError",
]
19 changes: 16 additions & 3 deletions src/cattrs/__init__.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,38 @@
from .converters import BaseConverter, Converter, GenConverter, UnstructureStrategy
from .errors import (
BaseValidationError,
ClassValidationError,
ForbiddenExtraKeysError,
IterableValidationError,
StructureHandlerNotFoundError,
)

from .gen import override

__all__ = (
"BaseConverter",
"BaseValidationError",
"ClassValidationError",
"Converter",
"converters",
"disambiguators",
"dispatch",
"errors",
"ForbiddenExtraKeysError",
"gen",
"GenConverter",
"global_converter",
"IterableValidationError",
"override",
"preconf",
"register_structure_hook_func",
"register_structure_hook",
"register_unstructure_hook_func",
"register_structure_hook_func",
"register_unstructure_hook",
"register_unstructure_hook_func",
"structure",
"structure_attrs_fromdict",
"structure_attrs_fromtuple",
"structure",
"StructureHandlerNotFoundError",
"unstructure",
"UnstructureStrategy",
)
Expand Down