From 4c721feaec62162bd8e2db6b510534ecb437ee4f Mon Sep 17 00:00:00 2001 From: Jan Petykiewicz Date: Sun, 28 Jul 2024 19:34:17 -0700 Subject: [PATCH] re-exports: import x as x --- masque/__init__.py | 66 ++++++++++++++++++++++++++++++-------- masque/builder/__init__.py | 15 ++++++--- masque/shapes/__init__.py | 18 +++++++---- masque/traits/__init__.py | 37 ++++++++++++++++----- masque/utils/__init__.py | 47 +++++++++++++++++++-------- 5 files changed, 137 insertions(+), 46 deletions(-) diff --git a/masque/__init__.py b/masque/__init__.py index 76ad2b9..f165fcb 100644 --- a/masque/__init__.py +++ b/masque/__init__.py @@ -28,22 +28,62 @@ can accept a `Mapping[str, Pattern]` and wrap it in a `LibraryView` internally. """ -from .utils import layer_t, annotations_t, SupportsBool -from .error import MasqueError, PatternError, LibraryError, BuildError -from .shapes import Shape, Polygon, Path, Circle, Arc, Ellipse -from .label import Label -from .ref import Ref -from .pattern import Pattern, map_layers, map_targets, chain_elements +from .utils import ( + layer_t as layer_t, + annotations_t as annotations_t, + SupportsBool as SupportsBool, + ) +from .error import ( + MasqueError as MasqueError, + PatternError as PatternError, + LibraryError as LibraryError, + BuildError as BuildError, + ) +from .shapes import ( + Shape as Shape, + Polygon as Polygon, + Path as Path, + Circle as Circle, + Arc as Arc, + Ellipse as Ellipse, + ) +from .label import Label as Label +from .ref import Ref as Ref +from .pattern import ( + Pattern as Pattern, + map_layers as map_layers, + map_targets as map_targets, + chain_elements as chain_elements, + ) from .library import ( - ILibraryView, ILibrary, - LibraryView, Library, LazyLibrary, - AbstractView, TreeView, Tree, + ILibraryView as ILibraryView, + ILibrary as ILibrary, + LibraryView as LibraryView, + Library as Library, + LazyLibrary as LazyLibrary, + AbstractView as AbstractView, + TreeView as TreeView, + Tree as Tree, + ) +from .ports import ( + Port as Port, + PortList as PortList, + ) +from .abstract import Abstract as Abstract +from .builder import ( + Builder as Builder, + Tool as Tool, + Pather as Pather, + RenderPather as RenderPather, + RenderStep as RenderStep, + BasicTool as BasicTool, + PathTool as PathTool, + ) +from .utils import ( + ports2data as ports2data, + oneshot as oneshot, ) -from .ports import Port, PortList -from .abstract import Abstract -from .builder import Builder, Tool, Pather, RenderPather, RenderStep, BasicTool, PathTool -from .utils import ports2data, oneshot __author__ = 'Jan Petykiewicz' diff --git a/masque/builder/__init__.py b/masque/builder/__init__.py index 465db5c..1eea9f1 100644 --- a/masque/builder/__init__.py +++ b/masque/builder/__init__.py @@ -1,5 +1,10 @@ -from .builder import Builder -from .pather import Pather -from .renderpather import RenderPather -from .utils import ell -from .tools import Tool, RenderStep, BasicTool, PathTool +from .builder import Builder as Builder +from .pather import Pather as Pather +from .renderpather import RenderPather as RenderPather +from .utils import ell as ell +from .tools import ( + Tool as Tool, + RenderStep as RenderStep, + BasicTool as BasicTool, + PathTool as PathTool, + ) diff --git a/masque/shapes/__init__.py b/masque/shapes/__init__.py index ab4a83a..8ad46ef 100644 --- a/masque/shapes/__init__.py +++ b/masque/shapes/__init__.py @@ -3,11 +3,15 @@ Shapes for use with the Pattern class, as well as the Shape abstract class from which they are derived. """ -from .shape import Shape, normalized_shape_tuple, DEFAULT_POLY_NUM_VERTICES +from .shape import ( + Shape as Shape, + normalized_shape_tuple as normalized_shape_tuple, + DEFAULT_POLY_NUM_VERTICES as DEFAULT_POLY_NUM_VERTICES, + ) -from .polygon import Polygon -from .circle import Circle -from .ellipse import Ellipse -from .arc import Arc -from .text import Text -from .path import Path +from .polygon import Polygon as Polygon +from .circle import Circle as Circle +from .ellipse import Ellipse as Ellipse +from .arc import Arc as Arc +from .text import Text as Text +from .path import Path as Path diff --git a/masque/traits/__init__.py b/masque/traits/__init__.py index a3e4361..7c7360c 100644 --- a/masque/traits/__init__.py +++ b/masque/traits/__init__.py @@ -3,11 +3,32 @@ Traits (mixins) and default implementations Traits and mixins should set `__slots__ = ()` to enable use of `__slots__` in subclasses. """ -from .positionable import Positionable, PositionableImpl, Bounded -from .layerable import Layerable, LayerableImpl -from .rotatable import Rotatable, RotatableImpl, Pivotable, PivotableImpl -from .repeatable import Repeatable, RepeatableImpl -from .scalable import Scalable, ScalableImpl -from .mirrorable import Mirrorable -from .copyable import Copyable -from .annotatable import Annotatable, AnnotatableImpl +from .positionable import ( + Positionable as Positionable, + PositionableImpl as PositionableImpl, + Bounded as Bounded, + ) +from .layerable import ( + Layerable as Layerable, + LayerableImpl as LayerableImpl, + ) +from .rotatable import ( + Rotatable as Rotatable, + RotatableImpl as RotatableImpl, + Pivotable as Pivotable, + PivotableImpl as PivotableImpl, + ) +from .repeatable import ( + Repeatable as Repeatable, + RepeatableImpl as RepeatableImpl, + ) +from .scalable import ( + Scalable as Scalable, + ScalableImpl as ScalableImpl, + ) +from .mirrorable import Mirrorable as Mirrorable +from .copyable import Copyable as Copyable +from .annotatable import ( + Annotatable as Annotatable, + AnnotatableImpl as AnnotatableImpl, + ) diff --git a/masque/utils/__init__.py b/masque/utils/__init__.py index 571c406..ffa9e85 100644 --- a/masque/utils/__init__.py +++ b/masque/utils/__init__.py @@ -1,19 +1,40 @@ """ Various helper functions, type definitions, etc. """ -from .types import layer_t, annotations_t, SupportsBool -from .array import is_scalar -from .autoslots import AutoSlots -from .deferreddict import DeferredDict -from .decorators import oneshot - -from .bitwise import get_bit, set_bit -from .vertices import ( - remove_duplicate_vertices, remove_colinear_vertices, poly_contains_points +from .types import ( + layer_t as layer_t, + annotations_t as annotations_t, + SupportsBool as SupportsBool, ) -from .transform import rotation_matrix_2d, normalize_mirror, rotate_offsets_around -from .comparisons import annotation2key, annotations_lt, annotations_eq, layer2key, ports_lt, ports_eq, rep2key +from .array import is_scalar as is_scalar +from .autoslots import AutoSlots as AutoSlots +from .deferreddict import DeferredDict as DeferredDict +from .decorators import oneshot as oneshot -from . import ports2data +from .bitwise import ( + get_bit as get_bit, + set_bit as set_bit, + ) +from .vertices import ( + remove_duplicate_vertices as remove_duplicate_vertices, + remove_colinear_vertices as remove_colinear_vertices, + poly_contains_points as poly_contains_points, + ) +from .transform import ( + rotation_matrix_2d as rotation_matrix_2d, + normalize_mirror as normalize_mirror, + rotate_offsets_around as rotate_offsets_around, + ) +from .comparisons import ( + annotation2key as annotation2key, + annotations_lt as annotations_lt, + annotations_eq as annotations_eq, + layer2key as layer2key, + ports_lt as ports_lt, + ports_eq as ports_eq, + rep2key as rep2key, + ) -from . import pack2d +from . import ports2data as ports2data + +from . import pack2d as pack2d