Coverage for pydantic / _internal / _forward_ref.py: 100.00%

13 statements  

« prev     ^ index     » next       coverage.py v7.13.5, created at 2026-11-21 11:56 +0000

1from __future__ import annotations as _annotations 1abcdefghijklsmnopqr

2 

3from dataclasses import dataclass 1abcdefghijklsmnopqr

4from typing import Union 1abcdefghijklsmnopqr

5 

6 

7@dataclass 1abcdefghijklsmnopqr

8class PydanticRecursiveRef: 1abcdefghijklsmnopqr

9 type_ref: str 1abcdefghijklsmnopqr

10 

11 __name__ = 'PydanticRecursiveRef' 1abcdefghijklsmnopqr

12 __hash__ = object.__hash__ 1abcdefghijklsmnopqr

13 

14 def __call__(self) -> None: 1abcdefghijklsmnopqr

15 """Defining __call__ is necessary for the `typing` module to let you use an instance of 

16 this class as the result of resolving a standard ForwardRef. 

17 """ 

18 

19 def __or__(self, other): 1abcdefghijklsmnopqr

20 return Union[self, other] # type: ignore # noqa: UP007 1abcdefghijklmnopqr

21 

22 def __ror__(self, other): 1abcdefghijklsmnopqr

23 return Union[other, self] # type: ignore # noqa: UP007 1abcdefghijklmnopqr