From 8454cf1e587753b54e72418bf0fd45cdae0b8a1a Mon Sep 17 00:00:00 2001 From: Yannick Augenstein Date: Fri, 13 Oct 2023 11:02:30 -0700 Subject: [PATCH] Remove common types from tidy3d module --- gplugins/tidy3d/component.py | 2 +- gplugins/tidy3d/{custom_types.py => types.py} | 11 ----------- 2 files changed, 1 insertion(+), 12 deletions(-) rename gplugins/tidy3d/{custom_types.py => types.py} (58%) diff --git a/gplugins/tidy3d/component.py b/gplugins/tidy3d/component.py index 9936d4a3..5345a5d8 100644 --- a/gplugins/tidy3d/component.py +++ b/gplugins/tidy3d/component.py @@ -9,7 +9,7 @@ from gplugins.common.base_models.component import LayeredComponentBase -from .custom_types import Tidy3DMedium +from .types import Tidy3DMedium from .util import sort_layers diff --git a/gplugins/tidy3d/custom_types.py b/gplugins/tidy3d/types.py similarity index 58% rename from gplugins/tidy3d/custom_types.py rename to gplugins/tidy3d/types.py index d1ea5951..c4b19486 100644 --- a/gplugins/tidy3d/custom_types.py +++ b/gplugins/tidy3d/types.py @@ -1,10 +1,8 @@ from typing import Annotated, Any import tidy3d as td -from gdsfactory import Component from pydantic.functional_serializers import PlainSerializer from pydantic.functional_validators import AfterValidator -from shapely import GeometryCollection, MultiPolygon, Polygon def validate_medium(v): @@ -19,12 +17,3 @@ def validate_medium(v): AfterValidator(validate_medium), PlainSerializer(lambda x: dict(x), when_used="json"), ] - -AnyShapelyPolygon = Annotated[ - GeometryCollection | MultiPolygon | Polygon, - PlainSerializer(lambda x: x.wkb_hex, when_used="json"), -] - -GFComponent = Annotated[ - Component, PlainSerializer(lambda x: x.to_dict(), when_used="json") -]