Skip to content

Commit 07af50b

Browse files
authored
Merge pull request #342 from mwtoews/up-pre-commit-add-dev
Upgrade pre-commit repos and add ruff-check; add "dev" optional
2 parents b5f4bf8 + 556c7cb commit 07af50b

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
@@ -31,6 +31,7 @@ dependencies = [
3131
]
3232

3333
[project.optional-dependencies]
34+
dev = ["pyshp[test]", "pre-commit", "ruff"]
3435
test = ["pytest"]
3536

3637
[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
@@ -1896,7 +1896,7 @@ def __init__(
18961896
# Close and delete the temporary zipfile
18971897
try:
18981898
zipfileobj.close()
1899-
except: # pylint: disable=bare-except
1899+
except: # pylint: disable=bare-except # noqa: E722
19001900
pass
19011901
# Try to load shapefile
19021902
if self.shp or self.dbf:
@@ -3155,7 +3155,7 @@ def __shpRecord(self, s: Shape) -> tuple[int, int]:
31553155
# Shape Type
31563156
if self.shapeType is None and s.shapeType != NULL:
31573157
self.shapeType = s.shapeType
3158-
if not s.shapeType in {NULL, self.shapeType}:
3158+
if s.shapeType not in {NULL, self.shapeType}:
31593159
raise ShapefileException(
31603160
f"The shape's type ({s.shapeType}) must match "
31613161
f"the type of the shapefile ({self.shapeType})."

0 commit comments

Comments
 (0)