8000 Merge branch 'main' into feat/pdr-32bit · scikit-learn/scikit-learn@31b8b28 · GitHub
[go: up one dir, main page]

Skip to content

Commit 31b8b28

Browse files
authored
Merge branch 'main' into feat/pdr-32bit
2 parents 840b473 + 82cd3d7 commit 31b8b28

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+869
-738
lines changed

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v2.3.0
3+
rev: v4.3.0
44
hooks:
55
- id: check-yaml
66
- id: end-of-file-fixer
@@ -9,8 +9,8 @@ repos:
99
rev: 22.3.0
1010
hooks:
1111
- id: black
12-
- repo: https://gitlab.com/pycqa/flake8
13-
rev: 3.9.2
12+
- repo: https://github.com/pycqa/flake8
13+
rev: 4.0.1
1414
hooks:
1515
- id: flake8
1616
types: [file, python]

Makefile

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,3 @@ doc-noplot: inplace
6363
code-analysis:
6464
flake8 sklearn | grep -v __init__ | grep -v 8000 external
6565
pylint -E -i y sklearn/ -d E1103,E0611,E1101
66-
67-
flake8-diff:
68-
git diff upstream/main -u -- "*.py" | flake8 --diff

azure-pipelines.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
black --check --diff .
4141
displayName: Run black
4242
- bash: |
43-
./build_tools/circle/linting.sh
43+
./build_tools/azure/linting.sh
4444
displayName: Run linting
4545
- bash: |
4646
mypy sklearn/

build_tools/azure/linting.sh

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/bin/bash
2+
3+
set -e
4+
# pipefail is necessary to propagate exit codes
5+
set -o pipefail
6+
7+
flake8 --show-source .
8+
echo -e "No problem detected by flake8\n"
9+
10+
# For docstrings and warnings of deprecated attributes to be rendered
11+
# properly, the property decorator must come before the deprecated decorator
12+
# (else they are treated as functions)
13+
14+
# do not error when grep -B1 "@property" finds nothing
15+
set +e
16+
bad_deprecation_property_order=`git grep -A 10 "@property" -- "*.py" | awk '/@property/,/def /' | grep -B1 "@deprecated"`
17+
18+
if [ ! -z "$bad_deprecation_property_order" ]
19+
then
20+
echo "property decorator should come before deprecated decorator"
21+
echo "found the following occurrencies:"
22+
echo $bad_deprecation_property_order
23+
exit 1
24+
fi
25+
26+
# Check for default doctest directives ELLIPSIS and NORMALIZE_WHITESPACE
27+
28+
doctest_directive="$(git grep -nw -E "# doctest\: \+(ELLIPSIS|NORMALIZE_WHITESPACE)")"
29+
30+
if [ ! -z "$doctest_directive" ]
31+
then
32+
echo "ELLIPSIS and NORMALIZE_WHITESPACE doctest directives are enabled by default, but were found in:"
33+
echo "$doctest_directive"
34+
exit 1
35+
fi
36+
37+
joblib_import="$(git grep -l -A 10 -E "joblib import.+delayed" -- "*.py" ":!sklearn/utils/_joblib.py" ":!sklearn/utils/fixes.py")"
38+
39+
if [ ! -z "$joblib_import" ]; then
40+
echo "Use from sklearn.utils.fixes import delayed instead of joblib delayed. The following files contains imports to joblib.delayed:"
41+
echo "$joblib_import"
42+
exit 1
43+
fi

build_tools/circle/linting.sh

Lines changed: 0 additions & 179 deletions
This file was deleted.

doc/contributor_experience_team.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,8 @@
3737
<a href='https://github.com/albertcthomas'><img src='https://avatars.githubusercontent.com/u/15966638?v=4' class='avatar' /></a> <br />
3838
<p>Albert Thomas</p>
3939
</div>
40-
</div>
40+
<div>
41+
<a href='https://github.com/Micky774'><img src='https://avatars.githubusercontent.com/u/34613774?v=4' class='avatar' /></a> <br />
42+
<p>Meekail Zain</p>
43+
</div>
44+
</div>

doc/developers/contributing.rst

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -435,15 +435,11 @@ complies with the following rules before marking a PR as ``[MRG]``. The
435435
`editor integration documentation <https://black.readthedocs.io/en/stable/integrations/editors.html>`_
436436
to configure your editor to run `black`.
437437

438-
6. **Make sure that your PR does not add PEP8 violations**. To check the
439-
code that you changed, you can run the following command (see
440-
:ref:`above <upstream>` to set up the ``upstream`` remote):
438+
6. Run `flake8` to make sure you followed the project coding conventions.
441439

442440
.. prompt:: bash $
443441

444-
git diff upstream/main -u -- "*.py" | flake8 --diff
445-
446-
or `make flake8-diff` which should work on Unix-like systems.
442+
flake8 .
447443

448444
7. Follow the :ref:`coding-guidelines`.
449445

doc/developers/develop.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -370,9 +370,10 @@ While when `deep=False`, the output will be::
370370
my_extra_param -> random
371371
subestimator -> LogisticRegression()
372372

373-
The ``set_params`` on the other hand takes as input a dict of the form
374-
``'parameter': value`` and sets the parameter of the estimator using this dict.
375-
Return value must be estimator itself.
373+
On the other hand, ``set_params`` takes the parameters of ``__init__``
374+
as keyword arguments, unpacks them into a dict of the form
375+
``'parameter': value`` and sets the parameters of the estimator using this dict.
376+
Return value must be the estimator itself.
376377

377378
While the ``get_params`` mechanism is not essential (see :ref:`cloning` below),
378379
the ``set_params`` function is necessary as it is used to set parameters during

doc/modules/feature_extraction.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ need not be stored) and storing feature names in addition to values.
3333
:class:`DictVectorizer` implements what is called one-of-K or "one-hot"
3434
coding for categorical (aka nominal, discrete) features. Categorical
3535
features are "attribute-value" pairs where the value is restricted
36-
to a list of discrete of possibilities without ordering (e.g. topic
36+
to a list of discrete possibilities without ordering (e.g. topic
3737
identifiers, types of objects, tags, names...).
3838

3939
In the following, "city" is a categorical attribute while "temperature"
@@ -995,7 +995,7 @@ Patch extraction
995995
The :func:`extract_patches_2d` function extracts patches from an image stored
996996
as a two-dimensional array, or three-dimensional with color information along
997997
the third axis. For rebuilding an image from all its patches, use
998-
:func:`reconstruct_from_patches_2d`. For example let use generate a 4x4 pixel
998+
:func:`reconstruct_from_patches_2d`. For example let us generate a 4x4 pixel
999999
picture with 3 color channels (e.g. in RGB format)::
10001000

10011001
>>> import numpy as np

doc/modules/impute.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use incomplete datasets is to discard entire rows and/or columns containing
1414
missing values. However, this comes at the price of losing data which may be
1515
valuable (even though incomplete). A better strategy is to impute the missing
1616
values, i.e., to infer them from the known part of the data. See the
17-
:ref:`glossary` entry on imputation.
17+
glossary entry on :term:`imputation`.
1818

1919

2020
Univariate vs. Multivariate Imputation

0 commit comments

Comments
 (0)
0