Skip to content

Commit 5429e9b

Browse files
phi-fridaytiangolo
andauthored
🐛 Fix type annotations for Model.parse_obj(), and Model.validate() (#321)
Co-authored-by: Sebastián Ramírez <[email protected]>
1 parent c743647 commit 5429e9b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

sqlmodel/main.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -558,8 +558,8 @@ def from_orm(
558558

559559
@classmethod
560560
def parse_obj(
561-
cls: Type["SQLModel"], obj: Any, update: Optional[Dict[str, Any]] = None
562-
) -> "SQLModel":
561+
cls: Type[_TSQLModel], obj: Any, update: Optional[Dict[str, Any]] = None
562+
) -> _TSQLModel:
563563
obj = cls._enforce_dict_if_root(obj)
564564
# SQLModel, support update dict
565565
if update is not None:
@@ -573,7 +573,7 @@ def __repr_args__(self) -> Sequence[Tuple[Optional[str], Any]]:
573573

574574
# From Pydantic, override to enforce validation with dict
575575
@classmethod
576-
def validate(cls: Type["SQLModel"], value: Any) -> "SQLModel":
576+
def validate(cls: Type[_TSQLModel], value: Any) -> _TSQLModel:
577577
if isinstance(value, cls):
578578
return value.copy() if cls.__config__.copy_on_model_validation else value
579579

0 commit comments

Comments
 (0)