Skip to content

Commit 9a039cf

Browse files
committed
Introduce VAnnotation
1 parent a23589b commit 9a039cf

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

src/cattrs/v/__init__.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
"""Cattrs validation."""
22

3-
from typing import Callable, List, Union
3+
from typing import Any, Callable, List, Union
4+
5+
from attrs import frozen
46

57
from .._compat import ExceptionGroup
68
from ..errors import (
@@ -32,6 +34,13 @@
3234
]
3335

3436

37+
@frozen
38+
class VAnnotation:
39+
"""Use this with Annotated to get validation."""
40+
41+
validators: tuple[Callable[[Any], Any]]
42+
43+
3544
def format_exception(exc: BaseException, type: Union[type, None]) -> str:
3645
"""The default exception formatter, handling the most common exceptions.
3746

0 commit comments

Comments
 (0)