From 3743e3f61d8141616baa947e34506094c7a86bb3 Mon Sep 17 00:00:00 2001 From: Rod S Date: Thu, 28 Apr 2022 14:13:34 -0700 Subject: [PATCH] Reduce flexibility of ReusableParts::load --- src/nanoemoji/parts.py | 5 +---- tests/parts_test.py | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/nanoemoji/parts.py b/src/nanoemoji/parts.py index 3ae3a162..a800e217 100644 --- a/src/nanoemoji/parts.py +++ b/src/nanoemoji/parts.py @@ -23,7 +23,7 @@ from typing import Iterable, List, MutableMapping, NewType, Set, Tuple, Union -PathSource = Union[SVGShape, Iterable[SVGShape], "ReuseableParts", Path] +PathSource = Union[SVGShape, Iterable[SVGShape], "ReuseableParts"] @lru_cache(maxsize=1) @@ -76,9 +76,6 @@ def _add(self, shape: Shape): self._add_norm_path(norm, shape) def add(self, source: PathSource): - if isinstance(source, Path): - source = ReuseableParts.load(source) - if isinstance(source, ReuseableParts): for normalized, shape_set in source.shape_sets.items(): for shape in shape_set: diff --git a/tests/parts_test.py b/tests/parts_test.py index 324ff45b..fa379390 100644 --- a/tests/parts_test.py +++ b/tests/parts_test.py @@ -78,7 +78,7 @@ def test_merge(): def test_file_io(): parts = ReuseableParts() - parts.add(locate_test_file("rect.svg")) + parts.add(ReuseableParts.load(locate_test_file("rect.svg"))) check_num_shapes(parts, 1) tmp_dir = mkdtemp()