Skip to content

Commit

Permalink
final lint/format run through & update pre-commit (#661)
Browse files Browse the repository at this point in the history
* final run through & update pre-commit

* no global ignore
  • Loading branch information
jGaboardi authored Nov 22, 2023
1 parent 9e45960 commit 27c1f49
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 22 deletions.
21 changes: 15 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
repos:
- repo: https://github.com/psf/black
rev: "23.10.0"
hooks:
- id: black
language_version: python3
files: "libpysal\/"
repos:
- repo: https://github.com/psf/black
rev: "23.10.1"
hooks:
- id: black
language_version: python3
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.1.6"
hooks:
- id: ruff

ci:
autofix_prs: false
autoupdate_schedule: quarterly
4 changes: 3 additions & 1 deletion libpysal/cg/standalone.py
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,9 @@ def get_polygon_point_dist(poly, pt):
part_prox = []
for vertices in poly._vertices:
vx_range = range(-1, len(vertices) - 1)
seg = lambda i: LineSegment(vertices[i], vertices[i + 1]) # noqa: B023
seg = lambda i: LineSegment( # noqa: E731
vertices[i], vertices[i + 1] # noqa: B023
)
_min_dist = min([get_segment_point_dist(seg(i), pt)[0] for i in vx_range])
part_prox.append(_min_dist)
dist = min(part_prox)
Expand Down
4 changes: 2 additions & 2 deletions libpysal/graph/_kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,14 +254,14 @@ def _knn(coordinates, metric="euclidean", k=1, p=2, coincident="raise"):
coincident="jitter",
)

if (coincident == "clique"):
if coincident == "clique":
heads, tails, weights = _sparse_to_arrays(
_knn(
coincident_lut.geometry, metric=metric, k=k, p=p, coincident="raise"
)
)
adjtable = pandas.DataFrame.from_dict(
dict(focal=heads, neighbor=tails, weight=weights)
{"focal": heads, "neighbor": tails, "weight": weights}
)
adjtable = _induce_cliques(adjtable, coincident_lut, fill_value=-1)
adjtable = _reorder_adjtable_by_ids(adjtable, ids)
Expand Down
2 changes: 1 addition & 1 deletion libpysal/io/fileio.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def check(cls):
print(f"Ext: '.{key}', Modes: {list(val.keys())!r}")

@classmethod
def open(cls, *args, **kwargs): # noqa: A001
def open(cls, *args, **kwargs): # noqa: A001, A003
"""Alias for ``FileIO()``."""

return cls(*args, **kwargs)
Expand Down
12 changes: 0 additions & 12 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -86,18 +86,6 @@ line-length = 88
line-length = 88
select = ["E", "F", "W", "I", "UP", "N", "B", "A", "C4", "SIM", "ARG"]
target-version = "py310"
ignore = [
"B006",
"B008",
"B009",
"B010",
"C408",
"E731",
"N803",
"N806",
"N999",
"UP007"
]
exclude = ["libpysal/tests/*", "docs/*"]
[tool.ruff.per-file-ignores]
"*__init__.py" = [
Expand Down

0 comments on commit 27c1f49

Please sign in to comment.