From a6c16d0d1f898bf4095e4d258dca433b404a53b8 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 23 Jan 2024 17:46:50 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- .../sodacl/anomaly_detection_metric_check_cfg.py | 1 - soda/core/soda/sodacl/sodacl_parser.py | 2 -- .../data_source/test_anomaly_detection_check.py | 2 -- soda/scientific/setup.py | 5 ----- .../anomaly_detection_v2/anomaly_detector.py | 10 +++++----- .../anomaly_detection_v2/feedback_processor.py | 1 - .../anomaly_detection_v2/frequency_detector.py | 2 +- .../scientific/anomaly_detection_v2/models/base.py | 2 +- .../anomaly_detection_v2/models/prophet_model.py | 12 ++++++------ .../anomaly_detector_v2_test.py | 4 ++-- .../tests/anomaly_detection_v2/base_model_test.py | 8 ++++---- .../feedback_processor_test.py | 2 +- .../frequency_detector_test.py | 6 +++--- .../anomaly_detection_v2/prophet_model_test.py | 14 +++++++------- .../scientific/tests/anomaly_detection_v2/utils.py | 8 ++++---- 15 files changed, 34 insertions(+), 45 deletions(-) diff --git a/soda/core/soda/sodacl/anomaly_detection_metric_check_cfg.py b/soda/core/soda/sodacl/anomaly_detection_metric_check_cfg.py index 0178490aa..ccc3d6b8b 100644 --- a/soda/core/soda/sodacl/anomaly_detection_metric_check_cfg.py +++ b/soda/core/soda/sodacl/anomaly_detection_metric_check_cfg.py @@ -3,7 +3,6 @@ from typing import Any, ClassVar, Optional, Union from pydantic import BaseModel, ConfigDict, ValidationError, field_validator - from soda.common.logs import Logs from soda.sodacl.change_over_time_cfg import ChangeOverTimeCfg from soda.sodacl.location import Location diff --git a/soda/core/soda/sodacl/sodacl_parser.py b/soda/core/soda/sodacl/sodacl_parser.py index 399b446af..2157138a3 100644 --- a/soda/core/soda/sodacl/sodacl_parser.py +++ b/soda/core/soda/sodacl/sodacl_parser.py @@ -14,8 +14,6 @@ from soda.common.logs import Logs from soda.common.parser import Parser from soda.common.yaml_helper import to_yaml_str -from soda.execution.identity import ConsistentHashBuilder -from soda.model.type_mapping import TypeMapping from soda.sodacl.anomaly_detection_metric_check_cfg import ( AnomalyDetectionMetricCheckCfg, ModelConfigs, diff --git a/soda/core/tests/data_source/test_anomaly_detection_check.py b/soda/core/tests/data_source/test_anomaly_detection_check.py index 097b26504..dcd7923eb 100644 --- a/soda/core/tests/data_source/test_anomaly_detection_check.py +++ b/soda/core/tests/data_source/test_anomaly_detection_check.py @@ -4,7 +4,6 @@ from helpers.common_test_tables import customers_test_table from helpers.data_source_fixture import DataSourceFixture from helpers.mock_soda_cloud import TimeGenerator - from soda.cloud.historic_descriptor import ( HistoricCheckResultsDescriptor, HistoricMeasurementsDescriptor, @@ -19,7 +18,6 @@ def test_anomaly_detection_historic_descriptors(data_source_fixture: DataSourceF table_name = data_source_fixture.ensure_test_table(customers_test_table) import numpy as np - from soda.execution.check.anomaly_detection_metric_check import ( AnomalyDetectionMetricCheck, ) diff --git a/soda/scientific/setup.py b/soda/scientific/setup.py index c58fecdb8..b36050ec2 100644 --- a/soda/scientific/setup.py +++ b/soda/scientific/setup.py @@ -3,11 +3,6 @@ from setuptools import find_namespace_packages, setup -if sys.version_info < (3, 8): - print("Error: Soda Core requires at least Python 3.8") - print("Error: Please upgrade your Python version to 3.8 or later") - sys.exit(1) - package_name = "soda-core-scientific" package_version = "3.1.3" description = "Soda Core Scientific Package" diff --git a/soda/scientific/soda/scientific/anomaly_detection_v2/anomaly_detector.py b/soda/scientific/soda/scientific/anomaly_detection_v2/anomaly_detector.py index 496cdf025..113b8b1f8 100644 --- a/soda/scientific/soda/scientific/anomaly_detection_v2/anomaly_detector.py +++ b/soda/scientific/soda/scientific/anomaly_detection_v2/anomaly_detector.py @@ -3,8 +3,12 @@ import pandas as pd import yaml - from soda.common.logs import Logs +from soda.sodacl.anomaly_detection_metric_check_cfg import ( + ModelConfigs, + TrainingDatasetParameters, +) + from soda.scientific.anomaly_detection_v2.feedback_processor import FeedbackProcessor from soda.scientific.anomaly_detection_v2.models.prophet_model import ProphetDetector from soda.scientific.anomaly_detection_v2.pydantic_models import ( @@ -14,10 +18,6 @@ AnomalyResult, FreqDetectionResult, ) -from soda.sodacl.anomaly_detection_metric_check_cfg import ( - ModelConfigs, - TrainingDatasetParameters, -) class AnomalyDetector: diff --git a/soda/scientific/soda/scientific/anomaly_detection_v2/feedback_processor.py b/soda/scientific/soda/scientific/anomaly_detection_v2/feedback_processor.py index f0b0468ce..ae5d6decb 100644 --- a/soda/scientific/soda/scientific/anomaly_detection_v2/feedback_processor.py +++ b/soda/scientific/soda/scientific/anomaly_detection_v2/feedback_processor.py @@ -8,7 +8,6 @@ from typing import Any, Dict, Tuple import pandas as pd - from soda.common.logs import Logs FEEDBACK_REASONS = { diff --git a/soda/scientific/soda/scientific/anomaly_detection_v2/frequency_detector.py b/soda/scientific/soda/scientific/anomaly_detection_v2/frequency_detector.py index 2dc828e4f..7ab7fcdc2 100644 --- a/soda/scientific/soda/scientific/anomaly_detection_v2/frequency_detector.py +++ b/soda/scientific/soda/scientific/anomaly_detection_v2/frequency_detector.py @@ -1,8 +1,8 @@ from typing import Any import pandas as pd - from soda.common.logs import Logs + from soda.scientific.anomaly_detection_v2.globals import DETECTOR_MESSAGES from soda.scientific.anomaly_detection_v2.pydantic_models import FreqDetectionResult from soda.scientific.anomaly_detection_v2.utils import ( diff --git a/soda/scientific/soda/scientific/anomaly_detection_v2/models/base.py b/soda/scientific/soda/scientific/anomaly_detection_v2/models/base.py index d3d36817f..9ce24aff7 100644 --- a/soda/scientific/soda/scientific/anomaly_detection_v2/models/base.py +++ b/soda/scientific/soda/scientific/anomaly_detection_v2/models/base.py @@ -2,8 +2,8 @@ from abc import ABC, abstractmethod import pandas as pd - from soda.common.logs import Logs + from soda.scientific.anomaly_detection_v2.pydantic_models import FreqDetectionResult diff --git a/soda/scientific/soda/scientific/anomaly_detection_v2/models/prophet_model.py b/soda/scientific/soda/scientific/anomaly_detection_v2/models/prophet_model.py index f88565fa9..14fc9827c 100644 --- a/soda/scientific/soda/scientific/anomaly_detection_v2/models/prophet_model.py +++ b/soda/scientific/soda/scientific/anomaly_detection_v2/models/prophet_model.py @@ -11,9 +11,14 @@ import numpy as np import pandas as pd from prophet.diagnostics import cross_validation, performance_metrics +from soda.common.logs import Logs +from soda.sodacl.anomaly_detection_metric_check_cfg import ( + HyperparameterConfigs, + ProphetDefaultHyperparameters, + TrainingDatasetParameters, +) from tqdm import tqdm -from soda.common.logs import Logs from soda.scientific.anomaly_detection_v2.exceptions import ( AggregationValueError, FreqDetectionResultError, @@ -29,11 +34,6 @@ SuppressStdoutStderr, get_not_enough_measurements_freq_result, ) -from soda.sodacl.anomaly_detection_metric_check_cfg import ( - HyperparameterConfigs, - ProphetDefaultHyperparameters, - TrainingDatasetParameters, -) with SuppressStdoutStderr(): from prophet import Prophet diff --git a/soda/scientific/tests/anomaly_detection_v2/anomaly_detector_v2_test.py b/soda/scientific/tests/anomaly_detection_v2/anomaly_detector_v2_test.py index d419fa98f..898f1e352 100644 --- a/soda/scientific/tests/anomaly_detection_v2/anomaly_detector_v2_test.py +++ b/soda/scientific/tests/anomaly_detection_v2/anomaly_detector_v2_test.py @@ -12,14 +12,14 @@ test_anomaly_detector_parsed_historical_measurements, test_empty_anomaly_detector_parsed_ad_measurements, ) - from soda.common.logs import Logs -from soda.scientific.anomaly_detection_v2.anomaly_detector import AnomalyDetector from soda.sodacl.anomaly_detection_metric_check_cfg import ( ModelConfigs, TrainingDatasetParameters, ) +from soda.scientific.anomaly_detection_v2.anomaly_detector import AnomalyDetector + LOGS = Logs(logging.getLogger(__name__)) diff --git a/soda/scientific/tests/anomaly_detection_v2/base_model_test.py b/soda/scientific/tests/anomaly_detection_v2/base_model_test.py index fe544decd..33bfa55d9 100644 --- a/soda/scientific/tests/anomaly_detection_v2/base_model_test.py +++ b/soda/scientific/tests/anomaly_detection_v2/base_model_test.py @@ -10,17 +10,17 @@ test_prophet_model_skip_measurements_this_exclusive_previous, test_prophet_model_skip_measurements_this_exclusive_previous_expectation, ) - from soda.common.logs import Logs -from soda.scientific.anomaly_detection_v2.anomaly_detector import AnomalyDetector -from soda.scientific.anomaly_detection_v2.models.prophet_model import ProphetDetector -from soda.scientific.anomaly_detection_v2.pydantic_models import FreqDetectionResult from soda.sodacl.anomaly_detection_metric_check_cfg import ( HyperparameterConfigs, ModelConfigs, TrainingDatasetParameters, ) +from soda.scientific.anomaly_detection_v2.anomaly_detector import AnomalyDetector +from soda.scientific.anomaly_detection_v2.models.prophet_model import ProphetDetector +from soda.scientific.anomaly_detection_v2.pydantic_models import FreqDetectionResult + LOGS = Logs(logging.getLogger(__name__)) PARAMS = AnomalyDetector( measurements={"results": []}, diff --git a/soda/scientific/tests/anomaly_detection_v2/feedback_processor_test.py b/soda/scientific/tests/anomaly_detection_v2/feedback_processor_test.py index fff175b86..2cc6cce42 100644 --- a/soda/scientific/tests/anomaly_detection_v2/feedback_processor_test.py +++ b/soda/scientific/tests/anomaly_detection_v2/feedback_processor_test.py @@ -10,8 +10,8 @@ test_feedback_processor_seasonality_skip_measurements, test_feedback_processor_seasonality_skip_measurements_expectation, ) - from soda.common.logs import Logs + from soda.scientific.anomaly_detection_v2.feedback_processor import FeedbackProcessor LOGS = Logs(logging.getLogger(__name__)) diff --git a/soda/scientific/tests/anomaly_detection_v2/frequency_detector_test.py b/soda/scientific/tests/anomaly_detection_v2/frequency_detector_test.py index 6b6a4dde6..09ff44d1c 100644 --- a/soda/scientific/tests/anomaly_detection_v2/frequency_detector_test.py +++ b/soda/scientific/tests/anomaly_detection_v2/frequency_detector_test.py @@ -2,15 +2,15 @@ import pandas as pd from anomaly_detection_v2.utils import generate_random_dataframe - from soda.common.logs import Logs -from soda.scientific.anomaly_detection_v2.anomaly_detector import AnomalyDetector -from soda.scientific.anomaly_detection_v2.frequency_detector import FrequencyDetector from soda.sodacl.anomaly_detection_metric_check_cfg import ( ModelConfigs, TrainingDatasetParameters, ) +from soda.scientific.anomaly_detection_v2.anomaly_detector import AnomalyDetector +from soda.scientific.anomaly_detection_v2.frequency_detector import FrequencyDetector + LOGS = Logs(logging.getLogger(__name__)) PARAMS = AnomalyDetector( measurements={"results": []}, diff --git a/soda/scientific/tests/anomaly_detection_v2/prophet_model_test.py b/soda/scientific/tests/anomaly_detection_v2/prophet_model_test.py index af5646057..6bd5f46cb 100644 --- a/soda/scientific/tests/anomaly_detection_v2/prophet_model_test.py +++ b/soda/scientific/tests/anomaly_detection_v2/prophet_model_test.py @@ -17,13 +17,6 @@ df_prophet_model_setup_fit_predict, test_feedback_processor_seasonality_skip_measurements, ) - -from soda.scientific.anomaly_detection_v2.exceptions import ( - AggregationValueError, - FreqDetectionResultError, -) -from soda.scientific.anomaly_detection_v2.feedback_processor import FeedbackProcessor -from soda.scientific.anomaly_detection_v2.models.prophet_model import ProphetDetector from soda.sodacl.anomaly_detection_metric_check_cfg import ( HyperparameterConfigs, ProphetDefaultHyperparameters, @@ -33,6 +26,13 @@ TrainingDatasetParameters, ) +from soda.scientific.anomaly_detection_v2.exceptions import ( + AggregationValueError, + FreqDetectionResultError, +) +from soda.scientific.anomaly_detection_v2.feedback_processor import FeedbackProcessor +from soda.scientific.anomaly_detection_v2.models.prophet_model import ProphetDetector + def test_with_exit() -> None: time_series_df = generate_random_dataframe(size=2, n_rows_to_convert_none=0, frequency="D") diff --git a/soda/scientific/tests/anomaly_detection_v2/utils.py b/soda/scientific/tests/anomaly_detection_v2/utils.py index b370b4234..cb72cc256 100644 --- a/soda/scientific/tests/anomaly_detection_v2/utils.py +++ b/soda/scientific/tests/anomaly_detection_v2/utils.py @@ -2,11 +2,7 @@ import numpy as np import pandas as pd - from soda.common.logs import Logs -from soda.scientific.anomaly_detection_v2.anomaly_detector import AnomalyDetector -from soda.scientific.anomaly_detection_v2.frequency_detector import FrequencyDetector -from soda.scientific.anomaly_detection_v2.models.prophet_model import ProphetDetector from soda.sodacl.anomaly_detection_metric_check_cfg import ( HyperparameterConfigs, ModelConfigs, @@ -14,6 +10,10 @@ TrainingDatasetParameters, ) +from soda.scientific.anomaly_detection_v2.anomaly_detector import AnomalyDetector +from soda.scientific.anomaly_detection_v2.frequency_detector import FrequencyDetector +from soda.scientific.anomaly_detection_v2.models.prophet_model import ProphetDetector + def generate_random_dataframe(size: int, n_rows_to_convert_none: int, frequency: str = "D") -> pd.DataFrame: """