-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
STYLE: use types_or in pre-commit #38457
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
@@ -1,3 +1,4 @@ | ||||||||||
minimum_pre_commit_version: '2.9.0' | ||||||||||
repos: | ||||||||||
- repo: https://github.com/python/black | ||||||||||
rev: 20.8b1 | ||||||||||
|
@@ -24,7 +25,7 @@ repos: | |||||||||
name: isort (python) | ||||||||||
- id: isort | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The two
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you @MarcoGorelli for the explanation. |
||||||||||
name: isort (cython) | ||||||||||
types: [cython] | ||||||||||
types_or: [python, cython] | ||||||||||
- repo: https://github.com/asottile/pyupgrade | ||||||||||
rev: v2.7.4 | ||||||||||
hooks: | ||||||||||
|
@@ -35,25 +36,25 @@ repos: | |||||||||
hooks: | ||||||||||
- id: rst-backticks | ||||||||||
- id: rst-directive-colons | ||||||||||
types: [text] | ||||||||||
types_or: [text] | ||||||||||
rkc007 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||
- id: rst-inline-touching-normal | ||||||||||
types: [text] | ||||||||||
types_or: [text] | ||||||||||
rkc007 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||
- repo: local | ||||||||||
hooks: | ||||||||||
- id: pip_to_conda | ||||||||||
name: Generate pip dependency from conda | ||||||||||
description: This hook checks if the conda environment.yml and requirements-dev.txt are equal | ||||||||||
language: python | ||||||||||
entry: python scripts/generate_pip_deps_from_conda.py | ||||||||||
files: ^(environment.yml|requirements-dev.txt)$ | ||||||||||
types_or: [file, non-executable, plain-text, text, yaml] | ||||||||||
rkc007 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||
pass_filenames: false | ||||||||||
additional_dependencies: [pyyaml] | ||||||||||
- id: flake8-rst | ||||||||||
name: flake8-rst | ||||||||||
description: Run flake8 on code snippets in docstrings or RST files | ||||||||||
language: python | ||||||||||
entry: flake8-rst | ||||||||||
types: [rst] | ||||||||||
types_or: [rst] | ||||||||||
rkc007 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||
args: [--filename=*.rst] | ||||||||||
additional_dependencies: [flake8-rst==0.7.0, flake8==3.7.9] | ||||||||||
- id: non-standard-imports | ||||||||||
|
@@ -77,7 +78,7 @@ repos: | |||||||||
# Check for imports from np.random.<method> instead of `from numpy import random` or `from numpy.random import <method>` | ||||||||||
from\ numpy\ import\ random| | ||||||||||
from\ numpy.random\ import | ||||||||||
types: [python] | ||||||||||
types_or: [python] | ||||||||||
rkc007 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||
- id: non-standard-imports-in-tests | ||||||||||
name: Check for non-standard imports in test suite | ||||||||||
language: pygrep | ||||||||||
|
@@ -90,46 +91,45 @@ repos: | |||||||||
# No direct imports from conftest | ||||||||||
conftest\ import| | ||||||||||
import\ conftest | ||||||||||
types: [python] | ||||||||||
files: ^pandas/tests/ | ||||||||||
types_or: [python] | ||||||||||
rkc007 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||
- id: incorrect-code-directives | ||||||||||
name: Check for incorrect code block or IPython directives | ||||||||||
language: pygrep | ||||||||||
entry: (\.\. code-block ::|\.\. ipython ::) | ||||||||||
files: \.(py|pyx|rst)$ | ||||||||||
types_or: [file, non-executable, cython, text, yaml, python, rst] | ||||||||||
rkc007 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||
- id: unwanted-patterns-strings-to-concatenate | ||||||||||
name: Check for use of not concatenated strings | ||||||||||
language: python | ||||||||||
entry: python scripts/validate_unwanted_patterns.py --validation-type="strings_to_concatenate" | ||||||||||
files: \.(py|pyx|pxd|pxi)$ | ||||||||||
types_or: [file, non-executable, cython, text, yaml, python] | ||||||||||
- id: unwanted-patterns-strings-with-wrong-placed-whitespace | ||||||||||
name: Check for strings with wrong placed spaces | ||||||||||
language: python | ||||||||||
entry: python scripts/validate_unwanted_patterns.py --validation-type="strings_with_wrong_placed_whitespace" | ||||||||||
files: \.(py|pyx|pxd|pxi)$ | ||||||||||
types_or: [file, non-executable, cython, text, yaml, python] | ||||||||||
- id: unwanted-patterns-private-import-across-module | ||||||||||
name: Check for import of private attributes across modules | ||||||||||
language: python | ||||||||||
entry: python scripts/validate_unwanted_patterns.py --validation-type="private_import_across_module" | ||||||||||
types: [python] | ||||||||||
types_or: [python] | ||||||||||
rkc007 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||
exclude: ^(asv_bench|pandas/tests|doc)/ | ||||||||||
- id: unwanted-patterns-private-function-across-module | ||||||||||
name: Check for use of private functions across modules | ||||||||||
language: python | ||||||||||
entry: python scripts/validate_unwanted_patterns.py --validation-type="private_function_across_module" | ||||||||||
types: [python] | ||||||||||
types_or: [python] | ||||||||||
exclude: ^(asv_bench|pandas/tests|doc)/ | ||||||||||
- id: inconsistent-namespace-usage | ||||||||||
name: 'Check for inconsistent use of pandas namespace in tests' | ||||||||||
entry: python scripts/check_for_inconsistent_pandas_namespace.py | ||||||||||
language: python | ||||||||||
types: [python] | ||||||||||
types_or: [python] | ||||||||||
files: ^pandas/tests/ | ||||||||||
- id: FrameOrSeriesUnion | ||||||||||
name: Check for use of Union[Series, DataFrame] instead of FrameOrSeriesUnion alias | ||||||||||
entry: Union\[.*(Series.*DataFrame|DataFrame.*Series).*\] | ||||||||||
language: pygrep | ||||||||||
types: [python] | ||||||||||
types_or: [python] | ||||||||||
exclude: ^pandas/_typing\.py$ | ||||||||||
- id: type-not-class | ||||||||||
name: Check for use of foo.__class__ instead of type(foo) | ||||||||||
|
@@ -143,12 +143,12 @@ repos: | |||||||||
\#\ type:\ (?!ignore)| | ||||||||||
\#\ type:\s?ignore(?!\[) | ||||||||||
language: pygrep | ||||||||||
types: [python] | ||||||||||
types_or: [python] | ||||||||||
- id: no-os-remove | ||||||||||
name: Check code for instances of os.remove | ||||||||||
entry: os\.remove | ||||||||||
language: pygrep | ||||||||||
types: [python] | ||||||||||
types_or: [python] | ||||||||||
files: ^pandas/tests/ | ||||||||||
exclude: | | ||||||||||
(?x)^ | ||||||||||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's make this
2.9.2
, as the release note mentionsThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed!