From acf033de95820b2b36caa64f4e1269fdcc790f43 Mon Sep 17 00:00:00 2001 From: tommyod Date: Thu, 5 Sep 2024 20:35:03 +0200 Subject: [PATCH] fix flake8 errors --- fenwick/__init__.py | 2 ++ fenwick/fenwick.py | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/fenwick/__init__.py b/fenwick/__init__.py index bffb0fc..f385d56 100644 --- a/fenwick/__init__.py +++ b/fenwick/__init__.py @@ -1 +1,3 @@ from .fenwick import FenwickTree, __version__ + +__all__ = ["FenwickTree", "__version__"] diff --git a/fenwick/fenwick.py b/fenwick/fenwick.py index 215353d..6d2e62e 100644 --- a/fenwick/fenwick.py +++ b/fenwick/fenwick.py @@ -17,6 +17,7 @@ # * Core # ************************************************************ + class FenwickTree(object): """ A data structure for maintaining cumulative (prefix) sums. @@ -88,7 +89,7 @@ def init(self, frequencies): raise ValueError("Length of frequencies must match length of FenwickTree.") self._v = list(frequencies) for idx in range(1, self._n + 1): - parent_idx = idx + (idx & -idx) # parent in update tree + parent_idx = idx + (idx & -idx) # parent in update tree if parent_idx <= self._n: self._v[parent_idx - 1] += self._v[idx - 1]