Skip to content

STYLE no no-string-hints, combine some hooks #40516

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 1 commit into from
Mar 19, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 12 additions & 26 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,6 @@ repos:
rev: 5.7.0
hooks:
- id: isort
- repo: https://github.com/MarcoGorelli/no-string-hints
rev: v0.1.7
hooks:
- id: no-string-hints
- repo: https://github.com/asottile/pyupgrade
rev: v2.10.0
hooks:
Expand Down Expand Up @@ -111,12 +107,6 @@ repos:
pandas/tests/io/excel/test_writers\.py
|pandas/tests/io/pytables/common\.py
|pandas/tests/io/pytables/test_store\.py$
- id: no-pandas-api-types
name: Check code for instances of pd.api.types
entry: (pd|pandas)\.api\.types\.
language: pygrep
types: [python]
files: ^pandas/tests/
- id: non-standard-imports
name: Check for non-standard imports
language: pygrep
Expand All @@ -128,6 +118,11 @@ repos:

# Check for imports from collections.abc instead of `from collections import abc`
|from\ collections\.abc\ import

# Numpy
|from\ numpy\ import\ random
|from\ numpy\.random\ import
types: [python]
- id: non-standard-imports-in-tests
name: Check for non-standard imports in test suite
language: pygrep
Expand All @@ -143,26 +138,17 @@ repos:

# Check for use of pandas.testing instead of tm
|pd\.testing\.

# Check for pd.api.types instead of from pandas.api.types import ...
|(pd|pandas)\.api\.types\.
types: [python]
files: ^pandas/tests/
- id: non-standard-numpy-random-related-imports
name: Check for non-standard numpy.random-related imports excluding pandas/_testing.py
language: pygrep
exclude: pandas/_testing.py
- id: np-bool-and-np-object
name: Check for use of np.bool/np.object instead of np.bool_/np.object_
entry: |
(?x)
# 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]
- id: np-bool
name: Check for use of np.bool instead of np.bool_
entry: np\.bool[^_8]
language: pygrep
types_or: [python, cython, rst]
- id: np-object
name: Check for use of np.object instead of np.object_
entry: np\.object[^_8]
np\.bool[^_8]
|np\.object[^_8]
language: pygrep
types_or: [python, cython, rst]
- id: pip-to-conda
Expand Down