Skip to content

Commit

Permalink
[MNT] Update pre commit hooks (#5646)
Browse files Browse the repository at this point in the history
1. updated versions of configured hooks
2. removed deprecated flags
3. removed unnecessary hadcoded outdated pins
4. used consistent array specification style
5. ran all hooks over all files
  • Loading branch information
yarnabrina authored Dec 21, 2023
1 parent b999b10 commit e3ec41f
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 23 deletions.
32 changes: 17 additions & 15 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
- id: check-added-large-files
args: ["--maxkb=1000"]
args:
- --maxkb=1000
- id: check-case-conflict
- id: check-merge-conflict
- id: check-symlinks
Expand All @@ -18,24 +19,23 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/asottile/pyupgrade
rev: v3.10.1
rev: v3.15.0
hooks:
- id: pyupgrade
args:
- --py38-plus

- repo: https://github.com/pycqa/isort
rev: 5.12.0
rev: 5.13.2
hooks:
- id: isort
name: isort

- repo: https://github.com/psf/black
rev: 23.7.0
rev: 23.12.0
hooks:
- id: black
language_version: python3
# args: [--line-length 79]

- repo: https://github.com/pycqa/flake8
rev: 6.1.0
Expand All @@ -51,28 +51,30 @@ repos:
stages: [manual]

- repo: https://github.com/nbQA-dev/nbQA
rev: 1.7.0
rev: 1.7.1
hooks:
- id: nbqa-black
args: [--nbqa-mutate, --nbqa-dont-skip-bad-cells]
additional_dependencies: [black==22.3.0]
args:
- --nbqa-dont-skip-bad-cells
- id: nbqa-isort
args: [--nbqa-mutate, --nbqa-dont-skip-bad-cells]
additional_dependencies: [isort==5.6.4]
args:
- --nbqa-dont-skip-bad-cells
- id: nbqa-flake8
args: [--nbqa-dont-skip-bad-cells, "--extend-ignore=E402,E203"]
additional_dependencies: [flake8==3.8.3]
args:
- --nbqa-dont-skip-bad-cells
- --extend-ignore=E402,E203

- repo: https://github.com/pycqa/pydocstyle
rev: 6.3.0
hooks:
- id: pydocstyle
args: ["--config=setup.cfg"]
args:
- --config=setup.cfg

# We use the Python version instead of the original version which seems to require Docker
# https://github.com/koalaman/shellcheck-precommit
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.9.0.5
rev: v0.9.0.6
hooks:
- id: shellcheck
name: shellcheck
2 changes: 0 additions & 2 deletions examples/mlflow.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@
],
"source": [
"with mlflow.start_run():\n",
"\n",
" forecaster = NaiveForecaster()\n",
" forecaster.fit(\n",
" y_train,\n",
Expand Down Expand Up @@ -691,7 +690,6 @@
"mlflow.set_experiment(\"Test Sktime\")\n",
"\n",
"with mlflow.start_run() as run:\n",
"\n",
" forecaster = NaiveForecaster()\n",
" forecaster.fit(y_train, X=X_train, fh=[1, 2, 3])\n",
" forecaster.pyfunc_predict_conf = pyfunc_predict_conf\n",
Expand Down
2 changes: 1 addition & 1 deletion sktime/datasets/_readers_writers/arff.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ def write_tabular_transformation_to_arff(
dirt = f"{str(path)}/{str(problem_name)}-{type(transformation).__name__}/"
try:
os.makedirs(dirt)
except os.error:
except OSError:
pass # raises os.error if path already exists
# create arff file in the path
file = open(
Expand Down
4 changes: 2 additions & 2 deletions sktime/datasets/_readers_writers/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def _write_header(
dirt = f"{str(path)}/{str(problem_name)}/"
try:
os.makedirs(dirt)
except os.error:
except OSError:
pass # raises os.error if path already exists
# create ts file in the path
file = open(f"{dirt}{str(problem_name)}{fold}.ts", "w")
Expand Down Expand Up @@ -210,7 +210,7 @@ def write_results_to_uea_format(
output_path = f"{output_path}/{estimator_name}/Predictions/{dataset_name}/"
try:
os.makedirs(output_path)
except os.error:
except OSError:
pass # raises os.error if path already exists, so just ignore this

if split == "TRAIN" or split == "train":
Expand Down
4 changes: 1 addition & 3 deletions sktime/transformations/panel/catch22.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,9 +403,7 @@ def _transform_case(self, X, f_idx):
return c22

def _transform_single_feature(self, X, feature, case_id=None):
if isinstance(feature, (int, np.integer)) or isinstance(
feature, (float, float)
):
if isinstance(feature, (int, np.integer)) or isinstance(feature, float):
if feature > 21 or feature < 0:
raise ValueError("Invalid catch22 feature ID")
elif isinstance(feature, str):
Expand Down

0 comments on commit e3ec41f

Please sign in to comment.