Skip to content

Commit e616f64

Browse files
committed
One years worth of linting and formatting...
1 parent fa0508d commit e616f64

File tree

5 files changed

+10
-26
lines changed

5 files changed

+10
-26
lines changed

hunter/analysis.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import copy
21
from dataclasses import dataclass
32
from typing import Iterable, List, Reversible
43

hunter/series.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from dataclasses import dataclass
33
from datetime import datetime, timezone
44
from itertools import groupby
5-
from typing import Dict, Iterable, List, Optional, Any
5+
from typing import Any, Dict, Iterable, List, Optional
66

77
import numpy as np
88

@@ -316,7 +316,7 @@ def _validate_append(self, time, new_data, attributes):
316316
return ValueError("time argument must be an array.")
317317
if not isinstance(new_data, dict):
318318
return ValueError("new_data argument must be a dict with metrics as key.")
319-
if len(new_data.keys()) == 0 or len([v for v in [l for l in new_data.values()]]) == 0:
319+
if len(new_data.keys()) == 0 or len([v for v in [vv for vv in new_data.values()]]) == 0:
320320
return ValueError("new_data argument doesn't contain any data")
321321
if not isinstance(attributes, dict):
322322
return ValueError("attributes must be a dict.")

perf/perf_test.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import numpy as np
2-
from signal_processing_algorithms.e_divisive.change_points import EDivisiveChangePoint
31

4-
from hunter.analysis import TTestSignificanceTester, compute_change_points, fill_missing, compute_change_points_orig
2+
from hunter.analysis import compute_change_points
3+
54

65
def _get_series():
76
"""

tests/series_test.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import time
22
from random import random
3+
34
import pytest
45

56
from hunter.series import AnalysisOptions, Metric, Series, compare
@@ -69,6 +70,7 @@ def test_div_by_zero():
6970
analyzed_series = test.analyze()
7071
change_points = analyzed_series.change_points_by_time
7172
cpjson = analyzed_series.to_json()
73+
assert cpjson
7274
assert len(change_points) == 2
7375
assert change_points[0].index == 3
7476

@@ -230,7 +232,6 @@ def test_validate():
230232

231233
analyzed_series = test.analyze()
232234
analyzed_series.append(time=[len(time)], new_data={"series1":[0.5], "series2":[1.97]}, attributes= {})
233-
change_points = analyzed_series.change_points
234235

235236
err = analyzed_series._validate_append(time=[len(time)], new_data={"series1":[0.51]}, attributes= {})
236237
assert err is None
@@ -256,13 +257,12 @@ def test_can_append():
256257

257258
analyzed_series = test.analyze()
258259
analyzed_series.append(time=[len(time)], new_data={"series1":[0.5], "series2":[1.97]}, attributes= {})
259-
change_points = analyzed_series.change_points
260260

261261
can = analyzed_series.can_append(time=[len(time)], new_data={"series1":[0.51]}, attributes= {})
262-
assert can == True
262+
assert can
263263

264264
can = analyzed_series.can_append(time=[5], new_data={"series1":[0.51]}, attributes= {})
265-
assert can == False
265+
assert not can
266266

267267
def test_orig_edivisive():
268268
series_1 = [1.02, 0.95, 0.99, 1.00, 1.12, 0.90, 0.50, 0.51, 0.48, 0.48, 0.55]

tests/tigerbeetle_test.py

+2-16
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import numpy as np
2-
from signal_processing_algorithms.e_divisive.change_points import EDivisiveChangePoint
31

4-
from hunter.analysis import TTestSignificanceTester, compute_change_points, fill_missing, compute_change_points_orig
2+
from hunter.analysis import compute_change_points
3+
54

65
def _get_series():
76
"""
@@ -20,19 +19,6 @@ def _get_series():
2019
return [26705, 26475, 26641, 26806, 26835, 26911, 26564, 26812, 26874, 26682, 15672, 26745, 26460, 26977, 26851, 23412, 23547, 23674, 23519, 23670, 23662, 23462, 23750, 23717, 23524, 23588, 23687, 23793, 23937, 23715, 23570, 23730, 23690, 23699, 23670, 23860, 23988, 23652, 23681, 23798, 23728, 23604, 23523, 23412, 23685, 23773, 23771, 23718, 23409, 23739, 23674, 23597, 23682, 23680, 23711, 23660, 23990, 23938, 23742, 23703, 23536, 24363, 24414, 24483, 24509, 24944, 24235, 24560, 24236, 24667, 24730, 28346, 28437, 28436, 28057, 28217, 28456, 28427, 28398, 28250, 28331, 28222, 28726, 28578, 28345, 28274, 28514, 28590, 28449, 28305, 28411, 28788, 28404, 28821, 28580, 27483, 26805, 27487, 27124, 26898, 27295, 26951, 27312, 27660, 27154, 27050, 26989, 27193, 27503, 27326, 27375, 27513, 27057, 27421, 27574, 27609, 27123, 27824, 27644, 27394, 27836, 27949, 27702, 27457, 27272, 28207, 27802, 27516, 27586, 28005, 27768, 28543, 28237, 27915, 28437, 28342, 27733, 28296, 28524, 28687, 28258, 28611, 29360, 28590, 29641, 28965, 29474, 29256, 28611, 28205, 28539, 27962, 28398, 28509, 28240, 28592, 28102, 28461, 28578, 28669, 28507, 28535, 28226, 28536, 28561, 28087, 27953, 28398, 28007, 28518, 28337, 28242, 28607, 28545, 28514, 28377, 28010, 28412, 28633, 28576, 28195, 28637, 28724, 28466, 28287, 28719, 28425, 28860, 28842, 28604, 28327, 28216, 28946, 28918, 29287, 28725, 29148, 29541, 29137, 29628, 29087, 28612, 29154, 29108, 28884, 29234, 28695, 28969, 28809, 28695, 28634, 28916, 29852, 29389, 29757, 29531, 29363, 29251, 29552, 29561, 29046, 29795, 29022, 29395, 28921, 29739, 29257, 29455, 29376, 29528, 28909, 29492, 28984, 29621, 29026, 29457, 29102, 29114, 28924, 29162, 29259, 29554, 29616, 29211, 29367, 29460, 28836, 29645, 29586, 28848, 29324, 28969, 29150, 29243, 29081, 29312, 28923, 29272, 29117, 29072, 29529, 29737, 29652, 29612, 29856, 29012, 30402, 29969, 29309, 29439, 29285, 29421, 29023, 28772, 29692, 29416, 29267, 29542, 29904, 30045, 29739, 29945, 29141, 29163, 29765, 29197, 29441, 28910, 29504, 29614, 29643, 29506, 29420, 29672, 29432, 29784, 29888, 29309, 29247, 29816, 29254, 29813, 29451, 29382, 29618, 28558, 29845, 29499, 29283, 29184, 29246, 28790, 29952, 29145, 29415, 30437, 29227, 29605, 29859, 29156, 29807, 29406, 29734, 29861, 29140, 29983, 29832, 29919, 29896, 29991, 29266, 29001, 29459, 29548, 29310, 29042, 29303, 29894, 29091, 29018, 29537, 29614, 29180, 29736, 29500, 29218, 29581, 28906, 28542, 29306, 28987, 29878, 28865, 30272, 29707, 29662, 29815, 30492, 29347, 30096, 29054, 30238, 28813, 31895, 28915]
2120

2221

23-
def _actual_t_est(p,m=0.0,w=30,new_points=None):
24-
# cps, old_cp = compute_change_points(series, window_len=w, max_pvalue=p, min_magnitude=m, new_points=new_points)
25-
cps = compute_change_points(series, window_len=w, max_pvalue=p, min_magnitude=m)
26-
27-
if new_points is not None and len(new_points) == 0:
28-
# cps, old_cp = compute_change_points(series, window_len=w, max_pvalue=p, min_magnitude=m, new_points=None)
29-
cps = compute_change_points(series, window_len=w, max_pvalue=p, min_magnitude=m)
30-
31-
if new_points:
32-
# cps, old_cp = compute_change_points(series, window_len=w, max_pvalue=p, min_magnitude=m, new_points=new_points, old_cp=old_cp)
33-
cps = compute_change_points(series, window_len=w, max_pvalue=p, min_magnitude=m)
34-
35-
3622

3723
def test_tb_old_defaults():
3824
series = _get_series()

0 commit comments

Comments
 (0)