Skip to content

Commit

Permalink
chore: modernize ruff settings (#200)
Browse files Browse the repository at this point in the history
Close #199.

Signed-off-by: Henry Schreiner <[email protected]>
Co-authored-by: Hans Dembinski <[email protected]>
  • Loading branch information
henryiii and HDembinski authored Oct 9, 2024
1 parent be3d5c1 commit 53de916
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 21 deletions.
15 changes: 5 additions & 10 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ files: 'resample'

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: check-case-conflict
- id: check-docstring-first
Expand All @@ -18,20 +18,15 @@ repos:

# Ruff linter, replacement for flake8, isort, pydocstyle
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: 'v0.4.5'
rev: 'v0.6.9'
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]

# Python formatting
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 24.4.2
hooks:
- id: black
args: [--fix, --show-fixes, --exit-non-zero-on-fix]
- id: ruff-format

# Python type checking
- repo: https://github.com/pre-commit/mirrors-mypy
rev: 'v1.10.0'
rev: 'v1.11.2'
hooks:
- id: mypy
args: [--allow-redefinition, --ignore-missing-imports]
14 changes: 4 additions & 10 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,24 +46,18 @@ where = ["src"]

[tool.setuptools_scm]

[tool.isort]
profile = "black"
multi_line_output = 3
[tool.ruff.lint]
extend-select = ["D", "I"]
ignore = ["D212", "D211", "D203"]

[tool.ruff]
extend-select = ["E", "F", "W", "D"]
ignore = ["D212", "D203"]
unfixable = ["ERA"]

[tool.ruff.per-file-ignores]
[tool.ruff.lint.per-file-ignores]
"test_*.py" = ["D"]

[tool.mypy]
strict = true
no_implicit_optional = false
allow_redefinition = true
ignore_missing_imports = true
show_error_codes = true
files = "src/resample/*.py"

[tool.pytest.ini_options]
Expand Down
2 changes: 1 addition & 1 deletion src/resample/_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


def normalize_rng(
random_state: Optional[Union[int, np.random.Generator]]
random_state: Optional[Union[int, np.random.Generator]],
) -> np.random.Generator:
"""Return normalized RNG object."""
if random_state is None:
Expand Down

0 comments on commit 53de916

Please sign in to comment.