From 7cac467347566fefc93e83ca688dc9df45fec1dd Mon Sep 17 00:00:00 2001 From: Yannick Augenstein Date: Fri, 1 Dec 2023 08:45:51 -0800 Subject: [PATCH 1/2] Check for AbstractMedium instead of Medium in validator --- gplugins/tidy3d/types.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gplugins/tidy3d/types.py b/gplugins/tidy3d/types.py index 0365bd37..9432c208 100644 --- a/gplugins/tidy3d/types.py +++ b/gplugins/tidy3d/types.py @@ -10,7 +10,7 @@ def validate_medium(v): # Check if the input is an instance of td.Medium assert isinstance( - v, td.Medium + v, td.AbstractMedium ), f"Input should be an instance of {td.Medium}, but got {type(v)} instead" return v From 78574a7ae8779bd84a7dc97183ba4b41f9eb2e51 Mon Sep 17 00:00:00 2001 From: Yannick Augenstein Date: Fri, 1 Dec 2023 08:53:01 -0800 Subject: [PATCH 2/2] Better error message --- gplugins/tidy3d/types.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gplugins/tidy3d/types.py b/gplugins/tidy3d/types.py index 9432c208..ddc64526 100644 --- a/gplugins/tidy3d/types.py +++ b/gplugins/tidy3d/types.py @@ -11,7 +11,7 @@ def validate_medium(v): # Check if the input is an instance of td.Medium assert isinstance( v, td.AbstractMedium - ), f"Input should be an instance of {td.Medium}, but got {type(v)} instead" + ), f"Input should be a tidy3d medium, but got {type(v)} instead" return v