Skip to content

MNT add isort to pre-commit hooks #23362

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 12 commits into from
4 changes: 4 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,7 @@ repos:
- id: mypy
files: sklearn/
additional_dependencies: [pytest==6.2.4]
- repo: https://github.com/PyCQA/isort
rev: 5.10.1
hooks:
- id: isort
5 changes: 4 additions & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,14 @@ jobs:
versionSpec: '3.9'
- bash: |
# Include pytest compatibility with mypy
pip install pytest flake8 mypy==0.782 black==22.3.0
pip install pytest flake8 mypy==0.782 black==22.3.0 isort
displayName: Install linters
- bash: |
black --check --diff .
displayName: Run black
- bash: |
isort --check --diff .
displayName: Run isort
- bash: |
./build_tools/circle/linting.sh
displayName: Run linting
Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,6 @@ exclude = '''
| asv_benchmarks/env
)/
'''

[tool.isort]
profile = "black"
4 changes: 2 additions & 2 deletions sklearn/model_selection/_split.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
from math import ceil, floor
import numbers
from abc import ABCMeta, abstractmethod
from inspect import signature

import numpy as np
from scipy.special import comb
import numpy as np
from inspect import signature

from ..utils import indexable, check_random_state, _safe_indexing
from ..utils import _approximate_mode
Expand Down