Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.11/site-packages/pydantic/_internal/_forward_ref.py: 85%

Shortcuts on this page

r m x   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

13 statements  

1from __future__ import annotations as _annotations 

2 

3from dataclasses import dataclass 

4from typing import Union 

5 

6 

7@dataclass 

8class PydanticRecursiveRef: 

9 type_ref: str 

10 

11 __name__ = 'PydanticRecursiveRef' 

12 __hash__ = object.__hash__ 

13 

14 def __call__(self) -> None: 

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): 

20 return Union[self, other] # type: ignore 

21 

22 def __ror__(self, other): 

23 return Union[other, self] # type: ignore