From 7cd3cd5f0f0393459ef746009ab80c27296eb49e Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Thu, 19 Sep 2024 06:57:08 +0200 Subject: Merging upstream version 7.4.7. Signed-off-by: Daniel Baumann --- tests/roots/test-ext-autodoc/target/annotated.py | 36 +++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) (limited to 'tests/roots/test-ext-autodoc/target') diff --git a/tests/roots/test-ext-autodoc/target/annotated.py b/tests/roots/test-ext-autodoc/target/annotated.py index 5b87518..7adc3e0 100644 --- a/tests/roots/test-ext-autodoc/target/annotated.py +++ b/tests/roots/test-ext-autodoc/target/annotated.py @@ -1,8 +1,42 @@ -from __future__ import annotations +# from __future__ import annotations +import dataclasses +import types from typing import Annotated +@dataclasses.dataclass(frozen=True) +class FuncValidator: + func: types.FunctionType + + +@dataclasses.dataclass(frozen=True) +class MaxLen: + max_length: int + whitelisted_words: list[str] + + +def validate(value: str) -> str: + return value + + +#: Type alias for a validated string. +ValidatedString = Annotated[str, FuncValidator(validate)] + + def hello(name: Annotated[str, "attribute"]) -> None: """docstring""" pass + + +class AnnotatedAttributes: + """docstring""" + + #: Docstring about the ``name`` attribute. + name: Annotated[str, "attribute"] + + #: Docstring about the ``max_len`` attribute. + max_len: list[Annotated[str, MaxLen(10, ['word_one', 'word_two'])]] + + #: Docstring about the ``validated`` attribute. + validated: ValidatedString -- cgit v1.2.3