add internal forwardref stub
This commit is contained in:
@ -3,12 +3,13 @@ from dataclasses import dataclass
|
||||
from typing import Any, List, Optional, TYPE_CHECKING, Tuple, Type, Union
|
||||
|
||||
from pydantic import BaseModel, create_model
|
||||
from pydantic.typing import ForwardRef, evaluate_forwardref
|
||||
from pydantic.typing import evaluate_forwardref
|
||||
from sqlalchemy import UniqueConstraint
|
||||
|
||||
import ormar # noqa I101
|
||||
from ormar.exceptions import RelationshipInstanceError
|
||||
from ormar.fields.base import BaseField
|
||||
from ormar.protocols.forward_ref import ForwardRef
|
||||
|
||||
if TYPE_CHECKING: # pragma no cover
|
||||
from ormar.models import Model, NewBaseModel
|
||||
|
||||
@ -1,9 +1,10 @@
|
||||
from typing import Any, List, Optional, TYPE_CHECKING, Tuple, Type, Union
|
||||
|
||||
from pydantic.typing import ForwardRef, evaluate_forwardref
|
||||
from pydantic.typing import evaluate_forwardref
|
||||
import ormar # noqa: I100
|
||||
from ormar.fields import BaseField
|
||||
from ormar.fields.foreign_key import ForeignKeyField
|
||||
from ormar.protocols.forward_ref import ForwardRef
|
||||
|
||||
if TYPE_CHECKING: # pragma no cover
|
||||
from ormar.models import Model
|
||||
|
||||
@ -1,9 +1,10 @@
|
||||
from typing import Dict, List, Optional, TYPE_CHECKING, Tuple, Type
|
||||
|
||||
from pydantic.typing import ForwardRef
|
||||
|
||||
import ormar # noqa: I100
|
||||
from ormar.fields.foreign_key import ForeignKeyField
|
||||
from ormar.models.helpers.pydantic import populate_pydantic_default_values
|
||||
from ormar.protocols.forward_ref import ForwardRef
|
||||
|
||||
if TYPE_CHECKING: # pragma no cover
|
||||
from ormar import Model
|
||||
|
||||
22
ormar/protocols/forward_ref.py
Normal file
22
ormar/protocols/forward_ref.py
Normal file
@ -0,0 +1,22 @@
|
||||
import sys
|
||||
from typing import Any, TYPE_CHECKING
|
||||
|
||||
if sys.version_info < (3, 7): # pragma: no cover
|
||||
if TYPE_CHECKING:
|
||||
|
||||
class ForwardRef:
|
||||
|
||||
_gorg = None
|
||||
|
||||
def __init__(self, args: Any) -> None:
|
||||
pass
|
||||
|
||||
def _eval_type(self, globalns: Any, localns: Any) -> Any:
|
||||
pass
|
||||
|
||||
else:
|
||||
from typing import _ForwardRef as ForwardRef
|
||||
else:
|
||||
from typing import ForwardRef
|
||||
|
||||
ForwardRef = ForwardRef
|
||||
Reference in New Issue
Block a user