Skip to content

Commit

Permalink
CU-8695d4www: Add type ignore comments to pydantic2 versions in versi…
Browse files Browse the repository at this point in the history
…oning utils for typing during GHA workflow
  • Loading branch information
mart-r committed Aug 29, 2024
1 parent 44e470a commit 9eab8f0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions medcat/utils/pydantic_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ def get_model_dump(obj: BaseModel, **kwargs) -> dict:
"""
# NOTE: The type ingores are based on pydantic 2
if HAS_PYDANTIC2:
return obj.model_dump(**kwargs)
return obj.model_dump(**kwargs) # type: ignore
# for before pydantic 2
return obj.dict(**kwargs) # type: ignore # 4pydantic1 - backwards compatibility


def get_model_fields(obj: BaseModel) -> dict:
if HAS_PYDANTIC2:
return obj.model_fields
return obj.model_fields # type: ignore
return obj.__fields__ # type: ignore # 4pydantic1 - backwards compatibility

0 comments on commit 9eab8f0

Please sign in to comment.