Skip to content

Commit 2ce4fba

Browse files
tqa236mroeschke
andauthored
Use ruff to enforce import alias (#57282)
* Use ruff to enforce import alias * Remove old hook --------- Co-authored-by: Matthew Roeschke <[email protected]>
1 parent e358d3c commit 2ce4fba

File tree

4 files changed

+9
-113
lines changed

4 files changed

+9
-113
lines changed

.pre-commit-config.yaml

Lines changed: 6 additions & 7 deletions
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

Lines changed: 3 additions & 0 deletions
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

Lines changed: 0 additions & 26 deletions
This file was deleted.

scripts/use_pd_array_in_core.py

Lines changed: 0 additions & 80 deletions
This file was deleted.

0 commit comments

Comments
 (0)