From e0d338ee1e48e2fed3bcd7ced7a129de1d05d38d Mon Sep 17 00:00:00 2001 From: Markus Holzer <markus.holzer@fau.de> Date: Wed, 12 Jul 2023 16:57:49 +0200 Subject: [PATCH] Small changes --- pystencils/stencil.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/pystencils/stencil.py b/pystencils/stencil.py index 1d02996d..aa86427f 100644 --- a/pystencils/stencil.py +++ b/pystencils/stencil.py @@ -319,18 +319,14 @@ def adjacent_directions(direction): return tuple(result) binary_numbers_list = binary_numbers(len(direction)) for adjacent_direction in binary_numbers_list: - for i in range(len(direction)): - if direction[i] == 0: + for i, entry in enumerate(direction): + if entry == 0: adjacent_direction[i] = 0 - if direction[i] == -1 and adjacent_direction[i] == 1: + if entry == -1 and adjacent_direction[i] == 1: adjacent_direction[i] = -1 if not all(e == 0 for e in adjacent_direction): result.add(tuple(adjacent_direction)) - result = list(result) - result.sort() - return tuple(result) - - + return tuple(sorted(result)) # -------------------------------------- Visualization ----------------------------------------------------------------- -- GitLab