Skip to content

Commit

Permalink
Hotfix g2f trim_ends logic
Browse files Browse the repository at this point in the history
  • Loading branch information
simonxeko committed Oct 5, 2016
1 parent 04a1159 commit 1fc0544
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions fluxclient/fcode/fcode_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,22 +151,17 @@ def trim_ends(cls, path):
"""
PY_TYPE_MOVE = 3

if path is None:
return path

if len(path) == 0:
if path is None or len(path) == 0:
return path

for layer in [0, -1]:
while True:
if len(path) > 0 and len(path[layer]) >= 2:
while len(path):
if len(path[layer]) >= 2:
# define an edge's type at end point
# 0 * 2 + 1 = 1
# -1 * 2 + 1 = -1
if path[layer][layer * 2 + 1][3] == PY_TYPE_MOVE:
if path[layer][[0,-1][layer]][3] == PY_TYPE_MOVE:
path[layer].pop(layer)
else:
break
elif len(path) > 0:
else:
path.pop(layer)
return path

0 comments on commit 1fc0544

Please sign in to comment.