Skip to content

Commit 2a81ea1

Browse files
committed
Merge branch 'master' into range_builtin
2 parents 0228ab7 + c29facc commit 2a81ea1

Some content is hidden

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

70 files changed

+949
-787
lines changed

.pre-commit-config.yaml

Lines changed: 122 additions & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,38 @@
11
minimum_pre_commit_version: 2.9.2
22
exclude: ^LICENSES/|\.(html|csv|svg)$
33
repos:
4+
- repo: https://github.com/MarcoGorelli/absolufy-imports
5+
rev: v0.2.1
6+
hooks:
7+
- id: absolufy-imports
8+
files: ^pandas/
49
- repo: https://github.com/python/black
510
rev: 20.8b1
611
hooks:
712
- id: black
13+
- repo: https://github.com/codespell-project/codespell
14+
rev: v2.0.0
15+
hooks:
16+
- id: codespell
17+
types_or: [python, rst, markdown]
18+
files: ^(pandas|doc)/
19+
exclude: ^pandas/tests/
20+
- repo: https://github.com/pre-commit/pre-commit-hooks
21+
rev: v3.4.0
22+
hooks:
23+
- id: end-of-file-fixer
24+
exclude: \.txt$
25+
- id: trailing-whitespace
26+
- repo: https://github.com/cpplint/cpplint
27+
rev: f7061b1 # the latest tag does not have the hook
28+
hooks:
29+
- id: cpplint
30+
# We don't lint all C files because we don't want to lint any that are built
31+
# from Cython files nor do we want to lint C files that we didn't modify for
32+
# this particular codebase (e.g. src/headers, src/klib). However,
33+
# we can lint all header files since they aren't "generated" like C files are.
34+
exclude: ^pandas/_libs/src/(klib|headers)/
35+
args: [--quiet, '--extensions=c,h', '--headers=h', --recursive, '--filter=-readability/casting,-runtime/int,-build/include_subdir']
836
- repo: https://gitlab.com/pycqa/flake8
937
rev: 3.8.4
1038
hooks:
@@ -23,6 +51,10 @@ repos:
2351
rev: 5.7.0
2452
hooks:
2553
- id: isort
54+
- repo: https://github.com/MarcoGorelli/no-string-hints
55+
rev: v0.1.7
56+
hooks:
57+
- id: no-string-hints
2658
- repo: https://github.com/asottile/pyupgrade
2759
rev: v2.10.0
2860
hooks:
@@ -38,16 +70,12 @@ repos:
3870
- id: rst-inline-touching-normal
3971
types: [text] # overwrite types: [rst]
4072
types_or: [python, rst]
73+
- repo: https://github.com/asottile/yesqa
74+
rev: v1.2.2
75+
hooks:
76+
- id: yesqa
4177
- repo: local
4278
hooks:
43-
- id: pip_to_conda
44-
name: Generate pip dependency from conda
45-
description: This hook checks if the conda environment.yml and requirements-dev.txt are equal
46-
language: python
47-
entry: python scripts/generate_pip_deps_from_conda.py
48-
files: ^(environment.yml|requirements-dev.txt)$
49-
pass_filenames: false
50-
additional_dependencies: [pyyaml]
5179
- id: flake8-rst
5280
name: flake8-rst
5381
description: Run flake8 on code snippets in docstrings or RST files
@@ -56,6 +84,40 @@ repos:
5684
types: [rst]
5785
args: [--filename=*.rst]
5886
additional_dependencies: [flake8-rst==0.7.0, flake8==3.7.9]
87+
- id: frame-or-series-union
88+
name: Check for use of Union[Series, DataFrame] instead of FrameOrSeriesUnion alias
89+
entry: Union\[.*(Series,.*DataFrame|DataFrame,.*Series).*\]
90+
language: pygrep
91+
types: [python]
92+
exclude: ^pandas/_typing\.py$
93+
- id: inconsistent-namespace-usage
94+
name: 'Check for inconsistent use of pandas namespace in tests'
95+
entry: python scripts/check_for_inconsistent_pandas_namespace.py
96+
language: python
97+
types: [python]
98+
files: ^pandas/tests/frame/
99+
- id: incorrect-code-directives
100+
name: Check for incorrect code block or IPython directives
101+
language: pygrep
102+
entry: (\.\. code-block ::|\.\. ipython ::)
103+
types_or: [python, cython, rst]
104+
- id: no-os-remove
105+
name: Check code for instances of os.remove
106+
entry: os\.remove
107+
language: pygrep
108+
types: [python]
109+
files: ^pandas/tests/
110+
exclude: |
111+
(?x)^
112+
pandas/tests/io/excel/test_writers\.py
113+
|pandas/tests/io/pytables/common\.py
114+
|pandas/tests/io/pytables/test_store\.py$
115+
- id: no-pandas-api-types
116+
name: Check code for instances of pd.api.types
117+
entry: (pd|pandas)\.api\.types\.
118+
language: pygrep
119+
types: [python]
120+
files: ^pandas/tests/
59121
- id: non-standard-imports
60122
name: Check for non-standard imports
61123
language: pygrep
@@ -67,17 +129,6 @@ repos:
67129
68130
# Check for imports from collections.abc instead of `from collections import abc`
69131
|from\ collections\.abc\ import
70-
71-
- id: non-standard-numpy.random-related-imports
72-
name: Check for non-standard numpy.random-related imports excluding pandas/_testing.py
73-
language: pygrep
74-
exclude: pandas/_testing.py
75-
entry: |
76-
(?x)
77-
# Check for imports from np.random.<method> instead of `from numpy import random` or `from numpy.random import <method>`
78-
from\ numpy\ import\ random
79-
|from\ numpy.random\ import
80-
types: [python]
81132
- id: non-standard-imports-in-tests
82133
name: Check for non-standard imports in test suite
83134
language: pygrep
@@ -95,62 +146,79 @@ repos:
95146
|pd\.testing\.
96147
types: [python]
97148
files: ^pandas/tests/
98-
- id: incorrect-code-directives
99-
name: Check for incorrect code block or IPython directives
149+
- id: non-standard-numpy-random-related-imports
150+
name: Check for non-standard numpy.random-related imports excluding pandas/_testing.py
151+
language: pygrep
152+
exclude: pandas/_testing.py
153+
entry: |
154+
(?x)
155+
# Check for imports from np.random.<method> instead of `from numpy import random` or `from numpy.random import <method>`
156+
from\ numpy\ import\ random
157+
|from\ numpy.random\ import
158+
types: [python]
159+
- id: np-bool
160+
name: Check for use of np.bool instead of np.bool_
161+
entry: np\.bool[^_8]
100162
language: pygrep
101-
entry: (\.\. code-block ::|\.\. ipython ::)
102163
types_or: [python, cython, rst]
103-
- id: unwanted-patterns-strings-to-concatenate
104-
name: Check for use of not concatenated strings
164+
- id: np-object
165+
name: Check for use of np.object instead of np.object_
166+
entry: np\.object[^_8]
167+
language: pygrep
168+
types_or: [python, cython, rst]
169+
- id: pip-to-conda
170+
name: Generate pip dependency from conda
171+
description: This hook checks if the conda environment.yml and requirements-dev.txt are equal
105172
language: python
106-
entry: python scripts/validate_unwanted_patterns.py --validation-type="strings_to_concatenate"
107-
types_or: [python, cython]
108-
- id: unwanted-patterns-strings-with-wrong-placed-whitespace
109-
name: Check for strings with wrong placed spaces
173+
entry: python scripts/generate_pip_deps_from_conda.py
174+
files: ^(environment.yml|requirements-dev.txt)$
175+
pass_filenames: false
176+
additional_dependencies: [pyyaml]
177+
- id: title-capitalization
178+
name: Validate correct capitalization among titles in documentation
179+
entry: python scripts/validate_rst_title_capitalization.py
110180
language: python
111-
entry: python scripts/validate_unwanted_patterns.py --validation-type="strings_with_wrong_placed_whitespace"
181+
types: [rst]
182+
files: ^doc/source/(development|reference)/
183+
- id: type-not-class
184+
name: Check for use of foo.__class__ instead of type(foo)
185+
entry: \.__class__
186+
language: pygrep
112187
types_or: [python, cython]
113-
- id: unwanted-patterns-private-import-across-module
114-
name: Check for import of private attributes across modules
188+
- id: unwanted-patterns-bare-pytest-raises
189+
name: Check for use of bare pytest raises
115190
language: python
116-
entry: python scripts/validate_unwanted_patterns.py --validation-type="private_import_across_module"
191+
entry: python scripts/validate_unwanted_patterns.py --validation-type="bare_pytest_raises"
117192
types: [python]
118-
exclude: ^(asv_bench|pandas/tests|doc)/
193+
files: ^pandas/tests/
194+
exclude: ^pandas/tests/extension/
119195
- id: unwanted-patterns-private-function-across-module
120196
name: Check for use of private functions across modules
121197
language: python
122198
entry: python scripts/validate_unwanted_patterns.py --validation-type="private_function_across_module"
123199
types: [python]
124200
exclude: ^(asv_bench|pandas/tests|doc)/
125-
- id: unwanted-patterns-bare-pytest-raises
126-
name: Check for use of bare pytest raises
201+
- id: unwanted-patterns-private-import-across-module
202+
name: Check for import of private attributes across modules
127203
language: python
128-
entry: python scripts/validate_unwanted_patterns.py --validation-type="bare_pytest_raises"
204+
entry: python scripts/validate_unwanted_patterns.py --validation-type="private_import_across_module"
129205
types: [python]
130-
files: ^pandas/tests/
131-
exclude: ^pandas/tests/extension/
132-
- id: unwanted-patters-pytest-xfail
206+
exclude: ^(asv_bench|pandas/tests|doc)/
207+
- id: unwanted-patterns-pytest-xfail
133208
name: Check for use of pytest.xfail
134209
entry: pytest\.xfail
135210
language: pygrep
136211
types: [python]
137212
files: ^pandas/tests/
138-
- id: inconsistent-namespace-usage
139-
name: 'Check for inconsistent use of pandas namespace in tests'
140-
entry: python scripts/check_for_inconsistent_pandas_namespace.py
213+
- id: unwanted-patterns-strings-to-concatenate
214+
name: Check for use of not concatenated strings
141215
language: python
142-
types: [python]
143-
files: ^pandas/tests/frame/
144-
- id: FrameOrSeriesUnion
145-
name: Check for use of Union[Series, DataFrame] instead of FrameOrSeriesUnion alias
146-
entry: Union\[.*(Series,.*DataFrame|DataFrame,.*Series).*\]
147-
language: pygrep
148-
types: [python]
149-
exclude: ^pandas/_typing\.py$
150-
- id: type-not-class
151-
name: Check for use of foo.__class__ instead of type(foo)
152-
entry: \.__class__
153-
language: pygrep
216+
entry: python scripts/validate_unwanted_patterns.py --validation-type="strings_to_concatenate"
217+
types_or: [python, cython]
218+
- id: unwanted-patterns-strings-with-wrong-placed-whitespace
219+
name: Check for strings with wrong placed spaces
220+
language: python
221+
entry: python scripts/validate_unwanted_patterns.py --validation-type="strings_with_wrong_placed_whitespace"
154222
types_or: [python, cython]
155223
- id: unwanted-typing
156224
name: Check for outdated annotation syntax and missing error codes
@@ -160,62 +228,3 @@ repos:
160228
|\#\ type:\s?ignore(?!\[)
161229
language: pygrep
162230
types: [python]
163-
- id: np-bool
164-
name: Check for use of np.bool instead of np.bool_
165-
entry: np\.bool[^_8]
166-
language: pygrep
167-
types_or: [python, cython, rst]
168-
- id: np-object
169-
name: Check for use of np.object instead of np.object_
170-
entry: np\.object[^_8]
171-
language: pygrep
172-
types_or: [python, cython, rst]
173-
- id: no-os-remove
174-
name: Check code for instances of os.remove
175-
entry: os\.remove
176-
language: pygrep
177-
types: [python]
178-
files: ^pandas/tests/
179-
exclude: |
180-
(?x)^
181-
pandas/tests/io/excel/test_writers\.py
182-
|pandas/tests/io/pytables/common\.py
183-
|pandas/tests/io/pytables/test_store\.py$
184-
- id: no-pandas-api-types
185-
name: Check code for instances of pd.api.types
186-
entry: (pd|pandas)\.api\.types\.
187-
language: pygrep
188-
types: [python]
189-
files: ^pandas/tests/
190-
- id: title-capitalization
191-
name: Validate correct capitalization among titles in documentation
192-
entry: python scripts/validate_rst_title_capitalization.py
193-
language: python
194-
types: [rst]
195-
files: ^doc/source/(development|reference)/
196-
- repo: https://github.com/asottile/yesqa
197-
rev: v1.2.2
198-
hooks:
199-
- id: yesqa
200-
- repo: https://github.com/pre-commit/pre-commit-hooks
201-
rev: v3.4.0
202-
hooks:
203-
- id: end-of-file-fixer
204-
exclude: \.txt$
205-
- id: trailing-whitespace
206-
- repo: https://github.com/codespell-project/codespell
207-
rev: v2.0.0
208-
hooks:
209-
- id: codespell
210-
types_or: [python, rst, markdown]
211-
files: ^pandas/
212-
exclude: ^pandas/tests/
213-
- repo: https://github.com/MarcoGorelli/no-string-hints
214-
rev: v0.1.7
215-
hooks:
216-
- id: no-string-hints
217-
- repo: https://github.com/MarcoGorelli/absolufy-imports
218-
rev: v0.2.1
219-
hooks:
220-
- id: absolufy-imports
221-
files: ^pandas/

ci/code_checks.sh

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,6 @@ if [[ -z "$CHECK" || "$CHECK" == "lint" ]]; then
5959
# runtime/int: Warnings about using C number types instead of C++ ones
6060
# build/include_subdir: Warnings about prefacing included header files with directory
6161

62-
# We don't lint all C files because we don't want to lint any that are built
63-
# from Cython files nor do we want to lint C files that we didn't modify for
64-
# this particular codebase (e.g. src/headers, src/klib). However,
65-
# we can lint all header files since they aren't "generated" like C files are.
66-
MSG='Linting .c and .h' ; echo $MSG
67-
cpplint --quiet --extensions=c,h --headers=h --recursive --filter=-readability/casting,-runtime/int,-build/include_subdir pandas/_libs/src/*.h pandas/_libs/src/parser pandas/_libs/src/ujson pandas/_libs/tslibs/src/datetime pandas/_libs/*.cpp
68-
RET=$(($RET + $?)) ; echo $MSG "DONE"
69-
7062
fi
7163

7264
### PATTERNS ###

doc/source/development/contributing.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -714,7 +714,7 @@ to run its checks with::
714714

715715
without needing to have done ``pre-commit install`` beforehand.
716716

717-
If you want to run checks on all recently commited files on upstream/master you can use::
717+
If you want to run checks on all recently committed files on upstream/master you can use::
718718

719719
pre-commit run --from-ref=upstream/master --to-ref=HEAD --all-files
720720

doc/source/development/debugging_extensions.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ Now go ahead and execute your script:
6161
6262
run <the_script>.py
6363
64-
Code execution will halt at the breakpoint defined or at the occurance of any segfault. LLDB's `GDB to LLDB command map <https://lldb.llvm.org/use/map.html>`_ provides a listing of debugger command that you can execute using either debugger.
64+
Code execution will halt at the breakpoint defined or at the occurrence of any segfault. LLDB's `GDB to LLDB command map <https://lldb.llvm.org/use/map.html>`_ provides a listing of debugger command that you can execute using either debugger.
6565

6666
Another option to execute the entire test suite under lldb would be to run the following:
6767

doc/source/getting_started/comparison/comparison_with_spreadsheets.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,4 +461,4 @@ pandas' :meth:`~DataFrame.replace` is comparable to Excel's ``Replace All``.
461461

462462
.. ipython:: python
463463
464-
tips.replace("Thur", "Thu")
464+
tips.replace("Thu", "Thursday")

doc/source/getting_started/comparison/comparison_with_sql.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ to your grouped DataFrame, indicating which functions to apply to specific colum
193193
Fri 2.734737 19
194194
Sat 2.993103 87
195195
Sun 3.255132 76
196-
Thur 2.771452 62
196+
Thu 2.771452 62
197197
*/
198198
199199
.. ipython:: python
@@ -213,11 +213,11 @@ Grouping by more than one column is done by passing a list of columns to the
213213
No Fri 4 2.812500
214214
Sat 45 3.102889
215215
Sun 57 3.167895
216-
Thur 45 2.673778
216+
Thu 45 2.673778
217217
Yes Fri 15 2.714000
218218
Sat 42 2.875476
219219
Sun 19 3.516842
220-
Thur 17 3.030000
220+
Thu 17 3.030000
221221
*/
222222
223223
.. ipython:: python

0 commit comments

Comments
 (0)