From 34109d71681c561012425af46b30061c438ade0a Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Tue, 17 Mar 2020 01:07:54 -0400 Subject: [PATCH] Remove optional returns from TriAnalyzer._get_compressed_triangulation. It's only ever called once with `(True, True)`, and is not public, so drop the options to not return stuff. --- lib/matplotlib/tri/triinterpolate.py | 2 +- lib/matplotlib/tri/tritools.py | 33 ++++------------------------ 2 files changed, 5 insertions(+), 30 deletions(-) diff --git a/lib/matplotlib/tri/triinterpolate.py b/lib/matplotlib/tri/triinterpolate.py index 1e2e00188226..1fe10d782dbf 100644 --- a/lib/matplotlib/tri/triinterpolate.py +++ b/lib/matplotlib/tri/triinterpolate.py @@ -398,7 +398,7 @@ def __init__(self, triangulation, z, kind='min_E', trifinder=None, # (used) node numbering. tri_analyzer = TriAnalyzer(self._triangulation) (compressed_triangles, compressed_x, compressed_y, tri_renum, - node_renum) = tri_analyzer._get_compressed_triangulation(True, True) + node_renum) = tri_analyzer._get_compressed_triangulation() self._triangles = compressed_triangles self._tri_renum = tri_renum # Taking into account the node renumbering in self._z: diff --git a/lib/matplotlib/tri/tritools.py b/lib/matplotlib/tri/tritools.py index 8f771621fc49..335cb94770f2 100644 --- a/lib/matplotlib/tri/tritools.py +++ b/lib/matplotlib/tri/tritools.py @@ -190,8 +190,7 @@ def get_flat_tri_mask(self, min_circle_ratio=0.01, rescale=True): return np.ma.filled(current_mask, True) - def _get_compressed_triangulation(self, return_tri_renum=False, - return_node_renum=False): + def _get_compressed_triangulation(self): """ Compress (if masked) the encapsulated triangulation. @@ -199,17 +198,6 @@ def _get_compressed_triangulation(self, return_tri_renum=False, coordinates arrays (*compressed_x*, *compressed_y*) that can still describe the unmasked triangles of the encapsulated triangulation. - Parameters - ---------- - return_tri_renum : bool, default: False - Indicates whether a renumbering table to translate the triangle - numbers from the encapsulated triangulation numbering into the - new (compressed) renumbering will be returned. - return_node_renum : bool, default: False - Indicates whether a renumbering table to translate the nodes - numbers from the encapsulated triangulation numbering into the - new (compressed) renumbering will be returned. - Returns ------- compressed_triangles : array-like @@ -222,12 +210,11 @@ def _get_compressed_triangulation(self, return_tri_renum=False, renumbering table to translate the triangle numbers from the encapsulated triangulation into the new (compressed) renumbering. -1 for masked triangles (deleted from *compressed_triangles*). - Returned only if *return_tri_renum* is True. node_renum : int array renumbering table to translate the point numbers from the encapsulated triangulation into the new (compressed) renumbering. -1 for unused points (i.e. those deleted from *compressed_x* and - *compressed_y*). Returned only if *return_node_renum* is True. + *compressed_y*). """ # Valid triangles and renumbering @@ -246,20 +233,8 @@ def _get_compressed_triangulation(self, return_tri_renum=False, # Now renumbering the valid triangles nodes compressed_triangles = node_renum[compressed_triangles] - # 4 cases possible for return - if not return_tri_renum: - if not return_node_renum: - return compressed_triangles, compressed_x, compressed_y - else: - return (compressed_triangles, compressed_x, compressed_y, - node_renum) - else: - if not return_node_renum: - return (compressed_triangles, compressed_x, compressed_y, - tri_renum) - else: - return (compressed_triangles, compressed_x, compressed_y, - tri_renum, node_renum) + return (compressed_triangles, compressed_x, compressed_y, tri_renum, + node_renum) @staticmethod def _total_to_compress_renum(mask, n=None):