From 99e55f931c518c1689d17b17713a1fb0b8bad464 Mon Sep 17 00:00:00 2001 From: Jan Petykiewicz Date: Sun, 28 Jul 2024 20:16:59 -0700 Subject: [PATCH] refactor to single-line conditional assignments --- masque/library.py | 5 +---- masque/shapes/polygon.py | 5 +---- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/masque/library.py b/masque/library.py index ce5adb2..9771eaf 100644 --- a/masque/library.py +++ b/masque/library.py @@ -1038,10 +1038,7 @@ class Library(ILibrary): if key in self.mapping: raise LibraryError(f'"{key}" already exists in the library. Overwriting is not allowed!') - if callable(value): - value = value() - else: - value = value + value = value() if callable(value) else value self.mapping[key] = value def __delitem__(self, key: str) -> None: diff --git a/masque/shapes/polygon.py b/masque/shapes/polygon.py index 33dea9d..1d52489 100644 --- a/masque/shapes/polygon.py +++ b/masque/shapes/polygon.py @@ -331,10 +331,7 @@ class Polygon(Shape): Returns: A Polygon object containing the requested octagon """ - if regular: - s = 1 + numpy.sqrt(2) - else: - s = 2 + s = (1 + numpy.sqrt(2)) if regular else 2 norm_oct = numpy.array([ [-1, -s],