From 527de53f238a7a1c5218e1d8b69b50088961e0a2 Mon Sep 17 00:00:00 2001 From: eccabay Date: Wed, 21 Aug 2024 16:44:05 -0500 Subject: [PATCH] Lint fixes and exclusions for docs with ruff --- docs/source/user_guide/automl.ipynb | 8 +++++--- docs/source/user_guide/data_check_actions.ipynb | 1 - docs/source/user_guide/data_checks.ipynb | 2 +- docs/source/user_guide/model_understanding.ipynb | 2 -- docs/source/user_guide/pipelines.ipynb | 2 -- docs/source/user_guide/timeseries.ipynb | 2 +- pyproject.toml | 3 +-- 7 files changed, 8 insertions(+), 12 deletions(-) diff --git a/docs/source/user_guide/automl.ipynb b/docs/source/user_guide/automl.ipynb index 245e7c13ab..83563ec417 100644 --- a/docs/source/user_guide/automl.ipynb +++ b/docs/source/user_guide/automl.ipynb @@ -266,9 +266,6 @@ "metadata": {}, "outputs": [], "source": [ - "from evalml.pipelines import MulticlassClassificationPipeline\n", - "\n", - "\n", "automl_custom = evalml.automl.AutoMLSearch(\n", " X_train=X_train,\n", " y_train=y_train,\n", @@ -368,6 +365,11 @@ "metadata": {}, "outputs": [], "source": [ + "import logging\n", + "\n", + "logger = logging.getLogger(__name__)\n", + "\n", + "\n", "# error_callback example; this is implemented in the evalml library\n", "def raise_error_callback(exception, traceback, automl, **kwargs):\n", " \"\"\"Raises the exception thrown by the AutoMLSearch object. Also logs the exception as an error.\"\"\"\n", diff --git a/docs/source/user_guide/data_check_actions.ipynb b/docs/source/user_guide/data_check_actions.ipynb index 130ba38f0d..2ca115d14b 100644 --- a/docs/source/user_guide/data_check_actions.ipynb +++ b/docs/source/user_guide/data_check_actions.ipynb @@ -32,7 +32,6 @@ "outputs": [], "source": [ "import woodwork as ww\n", - "import pandas as pd\n", "from evalml import AutoMLSearch\n", "from evalml.demos import load_fraud\n", "from evalml.preprocessing import split_data" diff --git a/docs/source/user_guide/data_checks.ipynb b/docs/source/user_guide/data_checks.ipynb index 51c14a3cad..26f9519b46 100644 --- a/docs/source/user_guide/data_checks.ipynb +++ b/docs/source/user_guide/data_checks.ipynb @@ -688,7 +688,7 @@ "metadata": {}, "outputs": [], "source": [ - "from evalml.data_checks import NoVarianceDataCheck, DataCheckWarning\n", + "from evalml.data_checks import NoVarianceDataCheck, DataCheckError\n", "\n", "X = pd.DataFrame(\n", " {\n", diff --git a/docs/source/user_guide/model_understanding.ipynb b/docs/source/user_guide/model_understanding.ipynb index 2a39950030..66a800cf8d 100644 --- a/docs/source/user_guide/model_understanding.ipynb +++ b/docs/source/user_guide/model_understanding.ipynb @@ -928,8 +928,6 @@ "metadata": {}, "outputs": [], "source": [ - "import shap\n", - "\n", "from evalml.model_understanding.force_plots import graph_force_plot\n", "\n", "rows_to_explain = [0] # Should be a list of integer indices of the rows to explain.\n", diff --git a/docs/source/user_guide/pipelines.ipynb b/docs/source/user_guide/pipelines.ipynb index 8dabdee3b2..7549cb3873 100644 --- a/docs/source/user_guide/pipelines.ipynb +++ b/docs/source/user_guide/pipelines.ipynb @@ -586,9 +586,7 @@ "source": [ "from evalml.pipelines.utils import generate_pipeline_code\n", "from evalml.pipelines import BinaryClassificationPipeline\n", - "import pandas as pd\n", "from evalml.utils import infer_feature_types\n", - "from skopt.space import Integer\n", "\n", "\n", "class MyDropNullColumns(Transformer):\n", diff --git a/docs/source/user_guide/timeseries.ipynb b/docs/source/user_guide/timeseries.ipynb index ab899a72bd..eaabcc63cd 100644 --- a/docs/source/user_guide/timeseries.ipynb +++ b/docs/source/user_guide/timeseries.ipynb @@ -496,7 +496,7 @@ "outputs": [], "source": [ "stl = STLDecomposer()\n", - "assert stl.period == None\n", + "assert stl.period is None\n", "stl.fit(X_stl, y_stl)\n", "print(stl.period)" ] diff --git a/pyproject.toml b/pyproject.toml index d72780bec0..d51b146f55 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -63,7 +63,6 @@ dependencies = [ "lime >= 0.2.0.1", "tomli >= 2.0.1", "packaging >= 23.0", - "black[jupyter] >= 22.3.0", "holidays >= 0.13" ] @@ -171,7 +170,7 @@ src = ["evalml"] "evalml/tests/**" = ["D"] "evalml/utils/**" = ["D"] ".github/**" = ["D"] -"docs/**" = ["D"] +"docs/**" = ["D", "I001", "E402", "F811", "F401"] [tool.ruff.lint.isort] known-first-party = ["evalml"]