💚 Fix CI installs and tests (#2)
This commit is contained in:
committed by
GitHub
parent
ed0d6701dd
commit
7f8a1a5e3c
@@ -12,7 +12,6 @@ from typing import (
|
||||
Callable,
|
||||
ClassVar,
|
||||
Dict,
|
||||
ForwardRef,
|
||||
List,
|
||||
Mapping,
|
||||
Optional,
|
||||
@@ -30,7 +29,7 @@ from pydantic.errors import ConfigError, DictError
|
||||
from pydantic.fields import FieldInfo as PydanticFieldInfo
|
||||
from pydantic.fields import ModelField, Undefined, UndefinedType
|
||||
from pydantic.main import BaseConfig, ModelMetaclass, validate_model
|
||||
from pydantic.typing import NoArgAnyCallable, resolve_annotations
|
||||
from pydantic.typing import ForwardRef, NoArgAnyCallable, resolve_annotations
|
||||
from pydantic.utils import ROOT_KEY, Representation
|
||||
from sqlalchemy import (
|
||||
Boolean,
|
||||
@@ -343,7 +342,7 @@ class SQLModelMetaclass(ModelMetaclass, DeclarativeMeta):
|
||||
)
|
||||
relationship_to = temp_field.type_
|
||||
if isinstance(temp_field.type_, ForwardRef):
|
||||
relationship_to = temp_field.type_.__forward_arg__
|
||||
relationship_to = temp_field.type_.__forward_arg__ # type: ignore
|
||||
rel_kwargs: Dict[str, Any] = {}
|
||||
if rel_info.back_populates:
|
||||
rel_kwargs["back_populates"] = rel_info.back_populates
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Any, Mapping, Optional, Sequence, TypeVar, Union, overload
|
||||
from typing import Any, Mapping, Optional, Sequence, Type, TypeVar, Union, overload
|
||||
|
||||
from sqlalchemy import util
|
||||
from sqlalchemy.orm import Query as _Query
|
||||
@@ -118,13 +118,13 @@ class Session(_Session):
|
||||
|
||||
def get(
|
||||
self,
|
||||
entity: _T,
|
||||
entity: Type[_T],
|
||||
ident: Any,
|
||||
options: Optional[Sequence[Any]] = None,
|
||||
populate_existing: bool = False,
|
||||
with_for_update: Optional[Union[Literal[True], Mapping[str, Any]]] = None,
|
||||
identity_token: Optional[Any] = None,
|
||||
) -> _T:
|
||||
) -> Optional[_T]:
|
||||
return super().get(
|
||||
entity,
|
||||
ident,
|
||||
|
||||
@@ -45,10 +45,10 @@ else:
|
||||
class GenericSelectMeta(GenericMeta, _Select.__class__): # type: ignore
|
||||
pass
|
||||
|
||||
class _Py36Select(_Select, Generic[_TSelect], metaclass=GenericSelectMeta):
|
||||
class _Py36Select(_Select, Generic[_TSelect], metaclass=GenericSelectMeta): # type: ignore
|
||||
pass
|
||||
|
||||
class _Py36SelectOfScalar(_Select, Generic[_TSelect], metaclass=GenericSelectMeta):
|
||||
class _Py36SelectOfScalar(_Select, Generic[_TSelect], metaclass=GenericSelectMeta): # type: ignore
|
||||
pass
|
||||
|
||||
# Cast them for editors to work correctly, from several tricks tried, this works
|
||||
|
||||
Reference in New Issue
Block a user