From 9d4441b7009564a57425ab0ab73a70be5b8dabf4 Mon Sep 17 00:00:00 2001 From: Lex Neva Date: Wed, 10 Apr 2019 00:00:44 -0400 Subject: remove unnecessary comparisons to None --- lib/stitches/auto_fill.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/stitches/auto_fill.py b/lib/stitches/auto_fill.py index 84f10d45..9d946ae2 100644 --- a/lib/stitches/auto_fill.py +++ b/lib/stitches/auto_fill.py @@ -411,16 +411,16 @@ def find_stitch_path(graph, travel_graph, starting_point=None, ending_point=None graph = graph.copy() - if starting_point is None: + if not starting_point: starting_point = graph.nodes.keys()[0] starting_node = nearest_node(graph, starting_point) - if ending_point is None: + if ending_point: + ending_node = nearest_node(graph, ending_point) + else: ending_point = starting_point ending_node = starting_node - else: - ending_node = nearest_node(graph, ending_point) # The algorithm below is adapted from networkx.eulerian_circuit(). path = [] @@ -431,7 +431,7 @@ def find_stitch_path(graph, travel_graph, starting_point=None, ending_point=None while vertex_stack: current_vertex, current_key = vertex_stack[-1] if graph.degree(current_vertex) == 0: - if last_vertex is not None: + if last_vertex: path.append(PathEdge((last_vertex, current_vertex), last_key)) last_vertex, last_key = current_vertex, current_key vertex_stack.pop() -- cgit v1.2.3