From 549112fcf88fc3e925a3241dff209d50b5be4c15 Mon Sep 17 00:00:00 2001 From: mrg Date: Tue, 23 Feb 2021 13:32:13 -0800 Subject: [PATCH] PEP8 cleanup --- compiler/router/direction.py | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/compiler/router/direction.py b/compiler/router/direction.py index 8237f679..c13abdd3 100644 --- a/compiler/router/direction.py +++ b/compiler/router/direction.py @@ -7,6 +7,8 @@ # from enum import Enum from vector3d import vector3d +import debug + class direction(Enum): NORTH = 1 @@ -20,31 +22,30 @@ class direction(Enum): SOUTHEAST = 9 SOUTHWEST = 10 - def get_offset(direct): """ Returns the vector offset for a given direction. """ if direct==direction.NORTH: - offset = vector3d(0,1,0) + offset = vector3d(0, 1, 0) elif direct==direction.SOUTH: - offset = vector3d(0,-1,0) + offset = vector3d(0, -1 ,0) elif direct==direction.EAST: - offset = vector3d(1,0,0) + offset = vector3d(1, 0, 0) elif direct==direction.WEST: - offset = vector3d(-1,0,0) + offset = vector3d(-1, 0, 0) elif direct==direction.UP: - offset = vector3d(0,0,1) + offset = vector3d(0, 0, 1) elif direct==direction.DOWN: - offset = vector3d(0,0,-1) + offset = vector3d(0, 0, -1) elif direct==direction.NORTHEAST: - offset = vector3d(1,1,0) + offset = vector3d(1, 1, 0) elif direct==direction.NORTHWEST: - offset = vector3d(-1,1,0) + offset = vector3d(-1, 1, 0) elif direct==direction.SOUTHEAST: - offset = vector3d(1,-1,0) + offset = vector3d(1, -1, 0) elif direct==direction.SOUTHWEST: - offset = vector3d(-1,-1,0) + offset = vector3d(-1, -1, 0) else: debug.error("Invalid direction {}".format(direct)) @@ -67,8 +68,8 @@ class direction(Enum): return [direction.get_offset(d) for d in direction.all_directions()] def all_neighbors(cell): - return [cell+x for x in direction.all_offsets()] + return [cell + x for x in direction.all_offsets()] def cardinal_neighbors(cell): - return [cell+x for x in direction.cardinal_offsets()] + return [cell + x for x in direction.cardinal_offsets()]