Use a tuple for .identifier

This commit is contained in:
Jan Petykiewicz 2020-05-11 18:59:47 -07:00
parent 00394a62f0
commit 8493364e9c

View File

@ -367,7 +367,7 @@ def read(stream: io.BufferedIOBase,
patterns_dict = dict(((p.name, p) for p in patterns)) patterns_dict = dict(((p.name, p) for p in patterns))
for p in patterns_dict.values(): for p in patterns_dict.values():
for sp in p.subpatterns: for sp in p.subpatterns:
sp.pattern = patterns_dict[sp.identifier.decode('ASCII')] sp.pattern = patterns_dict[sp.identifier[0].decode('ASCII')]
del sp.identifier del sp.identifier
return patterns_dict, library_info return patterns_dict, library_info
@ -390,7 +390,7 @@ def _mlayer2gds(mlayer: layer_t) -> Tuple[int, int]:
def _sref_to_subpat(element: gdsii.elements.SRef) -> SubPattern: def _sref_to_subpat(element: gdsii.elements.SRef) -> SubPattern:
""" """
Helper function to create a SubPattern from an SREF. Sets subpat.pattern to None Helper function to create a SubPattern from an SREF. Sets subpat.pattern to None
and sets the instance .identifier to the struct_name. and sets the instance .identifier to (struct_name,).
BUG: BUG:
"Absolute" means not affected by parent elements. "Absolute" means not affected by parent elements.
@ -398,7 +398,7 @@ def _sref_to_subpat(element: gdsii.elements.SRef) -> SubPattern:
undo the parent transformations, or implement it in masque. undo the parent transformations, or implement it in masque.
""" """
subpat = SubPattern(pattern=None, offset=element.xy) subpat = SubPattern(pattern=None, offset=element.xy)
subpat.identifier = element.struct_name subpat.identifier = (element.struct_name,)
if element.strans is not None: if element.strans is not None:
if element.mag is not None: if element.mag is not None:
subpat.scale = element.mag subpat.scale = element.mag
@ -421,7 +421,7 @@ def _sref_to_subpat(element: gdsii.elements.SRef) -> SubPattern:
def _aref_to_gridrep(element: gdsii.elements.ARef) -> GridRepetition: def _aref_to_gridrep(element: gdsii.elements.ARef) -> GridRepetition:
""" """
Helper function to create a GridRepetition from an AREF. Sets gridrep.pattern to None Helper function to create a GridRepetition from an AREF. Sets gridrep.pattern to None
and sets the instance .identifier to the struct_name. and sets the instance .identifier to (struct_name,).
BUG: BUG:
"Absolute" means not affected by parent elements. "Absolute" means not affected by parent elements.
@ -461,7 +461,7 @@ def _aref_to_gridrep(element: gdsii.elements.ARef) -> GridRepetition:
rotation=rotation, rotation=rotation,
scale=scale, scale=scale,
mirrored=(mirror_across_x, False)) mirrored=(mirror_across_x, False))
gridrep.identifier = element.struct_name gridrep.identifier = (element.struct_name,)
return gridrep return gridrep