Skip to content

Commit

Permalink
added linting checks at push
Browse files Browse the repository at this point in the history
  • Loading branch information
tvdboom committed May 11, 2022
1 parent f751773 commit 1f4cdbe
Show file tree
Hide file tree
Showing 17 changed files with 146 additions and 109 deletions.
3 changes: 2 additions & 1 deletion .github/CI/check_latest_commit_for_nightly.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from datetime import datetime, timedelta
import sys
import traceback
from datetime import datetime, timedelta

import requests

# Author: Antoni Baum (Yard1)
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,30 @@ concurrency:
cancel-in-progress: true

jobs:

isort:
runs-on: ubuntu-latest
steps:
- name: Check out source repository
uses: actions/checkout@v2
- name: Set up Python environment
uses: actions/setup-python@v2
with:
python-version: 3.9
architecture: x64
- name: Check imports
uses: jamescurtin/isort-action@master
with:
sortPaths: pycaret

black:
runs-on: ubuntu-latest
steps:
- name: Check out source repository
uses: actions/checkout@v2
- name: Run black
uses: psf/black@stable

# JOBS MUST START WITH test !!!!
test:
runs-on: ubuntu-latest
Expand Down
13 changes: 9 additions & 4 deletions pycaret/classification/functional.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
import logging
import warnings
from typing import Any, Callable, Dict, List, Optional, Tuple, Union

import numpy as np
import pandas as pd
from joblib.memory import Memory
from typing import List, Tuple, Any, Union, Optional, Dict, Callable

# from pycaret.parallel import ParallelBackend # unused
from pycaret.loggers.base_logger import BaseLogger
from pycaret.classification import ClassificationExperiment
from pycaret.internal.utils import DATAFRAME_LIKE, TARGET_LIKE, check_if_global_is_not_none
from pycaret.internal.utils import (
DATAFRAME_LIKE,
TARGET_LIKE,
check_if_global_is_not_none,
)

# from pycaret.parallel import ParallelBackend # unused
from pycaret.loggers.base_logger import BaseLogger

warnings.filterwarnings("ignore")

Expand Down
48 changes: 26 additions & 22 deletions pycaret/classification/oop.py
Original file line number Diff line number Diff line change
@@ -1,40 +1,44 @@
import datetime
import gc
import time
import logging
import datetime
import warnings
import time
import traceback
import warnings
from typing import Any, Dict, List, Optional, Tuple, Union

import numpy as np # type: ignore
import pandas as pd
from typing import Tuple, Union, Optional, Dict, Any, List
from joblib.memory import Memory
import plotly.express as px # type: ignore
import plotly.graph_objects as go # type: ignore
from joblib.memory import Memory

# Own modules
import pycaret.containers.metrics.classification
import pycaret.containers.models.classification
import pycaret.internal.patches.sklearn
import pycaret.internal.patches.yellowbrick
import pycaret.internal.persistence
import pycaret.internal.preprocess
from pycaret.internal.Display import Display
from pycaret.internal.logging import get_logger
from pycaret.internal.meta_estimators import (
CustomProbabilityThresholdClassifier,
get_estimator_from_meta_estimator,
)
from pycaret.internal.pipeline import Pipeline as InternalPipeline
from pycaret.internal.pycaret_experiment.utils import highlight_setup, MLUsecase
from pycaret.internal.preprocess.preprocessor import Preprocessor
from pycaret.internal.pycaret_experiment.supervised_experiment import (
_SupervisedExperiment,
)
from pycaret.internal.preprocess.preprocessor import Preprocessor
from pycaret.internal.meta_estimators import (
CustomProbabilityThresholdClassifier,
get_estimator_from_meta_estimator,
from pycaret.internal.pycaret_experiment.utils import MLUsecase, highlight_setup
from pycaret.internal.utils import (
DATAFRAME_LIKE,
TARGET_LIKE,
get_classification_task,
get_label_encoder,
)
from pycaret.internal.utils import DATAFRAME_LIKE, TARGET_LIKE, get_classification_task, get_label_encoder
import pycaret.internal.patches.sklearn
import pycaret.internal.patches.yellowbrick
from pycaret.internal.logging import get_logger
from pycaret.internal.validation import is_sklearn_cv_generator
import pycaret.containers.metrics.classification
import pycaret.containers.models.classification
import pycaret.internal.preprocess
import pycaret.internal.persistence
from pycaret.internal.Display import Display
from pycaret.loggers.base_logger import BaseLogger


warnings.filterwarnings("ignore")
LOGGER = get_logger()

Expand Down Expand Up @@ -2822,7 +2826,7 @@ def dashboard(
dashboard_kwargs = dashboard_kwargs or {}
run_kwargs = run_kwargs or {}

from explainerdashboard import ExplainerDashboard, ClassifierExplainer
from explainerdashboard import ClassifierExplainer, ExplainerDashboard

le = get_label_encoder(self.pipeline)
if le:
Expand Down
15 changes: 10 additions & 5 deletions pycaret/regression/functional.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
import logging
import warnings
from typing import Any, Dict, List, Optional, Union

import numpy as np
import pandas as pd
from joblib.memory import Memory

from pycaret.internal.utils import (
DATAFRAME_LIKE,
TARGET_LIKE,
check_if_global_is_not_none,
)

# from pycaret.parallel import ParallelBackend # Unused
from pycaret.loggers.base_logger import BaseLogger

from pycaret.regression import RegressionExperiment
from pycaret.internal.utils import DATAFRAME_LIKE, TARGET_LIKE, check_if_global_is_not_none

from typing import List, Any, Union, Optional, Dict
import warnings

warnings.filterwarnings("ignore")

Expand Down Expand Up @@ -2948,6 +2952,7 @@ def deep_check(estimator, check_kwargs: Optional[dict] = None) -> None:
estimator=estimator, check_kwargs=check_kwargs
)


def set_current_experiment(experiment: RegressionExperiment):
global _CURRENT_EXPERIMENT

Expand Down
29 changes: 15 additions & 14 deletions pycaret/regression/oop.py
Original file line number Diff line number Diff line change
@@ -1,31 +1,32 @@
import time
import logging
import time
import warnings
from typing import Any, Dict, List, Optional, Tuple, Union

import numpy as np # type: ignore
import pandas as pd
from joblib.memory import Memory
from typing import List, Tuple, Dict, Union, Optional, Any
import plotly.express as px # type: ignore
import plotly.graph_objects as go # type: ignore
from joblib.memory import Memory

import pycaret.containers.metrics.regression
import pycaret.containers.models.regression
import pycaret.internal.patches.sklearn
import pycaret.internal.patches.yellowbrick
import pycaret.internal.persistence
import pycaret.internal.preprocess
from pycaret.internal.Display import Display
from pycaret.internal.logging import get_logger

# Own module
from pycaret.internal.pipeline import Pipeline as InternalPipeline
from pycaret.internal.preprocess.preprocessor import Preprocessor
from pycaret.internal.pycaret_experiment.utils import MLUsecase, highlight_setup
from pycaret.internal.pycaret_experiment.supervised_experiment import (
_SupervisedExperiment,
)
import pycaret.internal.patches.sklearn
import pycaret.internal.patches.yellowbrick
from pycaret.internal.logging import get_logger
import pycaret.containers.metrics.regression
import pycaret.containers.models.regression
import pycaret.internal.preprocess
import pycaret.internal.persistence
from pycaret.internal.Display import Display
from pycaret.loggers.base_logger import BaseLogger
from pycaret.internal.pycaret_experiment.utils import MLUsecase, highlight_setup
from pycaret.internal.utils import DATAFRAME_LIKE, TARGET_LIKE

from pycaret.loggers.base_logger import BaseLogger

warnings.filterwarnings("ignore")
LOGGER = get_logger()
Expand Down
2 changes: 1 addition & 1 deletion pycaret/tests/test_time_series_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
import pandas as pd
import pytest
from pandas.testing import assert_frame_equal
from sktime.forecasting.compose import ForecastingPipeline

from pycaret.time_series import TSForecastingExperiment
from sktime.forecasting.compose import ForecastingPipeline

from .time_series_test_utils import _return_compare_model_args, _return_model_parameters

Expand Down
12 changes: 5 additions & 7 deletions pycaret/tests/test_time_series_preprocess.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
"""Module to test time_series functionality
"""
import pytest
import numpy as np

import pytest
from sktime.forecasting.compose import ForecastingPipeline, TransformedTargetForecaster

from pycaret.time_series import TSForecastingExperiment

from .time_series_test_utils import (
_return_model_names_for_missing_data,
_IMPUTE_METHODS_STR,
_SCALE_METHODS,
_TRANSFORMATION_METHODS,
_TRANSFORMATION_METHODS_NO_NEG,
_SCALE_METHODS,
_return_model_names_for_missing_data,
)

from pycaret.time_series import TSForecastingExperiment


pytestmark = pytest.mark.filterwarnings("ignore::UserWarning")

########################################################
Expand Down
3 changes: 1 addition & 2 deletions pycaret/tests/test_time_series_tune_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@
import numpy as np
import pandas as pd
import pytest

from pycaret.time_series import TSForecastingExperiment
from sktime.forecasting.compose import ForecastingPipeline

from pycaret.time_series import TSForecastingExperiment

from .time_series_test_utils import _ALL_METRICS

Expand Down
4 changes: 2 additions & 2 deletions pycaret/tests/test_time_series_utils_forecasting_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
from pycaret.utils.time_series.forecasting.models import DummyForecaster
from pycaret.utils.time_series.forecasting.pipeline import (
_add_model_to_pipeline,
_transformations_present_X,
_transformations_present_y,
_are_pipeline_tansformations_empty,
_get_imputed_data,
_transformations_present_X,
_transformations_present_y,
)

pytestmark = pytest.mark.filterwarnings("ignore::UserWarning")
Expand Down
Loading

0 comments on commit 1f4cdbe

Please sign in to comment.