Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jan 23, 2024
1 parent 4b7f586 commit a6c16d0
Show file tree
Hide file tree
Showing 15 changed files with 34 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions soda/core/soda/sodacl/sodacl_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 0 additions & 2 deletions soda/core/tests/data_source/test_anomaly_detection_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
)
Expand Down
5 changes: 0 additions & 5 deletions soda/scientific/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand All @@ -14,10 +18,6 @@
AnomalyResult,
FreqDetectionResult,
)
from soda.sodacl.anomaly_detection_metric_check_cfg import (
ModelConfigs,
TrainingDatasetParameters,
)


class AnomalyDetector:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from typing import Any, Dict, Tuple

import pandas as pd

from soda.common.logs import Logs

FEEDBACK_REASONS = {
Expand Down
Original file line number Diff line number Diff line change
@@ -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 (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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__))


Expand Down
8 changes: 4 additions & 4 deletions soda/scientific/tests/anomaly_detection_v2/base_model_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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": []},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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__))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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": []},
Expand Down
14 changes: 7 additions & 7 deletions soda/scientific/tests/anomaly_detection_v2/prophet_model_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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")
Expand Down
8 changes: 4 additions & 4 deletions soda/scientific/tests/anomaly_detection_v2/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@

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,
ProphetDefaultHyperparameters,
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:
"""
Expand Down

0 comments on commit a6c16d0

Please sign in to comment.