diff options
| author | Lex Neva <github.com@lexneva.name> | 2019-04-10 00:00:44 -0400 |
|---|---|---|
| committer | Lex Neva <github.com@lexneva.name> | 2019-04-10 00:00:44 -0400 |
| commit | 9d4441b7009564a57425ab0ab73a70be5b8dabf4 (patch) | |
| tree | f85e050ac84bcbef86608b5458e59fd5386fae55 /lib/stitches | |
| parent | a766e4e40858cb7954c8c6ea4a1a9de8d31ee054 (diff) | |
remove unnecessary comparisons to None
Diffstat (limited to 'lib/stitches')
| -rw-r--r-- | lib/stitches/auto_fill.py | 10 |
1 files 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() |
