Drop ports by default
This commit is contained in:
parent
38a7ba6434
commit
1d720b6577
@ -207,6 +207,7 @@ class Library(Mapping[str, 'Pattern'], metaclass=ABCMeta):
|
||||
def flatten(
|
||||
self,
|
||||
tops: Union[str, Sequence[str]],
|
||||
flatten_ports: bool = False, # TODO document
|
||||
) -> Dict[str, 'Pattern']:
|
||||
"""
|
||||
Removes all refs and adds equivalent shapes.
|
||||
@ -238,6 +239,8 @@ class Library(Mapping[str, 'Pattern'], metaclass=ABCMeta):
|
||||
raise PatternError(f'Circular reference in {name} to {target}')
|
||||
|
||||
p = ref.as_pattern(pattern=flattened[target])
|
||||
if not flatten_ports:
|
||||
p.ports.clear()
|
||||
pat.append(p)
|
||||
|
||||
pat.refs.clear()
|
||||
|
@ -561,6 +561,7 @@ class Pattern(PortList, AnnotatableImpl, Mirrorable):
|
||||
def flatten(
|
||||
self: P,
|
||||
library: Mapping[str, P],
|
||||
flatten_ports: bool = False, # TODO document
|
||||
) -> 'Pattern':
|
||||
"""
|
||||
Removes all refs (recursively) and adds equivalent shapes.
|
||||
@ -592,6 +593,8 @@ class Pattern(PortList, AnnotatableImpl, Mirrorable):
|
||||
raise PatternError(f'Circular reference in {name} to {target}')
|
||||
|
||||
p = ref.as_pattern(pattern=flattened[target])
|
||||
if not flatten_ports:
|
||||
p.ports.clear()
|
||||
pat.append(p)
|
||||
|
||||
pat.refs.clear()
|
||||
|
Loading…
Reference in New Issue
Block a user