From 8e8fee5238a3b4fd7e9300ebb013e48780c25fe9 Mon Sep 17 00:00:00 2001 From: jan Date: Thu, 11 Apr 2024 19:02:50 -0700 Subject: [PATCH] misc cleanup --- masque/builder/pather.py | 5 ++--- masque/file/utils.py | 9 ++++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/masque/builder/pather.py b/masque/builder/pather.py index 11e4d80..0f4fad9 100644 --- a/masque/builder/pather.py +++ b/masque/builder/pather.py @@ -430,7 +430,6 @@ class Pather(Builder): **kwargs, ) - def path_into( self, portspec_src: str, @@ -465,7 +464,7 @@ class Pather(Builder): angle = (port_dst.rotation - port_src.rotation) % (2 * pi) - src_ne = port_src.rotation % (2 * pi) > (3 * pi /4) # path from src will go north or east + src_ne = port_src.rotation % (2 * pi) > (3 * pi / 4) # path from src will go north or east def get_jog(ccw: SupportsBool, length: float) -> float: tool = self.tools.get(portspec_src, self.tools[None]) @@ -511,7 +510,7 @@ class Pather(Builder): self.path_to(portspec_src, not ccw2, y=yd - jog, **src_args) self.path_to(portspec_src, ccw2, x=xd, **dst_args) elif numpy.isclose(angle, 0): - raise BuildError(f'Don\'t know how to route a U-bend at this time!') + raise BuildError('Don\'t know how to route a U-bend at this time!') else: raise BuildError(f'Don\'t know how to route ports with relative angle {angle}') diff --git a/masque/file/utils.py b/masque/file/utils.py index 87c3d67..898bd05 100644 --- a/masque/file/utils.py +++ b/masque/file/utils.py @@ -57,7 +57,7 @@ def preflight( refs = lib.referenced_patterns() dangling = refs - set(lib.keys()) if dangling: - msg = 'Dangling refs in found: ' + pformat(dangling) + msg = 'Dangling refs found: ' + pformat(dangling) if allow_dangling_refs is None: logger.warning(msg) else: @@ -75,8 +75,11 @@ def preflight( if prune_empty_patterns: pruned = lib.prune_empty() - logger.info(f'Preflight pruned {len(pruned)} empty patterns') - logger.debug('Pruned: ' + pformat(pruned)) + if pruned: + logger.info(f'Preflight pruned {len(pruned)} empty patterns') + logger.debug('Pruned: ' + pformat(pruned)) + else: + logger.debug('Preflight found no empty patterns') if wrap_repeated_shapes: lib.wrap_repeated_shapes()