diff --git a/masque/pattern.py b/masque/pattern.py index c8c2c30..c80284c 100644 --- a/masque/pattern.py +++ b/masque/pattern.py @@ -593,7 +593,6 @@ class Pattern(PortList, AnnotatableImpl, Mirrorable): def is_empty(self) -> bool: """ - # TODO is_empty doesn't include ports... maybe there should be an equivalent? Returns: True if the pattern is contains no shapes, labels, or refs. """ @@ -620,6 +619,13 @@ class Pattern(PortList, AnnotatableImpl, Mirrorable): """ return any(True for _ in chain.from_iterable(self.labels.values())) + def has_ports(self) -> bool: + """ + Returns: + True if the pattern contains any ports. + """ + return bool(self.ports) + def ref(self, target: str | None, *args: Any, **kwargs: Any) -> Self: """ Convenience function which constructs a `Ref` object and adds it