Skip to content

Commit 83a16c4

Browse files
authored
Merge pull request #392 from GeospatialPython/Version_bumps
Don't run mypy in pre-commit. Bump mypy to 2.1.0, & bump ruff
2 parents c979d39 + 53c1452 commit 83a16c4

7 files changed

Lines changed: 26 additions & 15 deletions

File tree

.github/workflows/speed_test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
matrix:
2525
python-version: [
2626
"3.9",
27-
"3.13",
27+
"3.14",
2828
]
2929
os: [
3030
"windows-latest",

.pre-commit-config.yaml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
11
repos:
22
- repo: https://github.com/astral-sh/ruff-pre-commit
3-
rev: v0.12.7
3+
rev: v0.15.13
44
hooks:
55
# Run the linter
66
- id: ruff-check
77
args: [ --fix ]
88
# Run the formatter
99
- id: ruff-format
1010
- repo: https://github.com/pre-commit/pre-commit-hooks
11-
rev: v5.0.0
11+
rev: v6.0.0
1212
hooks:
1313
- id: check-yaml
1414
- id: trailing-whitespace
15-
- repo: https://github.com/pre-commit/mirrors-mypy
16-
rev: v1.17.1
17-
hooks:
18-
- id: mypy

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ part of your geospatial project.
108108

109109
### URL Downloading
110110
- Unify tempfile creation and shapefile download logic.
111-
- Check "Content-Type" header and sniff initial bytes
111+
- Check "Content-Type" header and sniff initial bytes
112112
of response in order to possibly reject html responses, before parsing as a shapefile, to give a more useful error to users.
113113
- Special case shapefiles hosted in Github repos to suggest appending the query string `?raw=true`.
114114

changelog.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ VERSION 3.0.6
1616
2026-05-19
1717
URL Downloading:
1818
* Unify tempfile creation and shapefile download logic.
19-
* Check "Content-Type" header and sniff initial bytes
19+
* Check "Content-Type" header and sniff initial bytes
2020
of response in order to possibly reject html responses, before parsing as a shapefile, to give a more useful error to users.
2121
* Special case shapefiles hosted in Github repos to suggest appending the query string `?raw=true`.
2222

pyproject.toml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ dev = [
3737
{include-group = "test"}
3838
]
3939
lint = [
40-
"mypy",
40+
"mypy>=2.1.0",
4141
"pre-commit",
4242
"ruff",
4343
]
@@ -48,6 +48,19 @@ test = [
4848
[project.urls]
4949
Repository = "https://github.com/GeospatialPython/pyshp"
5050

51+
52+
53+
[tool.mypy]
54+
files=["src/shapefile.py"]
55+
mypy_path = "src"
56+
explicit_package_bases = true
57+
exclude_gitignore = true
58+
exclude=[
59+
'test_shapefile\.py',
60+
'run_benchmarks\.py',
61+
]
62+
63+
5164
[tool.hatch.build.targets.sdist]
5265
only-include = ["src", "shapefiles", "test_shapefile.py"]
5366

run_benchmarks.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,10 @@ def benchmark(
4747
return time_taken
4848

4949

50-
fields = {}
51-
shapeRecords = collections.defaultdict(list)
50+
fields: dict[str | PathLike, list[shapefile.Field]] = {}
51+
shapeRecords: dict[str | PathLike, list[shapefile.shapeRecord]] = (
52+
collections.defaultdict(list)
53+
)
5254

5355

5456
def open_shapefile_with_PyShp(target: str | PathLike):

src/shapefile.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2044,11 +2044,11 @@ def __setattr__(self, key: str, value: RecordValue) -> None:
20442044
raise AttributeError(f"{key} is not a field name")
20452045

20462046
@overload
2047-
def __getitem__(self, i: SupportsIndex) -> RecordValue: ...
2047+
def __getitem__(self, item: SupportsIndex) -> RecordValue: ...
20482048
@overload
2049-
def __getitem__(self, s: slice) -> list[RecordValue]: ...
2049+
def __getitem__(self, item: slice) -> list[RecordValue]: ...
20502050
@overload
2051-
def __getitem__(self, s: str) -> RecordValue: ...
2051+
def __getitem__(self, item: str) -> RecordValue: ...
20522052
def __getitem__(
20532053
self, item: SupportsIndex | slice | str
20542054
) -> RecordValue | list[RecordValue]:

0 commit comments

Comments
 (0)