misc fixes

This commit is contained in:
Jan Petykiewicz 2023-02-07 14:24:34 -08:00 committed by jan
parent d349aa3366
commit 2ccef554db
3 changed files with 7 additions and 4 deletions

View File

@ -345,6 +345,7 @@ class FlatBuilder(PortList):
other_copy.mirror2d(mirrored)
other_copy.rotate_around(pivot, rotation)
other_copy.translate_elements(offset)
other_copy.ports.clear()
self.pattern.append(other_copy)
return self

View File

@ -493,7 +493,7 @@ class MutableLibrary(Library, MutableMapping[str, 'Pattern'], metaclass=ABCMeta)
Returns:
(name, pattern) tuple
"""
from .pattern import Pattern
from .pattern import NamedPattern
#name = self.get_name(base_name)
npat = NamedPattern(name)
self[name] = npat
@ -550,7 +550,7 @@ class MutableLibrary(Library, MutableMapping[str, 'Pattern'], metaclass=ABCMeta)
if internal_conflicts:
raise LibraryError('Renamed patterns conflict with un-renamed names in `other`' + pformat(internal_conflicts))
conflicts = set(self.keys()) & renamed
conflicts = set(self.keys()) & set(rename_map.values())
if conflicts:
raise LibraryError('Unresolved duplicate keys encountered in library merge: ' + pformat(conflicts))
@ -559,6 +559,8 @@ class MutableLibrary(Library, MutableMapping[str, 'Pattern'], metaclass=ABCMeta)
for old_name, new_name in rename_map.items():
temp.rename(old_name, new_name, move_references=True)
for key in temp.keys():
self._merge(key, temp, key)
else:
for key in other.keys():
@ -592,6 +594,7 @@ class MutableLibrary(Library, MutableMapping[str, 'Pattern'], metaclass=ABCMeta)
name = tree.top
else:
tree.library.rename(tree.top, name, move_references=True)
tree.top = name
self.add(tree.library, rename_theirs=rename_theirs)
return name

View File

@ -83,7 +83,6 @@ def data_to_ports(
Returns:
The updated `pattern`. Port labels are not removed.
"""
print(f'TODO pat2dev {name}')
if pattern.ports:
logger.warning(f'Pattern {name if name else pattern} already had ports, skipping data_to_ports')
return pattern