summaryrefslogtreecommitdiff
path: root/histogram.py
diff options
context:
space:
mode:
authorScott Gasch <[email protected]>2021-07-08 22:25:12 -0700
committerScott Gasch <[email protected]>2021-07-08 22:25:12 -0700
commit11eeb8574b7b4620ac6fd440cb251f8aa2458f5b (patch)
tree97f8e64eddd4528b01af58df269427814b889929 /histogram.py
parente516059c716537259c601c022cc3bad44025385e (diff)
Reduce import scopes, remove cycles.
Diffstat (limited to 'histogram.py')
-rw-r--r--histogram.py6
1 files changed, 2 insertions, 4 deletions
diff --git a/histogram.py b/histogram.py
index ca67839..b98e848 100644
--- a/histogram.py
+++ b/histogram.py
@@ -4,10 +4,6 @@ import math
from numbers import Number
from typing import Generic, Iterable, List, Optional, Tuple, TypeVar
-from math_utils import RunningMedian
-from text_utils import bar_graph
-
-
T = TypeVar("T", bound=Number)
@@ -18,6 +14,7 @@ class SimpleHistogram(Generic[T]):
NEGATIVE_INFINITY = -math.inf
def __init__(self, buckets: List[Tuple[T, T]]):
+ from math_utils import RunningMedian
self.buckets = {}
for start_end in buckets:
if self._get_bucket(start_end[0]) is not None:
@@ -70,6 +67,7 @@ class SimpleHistogram(Generic[T]):
return all_true
def __repr__(self) -> str:
+ from text_utils import bar_graph
max_population: Optional[int] = None
for bucket in self.buckets:
pop = self.buckets[bucket]