Skip to content

Commit

Permalink
remove line
Browse files Browse the repository at this point in the history
  • Loading branch information
tlambert03 committed Jan 3, 2025
1 parent e6b08bf commit d5b514b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
7 changes: 1 addition & 6 deletions src/ome_autogen/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,12 +182,7 @@ def _build_typed_dicts(package_dir: str) -> None:
def foo(**kwargs: Unpack[ome.ImageDict]) -> None:
...
"""
# sourcery skip: assign-if-exp, reintroduce-else
try:
from pydantic._internal._repr import display_as_type
except ImportError:
# don't try to do this on pydantic1
return
from pydantic._internal._repr import display_as_type

from ome_types import model
from ome_types._mixins._base_type import OMEType
Expand Down
6 changes: 1 addition & 5 deletions src/ome_types/_pydantic_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,9 @@ def field_regex(obj: type[BaseModel], field_name: str) -> str | None:
# typing is incorrect at the moment, but may indicate breakage in pydantic 3
field_info = obj.model_fields[field_name] # type: ignore [index]
meta = field_info.json_schema_extra or {}
# if a "metadata" key exists... use it.
# After pydantic-compat 0.2, this is where it will be.
if "metadata" in meta: # type: ignore
meta = meta["metadata"] # type: ignore
if meta:
return meta.get("pattern") # type: ignore
return None
return None # pragma: no cover


kw: dict = {"validated_data": {}} if pydantic_version >= (2, 10) else {}
Expand Down

0 comments on commit d5b514b

Please sign in to comment.