Revert "allow ports2data to take a tree"
This reverts commit 44f823c736
.
LazyLibrary can't take Trees anymore, so no need for it.
This commit is contained in:
parent
1d649389a0
commit
d079b44883
@ -6,7 +6,7 @@ and retrieving it (`data_to_ports`).
|
|||||||
the port locations. This particular approach is just a sensible default; feel free to
|
the port locations. This particular approach is just a sensible default; feel free to
|
||||||
to write equivalent functions for your own format or alternate storage methods.
|
to write equivalent functions for your own format or alternate storage methods.
|
||||||
"""
|
"""
|
||||||
from typing import Sequence, Optional, Mapping, Union
|
from typing import Sequence, Optional, Mapping
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import numpy
|
import numpy
|
||||||
@ -16,13 +16,13 @@ from ..label import Label
|
|||||||
from ..utils import layer_t
|
from ..utils import layer_t
|
||||||
from ..ports import Port
|
from ..ports import Port
|
||||||
from ..error import PatternError
|
from ..error import PatternError
|
||||||
from ..library import Library, WrapROLibrary, Tree
|
from ..library import Library, WrapROLibrary
|
||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def ports_to_data(pattern_or_tree: Union[Pattern, Tree], layer: layer_t) -> Union[Pattern, Tree]:
|
def ports_to_data(pattern: Pattern, layer: layer_t) -> Pattern:
|
||||||
"""
|
"""
|
||||||
Place a text label at each port location, specifying the port data in the format
|
Place a text label at each port location, specifying the port data in the format
|
||||||
'name:ptype angle_deg'
|
'name:ptype angle_deg'
|
||||||
@ -39,11 +39,6 @@ def ports_to_data(pattern_or_tree: Union[Pattern, Tree], layer: layer_t) -> Unio
|
|||||||
Returns:
|
Returns:
|
||||||
`pattern`
|
`pattern`
|
||||||
"""
|
"""
|
||||||
pattern: Pattern
|
|
||||||
if isinstance(pattern_or_tree, Tree):
|
|
||||||
pattern = pattern_or_tree[pattern_or_tree.top]
|
|
||||||
else:
|
|
||||||
pattern = pattern_or_tree
|
|
||||||
for name, port in pattern.ports.items():
|
for name, port in pattern.ports.items():
|
||||||
if port.rotation is None:
|
if port.rotation is None:
|
||||||
angle_deg = numpy.inf
|
angle_deg = numpy.inf
|
||||||
@ -52,7 +47,7 @@ def ports_to_data(pattern_or_tree: Union[Pattern, Tree], layer: layer_t) -> Unio
|
|||||||
pattern.labels += [
|
pattern.labels += [
|
||||||
Label(string=f'{name}:{port.ptype} {angle_deg:g}', layer=layer, offset=port.offset)
|
Label(string=f'{name}:{port.ptype} {angle_deg:g}', layer=layer, offset=port.offset)
|
||||||
]
|
]
|
||||||
return pattern_or_tree
|
return pattern
|
||||||
|
|
||||||
|
|
||||||
def data_to_ports(
|
def data_to_ports(
|
||||||
|
Loading…
Reference in New Issue
Block a user