diff --git a/tidy3d/web/api/autograd/utils.py b/tidy3d/web/api/autograd/utils.py index 845cd5219..13367330d 100644 --- a/tidy3d/web/api/autograd/utils.py +++ b/tidy3d/web/api/autograd/utils.py @@ -66,11 +66,11 @@ def E_to_D(fld_data: td.FieldData, eps_data: td.PermittivityData) -> td.FieldDat def multiply_field_data( - fld_1: td.FieldData, fld_2: td.FieldData | td.PermittivityData + fld_1: td.FieldData, fld_2: typing.Union[td.FieldData, td.PermittivityData] ) -> td.FieldData: """Elementwise multiply two field data objects, writes data into ``fld_1`` copy.""" - def get_field_key(dim: str, fld_data: td.FieldData | td.PermittivityData) -> str: + def get_field_key(dim: str, fld_data: typing.Union[td.FieldData, td.PermittivityData]) -> str: """Get the key corresponding to the scalar field along this dimension.""" return f"E{dim}" if isinstance(fld_data, td.FieldData) else f"eps_{dim}{dim}" diff --git a/tidy3d/web/api/autograd_old.py b/tidy3d/web/api/autograd_old.py index 625c555ba..1092324fe 100644 --- a/tidy3d/web/api/autograd_old.py +++ b/tidy3d/web/api/autograd_old.py @@ -59,11 +59,11 @@ def derivative_map_D( def multiply_field_data( - fld_1: td.FieldData, fld_2: td.FieldData | td.PermittivityData + fld_1: td.FieldData, fld_2: typing.Union[td.FieldData, td.PermittivityData] ) -> td.FieldData: """Elementwise multiply two field data objects, writes data into ``fld_1`` copy.""" - def get_field_key(dim: str, fld_data: td.FieldData | td.PermittivityData) -> str: + def get_field_key(dim: str, fld_data: typing.Union[td.FieldData, td.PermittivityData]) -> str: """Get the key corresponding to the scalar field along this dimension.""" return f"E{dim}" if isinstance(fld_data, td.FieldData) else f"eps_{dim}{dim}"