Skip to content

Commit 8274005

Browse files
author
ShaharNaveh
committed
Merge remote-tracking branch 'upstream/master' into DOC-Fix-algo-index-nan
2 parents 291cae2 + 70435eb commit 8274005

File tree

210 files changed

+4871
-3869
lines changed

Some content is hidden

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

210 files changed

+4871
-3869
lines changed

.pre-commit-config.yaml

+11-95
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
minimum_pre_commit_version: 2.9.2
22
exclude: ^LICENSES/|\.(html|csv|svg)$
3+
ci:
4+
autofix_prs: false
35
repos:
46
- repo: https://github.com/MarcoGorelli/absolufy-imports
57
rev: v0.3.0
@@ -36,7 +38,10 @@ repos:
3638
rev: 3.9.0
3739
hooks:
3840
- id: flake8
39-
additional_dependencies: [flake8-comprehensions>=3.1.0, flake8-bugbear>=21.3.2]
41+
additional_dependencies:
42+
- flake8-comprehensions==3.1.0
43+
- flake8-bugbear==21.3.2
44+
- pandas-dev-flaker==0.2.0
4045
- id: flake8
4146
name: flake8 (cython)
4247
types: [cython]
@@ -69,7 +74,11 @@ repos:
6974
rev: v1.2.2
7075
hooks:
7176
- id: yesqa
72-
additional_dependencies: [flake8==3.9.0]
77+
additional_dependencies:
78+
- flake8==3.9.0
79+
- flake8-comprehensions==3.1.0
80+
- flake8-bugbear==21.3.2
81+
- pandas-dev-flaker==0.2.0
7382
- repo: local
7483
hooks:
7584
- id: flake8-rst
@@ -80,28 +89,6 @@ repos:
8089
types: [rst]
8190
args: [--filename=*.rst]
8291
additional_dependencies: [flake8-rst==0.7.0, flake8==3.7.9]
83-
- id: frame-or-series-union
84-
name: Check for use of Union[Series, DataFrame] instead of FrameOrSeriesUnion alias
85-
entry: Union\[.*(Series,.*DataFrame|DataFrame,.*Series).*\]
86-
language: pygrep
87-
types: [python]
88-
exclude: ^pandas/_typing\.py$
89-
- id: inconsistent-namespace-usage
90-
name: 'Check for inconsistent use of pandas namespace'
91-
entry: python scripts/check_for_inconsistent_pandas_namespace.py
92-
language: python
93-
types: [python]
94-
- id: no-os-remove
95-
name: Check code for instances of os.remove
96-
entry: os\.remove
97-
language: pygrep
98-
types: [python]
99-
files: ^pandas/tests/
100-
exclude: |
101-
(?x)^
102-
pandas/tests/io/excel/test_writers\.py
103-
|pandas/tests/io/pytables/common\.py
104-
|pandas/tests/io/pytables/test_store\.py$
10592
- id: unwanted-patterns
10693
name: Unwanted patterns
10794
language: pygrep
@@ -111,52 +98,10 @@ repos:
11198
\#\ type:\ (?!ignore)
11299
|\#\ type:\s?ignore(?!\[)
113100
114-
# foo._class__ instead of type(foo)
115-
|\.__class__
116-
117-
# np.bool/np.object instead of np.bool_/np.object_
118-
|np\.bool[^_8]
119-
|np\.object[^_8]
120-
121-
# imports from pandas.core.common instead of `import pandas.core.common as com`
122-
|from\ pandas\.core\.common\ import
123-
|from\ pandas\.core\ import\ common
124-
125-
# imports from collections.abc instead of `from collections import abc`
126-
|from\ collections\.abc\ import
127-
128-
# Numpy
129-
|from\ numpy\ import\ random
130-
|from\ numpy\.random\ import
131-
132101
# Incorrect code-block / IPython directives
133102
|\.\.\ code-block\ ::
134103
|\.\.\ ipython\ ::
135104
types_or: [python, cython, rst]
136-
exclude: ^doc/source/development/code_style\.rst # contains examples of patterns to avoid
137-
- id: unwanted-patterns-in-tests
138-
name: Unwanted patterns in tests
139-
language: pygrep
140-
entry: |
141-
(?x)
142-
# pytest.xfail instead of pytest.mark.xfail
143-
pytest\.xfail
144-
145-
# imports from pandas._testing instead of `import pandas._testing as tm`
146-
|from\ pandas\._testing\ import
147-
|from\ pandas\ import\ _testing\ as\ tm
148-
149-
# No direct imports from conftest
150-
|conftest\ import
151-
|import\ conftest
152-
153-
# pandas.testing instead of tm
154-
|pd\.testing\.
155-
156-
# pd.api.types instead of from pandas.api.types import ...
157-
|(pd|pandas)\.api\.types\.
158-
files: ^pandas/tests/
159-
types_or: [python, cython, rst]
160105
- id: pip-to-conda
161106
name: Generate pip dependency from conda
162107
description: This hook checks if the conda environment.yml and requirements-dev.txt are equal
@@ -178,35 +123,6 @@ repos:
178123
language: python
179124
types: [rst]
180125
files: ^doc/source/(development|reference)/
181-
- id: unwanted-patterns-bare-pytest-raises
182-
name: Check for use of bare pytest raises
183-
language: python
184-
entry: python scripts/validate_unwanted_patterns.py --validation-type="bare_pytest_raises"
185-
types: [python]
186-
files: ^pandas/tests/
187-
exclude: ^pandas/tests/extension/
188-
- id: unwanted-patterns-private-function-across-module
189-
name: Check for use of private functions across modules
190-
language: python
191-
entry: python scripts/validate_unwanted_patterns.py --validation-type="private_function_across_module"
192-
types: [python]
193-
exclude: ^(asv_bench|pandas/tests|doc)/
194-
- id: unwanted-patterns-private-import-across-module
195-
name: Check for import of private attributes across modules
196-
language: python
197-
entry: python scripts/validate_unwanted_patterns.py --validation-type="private_import_across_module"
198-
types: [python]
199-
exclude: ^(asv_bench|pandas/tests|doc)/
200-
- id: unwanted-patterns-strings-to-concatenate
201-
name: Check for use of not concatenated strings
202-
language: python
203-
entry: python scripts/validate_unwanted_patterns.py --validation-type="strings_to_concatenate"
204-
types_or: [python, cython]
205-
- id: unwanted-patterns-strings-with-wrong-placed-whitespace
206-
name: Check for strings with wrong placed spaces
207-
language: python
208-
entry: python scripts/validate_unwanted_patterns.py --validation-type="strings_with_wrong_placed_whitespace"
209-
types_or: [python, cython]
210126
- id: use-pd_array-in-core
211127
name: Import pandas.array as pd_array in core
212128
language: python

.travis.yml

+4-9
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,11 @@ matrix:
3535
fast_finish: true
3636

3737
include:
38-
- arch: arm64
38+
- arch: arm64-graviton2
39+
virt: lxd
40+
group: edge
3941
env:
40-
- JOB="3.7, arm64" PYTEST_WORKERS=1 ENV_FILE="ci/deps/travis-37-arm64.yaml" PATTERN="(not slow and not network and not clipboard and not arm_slow)"
41-
42-
allow_failures:
43-
# Moved to allowed_failures 2020-09-29 due to timeouts https://github.com/pandas-dev/pandas/issues/36719
44-
- arch: arm64
45-
env:
46-
- JOB="3.7, arm64" PYTEST_WORKERS=1 ENV_FILE="ci/deps/travis-37-arm64.yaml" PATTERN="(not slow and not network and not clipboard and not arm_slow)"
47-
42+
- JOB="3.7, arm64" PYTEST_WORKERS="auto" ENV_FILE="ci/deps/travis-37-arm64.yaml" PATTERN="(not slow and not network and not clipboard and not arm_slow)"
4843

4944
before_install:
5045
- echo "before_install"

asv_bench/benchmarks/gil.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
except ImportError:
3232
from pandas import algos
3333
try:
34-
from pandas._testing import test_parallel
34+
from pandas._testing import test_parallel # noqa: PDF014
3535

3636
have_real_test_parallel = True
3737
except ImportError:

asv_bench/benchmarks/groupby.py

+13-1
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,19 @@ class GroupByCythonAgg:
480480
param_names = ["dtype", "method"]
481481
params = [
482482
["float64"],
483-
["sum", "prod", "min", "max", "mean", "median", "var", "first", "last"],
483+
[
484+
"sum",
485+
"prod",
486+
"min",
487+
"max",
488+
"mean",
489+
"median",
490+
"var",
491+
"first",
492+
"last",
493+
"any",
494+
"all",
495+
],
484496
]
485497

486498
def setup(self, dtype, method):

asv_bench/benchmarks/pandas_vb_common.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ class BaseIO:
7070
def remove(self, f):
7171
"""Remove created files"""
7272
try:
73-
os.remove(f)
73+
os.remove(f) # noqa: PDF008
7474
except OSError:
7575
# On Windows, attempting to remove a file that is in use
7676
# causes an exception to be raised

ci/azure/windows.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
vmImage: ${{ parameters.vmImage }}
99
strategy:
1010
matrix:
11-
py37_np16:
11+
py37_np17:
1212
ENV_FILE: ci/deps/azure-windows-37.yaml
1313
CONDA_PY: "37"
1414
PATTERN: "not slow and not network"

ci/code_checks.sh

-30
Original file line numberDiff line numberDiff line change
@@ -64,27 +64,6 @@ fi
6464
### PATTERNS ###
6565
if [[ -z "$CHECK" || "$CHECK" == "patterns" ]]; then
6666

67-
MSG='Check for use of exec' ; echo $MSG
68-
invgrep -R --include="*.py*" -E "[^a-zA-Z0-9_]exec\(" pandas
69-
RET=$(($RET + $?)) ; echo $MSG "DONE"
70-
71-
MSG='Check for pytest warns' ; echo $MSG
72-
invgrep -r -E --include '*.py' 'pytest\.warns' pandas/tests/
73-
RET=$(($RET + $?)) ; echo $MSG "DONE"
74-
75-
MSG='Check for pytest raises without context' ; echo $MSG
76-
invgrep -r -E --include '*.py' "[[:space:]] pytest.raises" pandas/tests/
77-
RET=$(($RET + $?)) ; echo $MSG "DONE"
78-
79-
MSG='Check for use of builtin filter function' ; echo $MSG
80-
invgrep -R --include="*.py" -P '(?<!def)[\(\s]filter\(' pandas
81-
RET=$(($RET + $?)) ; echo $MSG "DONE"
82-
83-
# Check for the following code in testing: `np.testing` and `np.array_equal`
84-
MSG='Check for invalid testing' ; echo $MSG
85-
invgrep -r -E --include '*.py' --exclude testing.py '(numpy|np)(\.testing|\.array_equal)' pandas/tests/
86-
RET=$(($RET + $?)) ; echo $MSG "DONE"
87-
8867
# Check for the following code in the extension array base tests: `tm.assert_frame_equal` and `tm.assert_series_equal`
8968
MSG='Check for invalid EA testing' ; echo $MSG
9069
invgrep -r -E --include '*.py' --exclude base.py 'tm.assert_(series|frame)_equal' pandas/tests/extension/base
@@ -98,15 +77,6 @@ if [[ -z "$CHECK" || "$CHECK" == "patterns" ]]; then
9877
invgrep -R --include="*.rst" -E "[a-zA-Z0-9]\`\`?[a-zA-Z0-9]" doc/source/
9978
RET=$(($RET + $?)) ; echo $MSG "DONE"
10079

101-
# Check for the following code in testing: `unittest.mock`, `mock.Mock()` or `mock.patch`
102-
MSG='Check that unittest.mock is not used (pytest builtin monkeypatch fixture should be used instead)' ; echo $MSG
103-
invgrep -r -E --include '*.py' '(unittest(\.| import )mock|mock\.Mock\(\)|mock\.patch)' pandas/tests/
104-
RET=$(($RET + $?)) ; echo $MSG "DONE"
105-
106-
MSG='Check for use of {foo!r} instead of {repr(foo)}' ; echo $MSG
107-
invgrep -R --include=*.{py,pyx} '!r}' pandas
108-
RET=$(($RET + $?)) ; echo $MSG "DONE"
109-
echo $MSG "DONE"
11080
fi
11181

11282
### CODE ###

ci/deps/actions-37-minimum_versions.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ dependencies:
1818
- jinja2=2.10
1919
- numba=0.46.0
2020
- numexpr=2.6.8
21-
- numpy=1.16.5
21+
- numpy=1.17.3
2222
- openpyxl=3.0.0
2323
- pytables=3.5.1
2424
- python-dateutil=2.7.3

ci/deps/azure-macos-37.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ dependencies:
1919
- matplotlib=2.2.3
2020
- nomkl
2121
- numexpr
22-
- numpy=1.16.5
22+
- numpy=1.17.3
2323
- openpyxl
2424
- pyarrow=0.15.1
2525
- pytables

ci/deps/azure-windows-37.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ dependencies:
2424
- moto>=1.3.14
2525
- flask
2626
- numexpr
27-
- numpy=1.16.*
27+
- numpy=1.17.*
2828
- openpyxl
2929
- pyarrow=0.15
3030
- pytables

doc/_templates/sidebar-nav-bs.html

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<nav class="bd-links" id="bd-docs-nav" aria-label="Main navigation">
2+
<div class="bd-toc-item active">
3+
{% if pagename.startswith("reference") %}
4+
{{ generate_nav_html("sidebar", maxdepth=4, collapse=True, includehidden=True, titles_only=True) }}
5+
{% else %}
6+
{{ generate_nav_html("sidebar", maxdepth=4, collapse=False, includehidden=True, titles_only=True) }}
7+
{% endif %}
8+
</div>
9+
</nav>
7.14 KB
Loading
7.33 KB
Loading
7.59 KB
Loading
7.1 KB
Loading

0 commit comments

Comments
 (0)