Skip to content

Commit 375e6a2

Browse files
tqa236mroeschke
authored andcommitted
Use ruff to enforce import alias (pandas-dev#57282)
* Use ruff to enforce import alias * Remove old hook --------- Co-authored-by: Matthew Roeschke <[email protected]>
1 parent e665f56 commit 375e6a2

File tree

4 files changed

+9
-113
lines changed

4 files changed

+9
-113
lines changed

.pre-commit-config.yaml

+6-7
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ repos:
3030
files: ^pandas
3131
exclude: ^pandas/tests
3232
args: [--select, "ANN001,ANN2", --fix-only, --exit-non-zero-on-fix]
33+
- id: ruff
34+
name: ruff-use-pd_array-in-core
35+
alias: ruff-use-pd_array-in-core
36+
files: ^pandas/core/
37+
exclude: ^pandas/core/api\.py$
38+
args: [--select, "ICN001", --exit-non-zero-on-fix]
3339
- id: ruff-format
3440
exclude: ^scripts
3541
- repo: https://github.com/jendrikseipp/vulture
@@ -272,13 +278,6 @@ repos:
272278
language: python
273279
entry: python scripts/validate_unwanted_patterns.py --validation-type="nodefault_used_not_only_for_typing"
274280
types: [python]
275-
- id: use-pd_array-in-core
276-
name: Import pandas.array as pd_array in core
277-
language: python
278-
entry: python scripts/use_pd_array_in_core.py
279-
files: ^pandas/core/
280-
exclude: ^pandas/core/api\.py$
281-
types: [python]
282281
- id: no-return-exception
283282
name: Use raise instead of return for exceptions
284283
language: pygrep

pyproject.toml

+3
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,9 @@ exclude = [
342342

343343

344344

345+
[tool.ruff.lint.flake8-import-conventions.aliases]
346+
"pandas.core.construction.array" = "pd_array"
347+
345348
[tool.ruff.per-file-ignores]
346349
# relative imports allowed for asv_bench
347350
"asv_bench/*" = ["TID", "NPY002"]

scripts/tests/test_use_pd_array_in_core.py

-26
This file was deleted.

scripts/use_pd_array_in_core.py

-80
This file was deleted.

0 commit comments

Comments
 (0)