From e280b655e7b9849f169384cc6c876e8366a0e389 Mon Sep 17 00:00:00 2001 From: Jacob Lifshay Date: Fri, 22 Apr 2022 14:47:50 -0700 Subject: [PATCH] autoformat code --- src/nmutil/prefix_sum.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/nmutil/prefix_sum.py b/src/nmutil/prefix_sum.py index f99a912..4aa89b2 100644 --- a/src/nmutil/prefix_sum.py +++ b/src/nmutil/prefix_sum.py @@ -15,10 +15,14 @@ class Op: The operation is `items[self.out] = fn(items[self.lhs], items[self.rhs])`. The operation is not assumed to be commutative. """ - out: int; """index of the item to output to""" - lhs: int; """index of the item the left-hand-side input comes from""" - rhs: int; """index of the item the right-hand-side input comes from""" - row: int; """row in the prefix-sum diagram""" + out: int + """index of the item to output to""" + lhs: int + """index of the item the left-hand-side input comes from""" + rhs: int + """index of the item the right-hand-side input comes from""" + row: int + """row in the prefix-sum diagram""" def prefix_sum_ops(item_count, *, work_efficient=False): @@ -146,7 +150,7 @@ def render_prefix_sum_diagram(item_count, *, work_efficient=False, ops_by_row[op.row].add(op) def blank_row(): - return [_Cell(slant=False, plus=False, tee=False) \ + return [_Cell(slant=False, plus=False, tee=False) for _ in range(item_count)] cells = [blank_row()] @@ -217,9 +221,9 @@ def render_prefix_sum_diagram(item_count, *, work_efficient=False, if __name__ == "__main__": print("the non-work-efficient algorithm, matches the diagram in wikipedia:" - "\n" - "https://commons.wikimedia.org/wiki/File:Hillis-Steele_Prefix_Sum.svg" - "\n\n") + "\n" + "https://commons.wikimedia.org/wiki/File:Hillis-Steele_Prefix_Sum.svg" + "\n\n") print(render_prefix_sum_diagram(16, work_efficient=False)) print() print() -- 2.30.2