Skip to content

Use ruff to enforce import alias #57282

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 3 commits into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
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
13 changes: 6 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ repos:
files: ^pandas
exclude: ^pandas/tests
args: [--select, "ANN001,ANN2", --fix-only, --exit-non-zero-on-fix]
- id: ruff
name: ruff-use-pd_array-in-core
alias: ruff-use-pd_array-in-core
files: ^pandas/core/
exclude: ^pandas/core/api\.py$
args: [--select, "ICN001", --exit-non-zero-on-fix]
- id: ruff-format
exclude: ^scripts
- repo: https://github.com/jendrikseipp/vulture
Expand Down Expand Up @@ -272,13 +278,6 @@ repos:
language: python
entry: python scripts/validate_unwanted_patterns.py --validation-type="nodefault_used_not_only_for_typing"
types: [python]
- id: use-pd_array-in-core
name: Import pandas.array as pd_array in core
language: python
entry: python scripts/use_pd_array_in_core.py
files: ^pandas/core/
exclude: ^pandas/core/api\.py$
types: [python]
- id: no-return-exception
name: Use raise instead of return for exceptions
language: pygrep
Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,9 @@ exclude = [



[tool.ruff.lint.flake8-import-conventions.aliases]
"pandas.core.construction.array" = "pd_array"

[tool.ruff.per-file-ignores]
# relative imports allowed for asv_bench
"asv_bench/*" = ["TID", "NPY002"]
Expand Down
26 changes: 0 additions & 26 deletions scripts/tests/test_use_pd_array_in_core.py

This file was deleted.

80 changes: 0 additions & 80 deletions scripts/use_pd_array_in_core.py

This file was deleted.