From 68e615fdaf39204cad4e0e8f7612337b941dfcff Mon Sep 17 00:00:00 2001 From: James Gaboardi Date: Tue, 2 Jul 2024 12:57:06 -0400 Subject: [PATCH 1/2] use ruff for formatting --- .pre-commit-config.yaml | 9 ++------- giddy/directional.py | 2 +- pyproject.toml | 16 ++++------------ 3 files changed, 7 insertions(+), 20 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0a1eae2..c5a1f31 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,14 +1,9 @@ files: "giddy\/" -repos: - - repo: https://github.com/psf/black - rev: "24.3.0" - hooks: - - id: black - language_version: python3 - repo: https://github.com/astral-sh/ruff-pre-commit - rev: "v0.3.5" + rev: "v0.5.0" hooks: - id: ruff + - id: ruff-format ci: autofix_prs: false diff --git a/giddy/directional.py b/giddy/directional.py index ac34557..522a573 100644 --- a/giddy/directional.py +++ b/giddy/directional.py @@ -298,7 +298,7 @@ def permute(self, permutations=99, alternative="two.sided"): P = NEG * L + (1 - NEG) * S self.p = P else: - print("Bad option for alternative: %s." % alternative) + print(f"Bad option for alternative: {alternative}") def _calc(self, Y, w, k): wY = weights.lag_spatial(w, Y) diff --git a/pyproject.toml b/pyproject.toml index 0c126a9..841ed35 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -38,7 +38,6 @@ Repository = "https://github.com/pysal/giddy" [project.optional-dependencies] dev = [ - "black", "ruff", "pre-commit", ] @@ -65,20 +64,12 @@ include = [ "giddy.*", ] -[tool.black] -line-length = 88 -extend-exclude = ''' -( - docs/conf.py -) -#''' - [tool.ruff] line-length = 88 -select = ["E", "F", "W", "I", "UP", "N", "B", "A", "C4", "SIM", "ARG"] -target-version = "py39" +lint.select = ["E", "F", "W", "I", "UP", "N", "B", "A", "C4", "SIM", "ARG"] exclude = ["giddy/tests/*", "docs/*"] -[tool.ruff.per-file-ignores] + +[tool.ruff.lint.per-file-ignores] "__init__.py" = [ "F401" # imported but unused ] @@ -97,6 +88,7 @@ exclude = ["giddy/tests/*", "docs/*"] "E501", # Line too long ] + [tool.coverage.run] source = ["./giddy"] From 02cb66894d9d9657367b12d07f2ec8a3d8e597c1 Mon Sep 17 00:00:00 2001 From: James Gaboardi Date: Tue, 2 Jul 2024 15:33:23 -0400 Subject: [PATCH 2/2] fix pre-commit syntax --- .pre-commit-config.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c5a1f31..1e03a8b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,4 +1,5 @@ files: "giddy\/" +repos: - repo: https://github.com/astral-sh/ruff-pre-commit rev: "v0.5.0" hooks: