From 445899b2eb8885ec50d592dc43ae17193475d0b8 Mon Sep 17 00:00:00 2001 From: Andy Port Date: Tue, 23 Jun 2020 20:53:54 -0700 Subject: [PATCH] renamed Document.flatten_all_paths to flattened_paths --- svgpathtools/document.py | 11 +++++------ test/test_groups.py | 6 +++--- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/svgpathtools/document.py b/svgpathtools/document.py index 2a859fc..ec04d8b 100644 --- a/svgpathtools/document.py +++ b/svgpathtools/document.py @@ -15,7 +15,7 @@ Example: >> from svgpathtools import * >> doc = Document('my_file.html') - >> for path in doc.flatten_all_paths(): + >> for path in doc.flattened_paths(): >> # Do something with the transformed Path object. >> foo(path) >> # Inspect the raw SVG element, e.g. change its attributes @@ -196,7 +196,7 @@ def flatten_group(group_to_flatten, root, recursive=True, for group in route: # Add each group from the root to the parent of the desired group # to the list of groups that we should traverse. This makes sure - # that flatten_all_paths will not stop before reaching the desired + # that flattened_paths will not stop before reaching the desired # group. desired_groups.add(id(group)) for key in path_conversions.keys(): @@ -249,11 +249,10 @@ class Document: self.root = self.tree.getroot() - def flatten_all_paths(self, group_filter=lambda x: True, - path_filter=lambda x: True, - path_conversions=CONVERSIONS): + def flattened_paths(self, group_filter=lambda x: True, + path_filter=lambda x: True, path_conversions=CONVERSIONS): """Forward the tree of this document into the more general - flatten_all_paths function and return the result.""" + flattened_paths function and return the result.""" return flatten_all_paths(self.tree.getroot(), group_filter, path_filter, path_conversions) diff --git a/test/test_groups.py b/test/test_groups.py index d33aea2..3eec79c 100644 --- a/test/test_groups.py +++ b/test/test_groups.py @@ -26,7 +26,7 @@ class TestGroups(unittest.TestCase): # end point relative to the start point # * name is the path name (value of the test:name attribute in # the SVG document) - # * paths is the output of doc.flatten_all_paths() + # * paths is the output of doc.flattened_paths() v_s_vals.append(1.0) v_e_relative_vals.append(0.0) v_s = np.array(v_s_vals) @@ -38,7 +38,7 @@ class TestGroups(unittest.TestCase): self.check_values(tf.dot(v_e), actual.path.end) def test_group_flatten(self): - # Test the Document.flatten_all_paths() function against the + # Test the Document.flattened_paths() function against the # groups.svg test file. # There are 12 paths in that file, with various levels of being # nested inside of group transforms. @@ -48,7 +48,7 @@ class TestGroups(unittest.TestCase): # that are specified by the SVG standard. doc = Document(join(dirname(__file__), 'groups.svg')) - result = doc.flatten_all_paths() + result = doc.flattened_paths() self.assertEqual(12, len(result)) tf_matrix_group = np.array([[1.5, 0.0, -40.0],