Skip to content

Commit

Permalink
Eliminate use of from __future__ import annotations in tools.py
Browse files Browse the repository at this point in the history
The use of `from __future__ import annotations` solicit hard to
predict behaviors from Pydantic and Typer in older Python versions
  • Loading branch information
candleindark committed Aug 28, 2024
1 parent 4dbf8ba commit 6975a5a
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/pydantic2linkml/tools.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import annotations

import importlib
import inspect
import re
Expand Down Expand Up @@ -27,11 +25,6 @@ class StrEnum(str, Enum):
pass


class LocallyDefinedFields(NamedTuple):
new: dict[str, FieldSchema]
overriding: dict[str, FieldSchema]


class FieldSchema(NamedTuple):
# The resolved Pydantic core schema of the field
schema: core_schema.CoreSchema
Expand All @@ -51,6 +44,11 @@ class FieldSchema(NamedTuple):
model: type[BaseModel]


class LocallyDefinedFields(NamedTuple):
new: dict[str, FieldSchema]
overriding: dict[str, FieldSchema]


def get_parent_models(model: type[BaseModel]) -> list[type[BaseModel]]:
"""
Get the parent Pydantic models of a Pydantic model
Expand Down

0 comments on commit 6975a5a

Please sign in to comment.