Skip to content

Commit

Permalink
Merge pull request #3304 from gdsfactory/remove_dbu_deprecation_warni…
Browse files Browse the repository at this point in the history
…ngs2

remove deprecation warnings
  • Loading branch information
joamatab authored Oct 29, 2024
2 parents 6da585f + d2860eb commit 1aea276
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 171 deletions.
34 changes: 1 addition & 33 deletions gdsfactory/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import klayout.lay as lay
import numpy as np
import yaml
from kfactory import Instance, kdb, logger
from kfactory import Instance, kdb
from kfactory.kcell import PROPID, cell, save_layout_options
from trimesh.scene.scene import Scene

Expand Down Expand Up @@ -111,7 +111,6 @@ def copy(region: kdb.Region) -> kdb.Region:

_deprecated_attributes_instance_settr = _deprecated_attributes - {"size_info"}
_deprecated_attributes_component_gettr = _deprecated_attributes - {"move"}
_deprecation_um = "in um is deprecated and will change to DataBaseUnits in gdsfactory9"


class ComponentReference(kf.Instance):
Expand All @@ -132,18 +131,6 @@ def __getattribute__(self, __k: str) -> Any:
if __k == "_kfinst":
return object.__getattribute__(self, "_kfinst")
if __k in _deprecated_attributes:
deprecation_message = (
f"Getting `{self._kfinst.name}.{__k}` {_deprecation_um}. "
f"Please use `{self._kfinst.name}.d{__k}` instead."
)

warnings.warn(deprecation_message, stacklevel=2)

logger.warning(
f"{deprecation_message} For further information, please consult the migration guide: "
"https://gdsfactory.github.io/gdsfactory/notebooks/21_migration_guide_7_8.html"
)

match __k:
case "center":
return super().dcenter
Expand Down Expand Up @@ -180,16 +167,6 @@ def __getattribute__(self, __k: str) -> Any:
def __setattr__(self, __k: str, __v: Any) -> None:
"""Set attribute with deprecation warning for dbu based attributes."""
if __k in _deprecated_attributes_instance_settr:
deprecation_message_set = (
f"Setting `{self._kfinst.name}.{__k}` {_deprecation_um}. "
f"Please use `{self._kfinst.name}.d{__k}` instead."
)

warnings.warn(deprecation_message_set, stacklevel=2)
logger.warning(
f"{deprecation_message_set} For further information, please consult the migration guide: "
)

return super().__setattr__(f"d{__k}", __v)
super().__setattr__(__k, __v)

Expand Down Expand Up @@ -392,15 +369,6 @@ def add_port(
def __getattribute__(self, __k: str) -> Any:
"""Shadow dbu based attributes with um based ones."""
if __k in _deprecated_attributes_component_gettr:
logger.warning(
f"Getting `{self.name}.{__k}` {_deprecation_um}. "
f"Please use {self.name}.`d{__k}` instead. For further information, please "
"consult the migration guide "
"https://gdsfactory.github.io/gdsfactory/notebooks/"
"21_migration_guide_7_8.html",
# category=DeprecationWarning,
# stacklevel=3,
)
return getattr(self, f"d{__k}")
return super().__getattribute__(__k)

Expand Down
6 changes: 3 additions & 3 deletions gdsfactory/generic_tech/klayout/grain.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<hidden>false</hidden>
<version>8.15.3</version>
<api-version/>
<title>Python Library</title>
<title>Python Library for complex layouts</title>
<doc>GDSFactory Klayout extension.
GDSFactory is a powerful Python library for designing a wide range of complex systems, including photonic circuits, analog devices, quantum components, MEMs, 3D printed objects, and PCBs.</doc>
<doc-url>https://gdsfactory.github.io/gdsfactory/</doc-url>
Expand All @@ -23,8 +23,8 @@ GDSFactory is a powerful Python library for designing a wide range of complex sy
<version>0.3.3</version>
</depends>
<depends>
<name>meta-port/klayout</name>
<name>metainfo-ports/klayout</name>
<url/>
<version>0.1.0</version>
<version>0.1.1</version>
</depends>
</salt-grain>
Loading

0 comments on commit 1aea276

Please sign in to comment.