Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.4
rev: v0.12.7
hooks:
# Run the linter
- id: ruff-check
args: [ --fix ]
# Run the formatter
- id: ruff-format
- repo: https://github.com/pycqa/isort
rev: 5.13.2
rev: 6.0.1
hooks:
- id: isort
name: isort (python)
args: ["--profile", "black"]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0
rev: v5.0.0
hooks:
- id: check-yaml
- id: trailing-whitespace
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ dependencies = [
]

[project.optional-dependencies]
dev = ["pyshp[test]", "pre-commit", "ruff"]
test = ["pytest"]

[project.urls]
Expand Down
2 changes: 1 addition & 1 deletion run_benchmarks.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def benchmark(
time_taken = timeit.timeit(func, number=run_count)
print("\b" * len(placeholder), end="")
time_suffix = " s"
print(f"{time_taken:{col_widths[1]-len(time_suffix)}.3g}{time_suffix}", end="")
print(f"{time_taken:{col_widths[1] - len(time_suffix)}.3g}{time_suffix}", end="")
print()
return time_taken

Expand Down
4 changes: 2 additions & 2 deletions src/shapefile.py
Original file line number Diff line number Diff line change
Expand Up @@ -1896,7 +1896,7 @@ def __init__(
# Close and delete the temporary zipfile
try:
zipfileobj.close()
except: # pylint: disable=bare-except
except: # pylint: disable=bare-except # noqa: E722
pass
# Try to load shapefile
if self.shp or self.dbf:
Expand Down Expand Up @@ -3155,7 +3155,7 @@ def __shpRecord(self, s: Shape) -> tuple[int, int]:
# Shape Type
if self.shapeType is None and s.shapeType != NULL:
self.shapeType = s.shapeType
if not s.shapeType in {NULL, self.shapeType}:
if s.shapeType not in {NULL, self.shapeType}:
raise ShapefileException(
f"The shape's type ({s.shapeType}) must match "
f"the type of the shapefile ({self.shapeType})."
Expand Down
Loading