From dee1edc966f6c619458daf7a76497ba2c7784d39 Mon Sep 17 00:00:00 2001 From: Alexey Velikiy Date: Tue, 23 Apr 2019 14:54:49 +0300 Subject: [PATCH] Analytic types upgrade (#600) * move DataBucket from __init__ * python3 fixes for DataBucket & rm class field --- analytics/analytics/analytic_types/__init__.py | 5 ++--- analytics/analytics/analytic_types/data_bucket.py | 4 +--- analytics/analytics/detectors/pattern_detector.py | 2 +- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/analytics/analytics/analytic_types/__init__.py b/analytics/analytics/analytic_types/__init__.py index 011f47c..205b50f 100644 --- a/analytics/analytics/analytic_types/__init__.py +++ b/analytics/analytics/analytic_types/__init__.py @@ -1,6 +1,6 @@ """ It is the place where we put all classes and types -which is common for all of the code. +common for all analytics code For example, if you write someting which is used in analytic_unit_manager, it should be here. @@ -8,11 +8,10 @@ in analytic_unit_manager, it should be here. If you create something spicific which is used only in one place, like PatternDetectionCache, then it should not be here. """ + import pandas as pd from typing import Union, List -from analytic_types.data_bucket import DataBucket - AnalyticUnitId = str diff --git a/analytics/analytics/analytic_types/data_bucket.py b/analytics/analytics/analytic_types/data_bucket.py index 0561872..5eb3809 100644 --- a/analytics/analytics/analytic_types/data_bucket.py +++ b/analytics/analytics/analytic_types/data_bucket.py @@ -1,9 +1,7 @@ import pandas as pd -class DataBucket(object): - - data: pd.DataFrame +class DataBucket: def __init__(self): self.data = pd.DataFrame([], columns=['timestamp', 'value']) diff --git a/analytics/analytics/detectors/pattern_detector.py b/analytics/analytics/detectors/pattern_detector.py index 23e565b..caaa053 100644 --- a/analytics/analytics/detectors/pattern_detector.py +++ b/analytics/analytics/detectors/pattern_detector.py @@ -8,7 +8,7 @@ import pandas as pd from typing import Optional, Generator, List from detectors import Detector -from analytic_types import DataBucket +from analytic_types.data_bucket import DataBucket from models import ModelCache from utils import convert_pd_timestamp_to_ms from analytic_types import AnalyticUnitId