8000 MNT properly activate the env in the linting CI (#17177) · scikit-learn/scikit-learn@192109a · GitHub
[go: up one dir, main page]

Skip to content

Commit 192109a

Browse files
authored
MNT properly activate the env in the linting CI (#17177)
1 parent 865069c commit 192109a

File tree

5 files changed

+15
-9
lines changed

5 files changed

+15
-9
lines changed

azure-pipelines.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,27 +18,30 @@ jobs:
1818
- bash: sudo chown -R $USER $CONDA
1919
displayName: Take ownership of conda installation
2020
- bash: |
21+
set -ex
2122
conda create --name flake8_env --yes python=3.8
22-
conda activate flake8_env
23+
source activate flake8_env
2324
pip install flake8 mypy==0.770
2425
displayName: Install flake8
2526
- bash: |
27+
set -ex
2628
if [[ $BUILD_SOURCEVERSIONMESSAGE =~ \[lint\ skip\] ]]; then
2729
# skip linting
2830
echo "Skipping linting"
2931
exit 0
3032
else
31-
conda activate flake8_env
33+
source activate flake8_env
3234
./build_tools/circle/linting.sh
3335
fi
3436
displayName: Run linting
3537
- bash: |
38+
set -ex
3639
if [[ $BUILD_SOURCEVERSIONMESSAGE =~ \[lint\ skip\] ]]; then
3740
# skip linting
3841
echo "Skipping linting"
3942
exit 0
4043
else
41-
conda activate flake8_env
44+
source activate flake8_env
4245
mypy sklearn/ --ignore-missing-imports
4346
fi
4447
displayName: Run mypy

sklearn/cluster/_agglomerative.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
from ..neighbors import DistanceMetric
2222
from ..neighbors._dist_metrics import METRIC_MAPPING
2323

24-
from . import _hierarchical_fast as _hierarchical
24+
# mypy error: Module 'sklearn.cluster' has no attribute '_hierarchical_fast'
25+
from . import _hierarchical_fast as _hierarchical # type: ignore
2526
from ._feature_agglomeration import AgglomerationTransform
2627
from ..utils._fast_dict import IntFloatDict
2728
from ..utils.fixes import _astype_copy_false

sklearn/manifold/_t_sne.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
from ..utils.validation import _deprecate_positional_args
2323
from ..decomposition import PCA
2424
from ..metrics.pairwise import pairwise_distances
25-
from . import _utils
25+
# mypy error: Module 'sklearn.manifold' has no attribute '_utils'
26+
from . import _utils # type: ignore
2627
# mypy error: Module 'sklearn.manifold&# 101F2 39; has no attribute '_barnes_hut_tsne'
2728
from . import _barnes_hut_tsne # type: ignore
2829

sklearn/utils/tests/test_utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -657,9 +657,9 @@ def test_print_elapsed_time(message, expected, capsys, monkeypatch):
657657

658658
@pytest.mark.parametrize("value, result", [(float("nan"), True),
659659
(np.nan, True),
660-
(np.float("nan"), True),
661-
(np.float32("nan"), True),
662-
(np.float64("nan"), True),
660+
(np.float(np.nan), True),
661+
(np.float32(np.nan), True),
662+
(np.float64(np.nan), True),
663663
(0, False),
664664
(0., False),
665665
(None, False),

sklearn/utils/validation.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
from distutils.version import LooseVersion
1919
from inspect import signature, isclass, Parameter
2020

21-
from numpy.core.numeric import ComplexWarning
21+
# mypy error: Module 'numpy.core.numeric' has no attribute 'ComplexWarning'
22+
from numpy.core.numeric import ComplexWarning # type: ignore
2223
import joblib
2324

2425
from contextlib import suppress

0 commit comments

Comments
 (0)
0