Skip to content

Commit 2bcabb1

Browse files
committed
Upgrade pre-commit repos and add ruff-check; add "dev" optional
1 parent 6ca0674 commit 2bcabb1

File tree

4 files changed

+11
-6
lines changed

4 files changed

+11
-6
lines changed

.pre-commit-config.yaml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
repos:
22
- repo: https://github.com/astral-sh/ruff-pre-commit
3-
rev: v0.6.4
3+
rev: v0.12.7
44
hooks:
5+
# Run the linter
6+
- id: ruff-check
7+
args: [ --fix ]
8+
# Run the formatter
59
- id: ruff-format
610
- repo: https://github.com/pycqa/isort
7-
rev: 5.13.2
11+
rev: 6.0.1
812
hooks:
913
- id: isort
1014
name: isort (python)
1115
args: ["--profile", "black"]
1216
- repo: https://github.com/pre-commit/pre-commit-hooks
13-
rev: v2.3.0
17+
rev: v5.0.0
1418
hooks:
1519
- id: check-yaml
1620
- id: trailing-whitespace

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ classifiers = [
2828
]
2929

3030
[project.optional-dependencies]
31+
dev = ["pyshp[test]", "pre-commit", "ruff"]
3132
test = ["pytest"]
3233

3334
[project.urls]

run_benchmarks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def benchmark(
4141
time_taken = timeit.timeit(func, number=run_count)
4242
print("\b" * len(placeholder), end="")
4343
time_suffix = " s"
44-
print(f"{time_taken:{col_widths[1]-len(time_suffix)}.3g}{time_suffix}", end="")
44+
print(f"{time_taken:{col_widths[1] - len(time_suffix)}.3g}{time_suffix}", end="")
4545
print()
4646
return time_taken
4747

src/shapefile.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1728,7 +1728,7 @@ def __init__(
17281728
# Close and delete the temporary zipfile
17291729
try:
17301730
zipfileobj.close()
1731-
except: # pylint: disable=bare-except
1731+
except: # noqa: E722
17321732
pass
17331733
# Try to load shapefile
17341734
if self.shp or self.dbf:
@@ -2967,7 +2967,7 @@ def __shpRecord(self, s):
29672967
# Shape Type
29682968
if self.shapeType is None and s.shapeType != NULL:
29692969
self.shapeType = s.shapeType
2970-
if not s.shapeType in {NULL, self.shapeType}:
2970+
if s.shapeType not in {NULL, self.shapeType}:
29712971
raise ShapefileException(
29722972
f"The shape's type ({s.shapeType}) must match "
29732973
f"the type of the shapefile ({self.shapeType})."

0 commit comments

Comments
 (0)