Skip to content

Commit 86d7f04

Browse files
authored
Merge pull request #365 from mwtoews/ruff-up
Enable Ruff pyupgrade (UP) rule
2 parents 3ac5b3d + 83ff549 commit 86d7f04

File tree

4 files changed

+203
-210
lines changed

4 files changed

+203
-210
lines changed

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ select = [
9494
"E9", # pycodestyle: Runtime
9595
"F", # pyflakes
9696
"I", # isort
97+
"UP", # pyupgrade
9798
]
9899
ignore = []
99100

run_benchmarks.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
import functools
77
import os
88
import timeit
9-
from collections.abc import Callable
9+
from collections.abc import Callable, Iterable
1010
from os import PathLike
1111
from pathlib import Path
1212
from tempfile import TemporaryFile as TempF
13-
from typing import Iterable, Union, cast
13+
from typing import cast
1414

1515
import shapefile
1616

@@ -51,14 +51,14 @@ def benchmark(
5151
shapeRecords = collections.defaultdict(list)
5252

5353

54-
def open_shapefile_with_PyShp(target: Union[str, PathLike]):
54+
def open_shapefile_with_PyShp(target: str | PathLike):
5555
with shapefile.Reader(target) as r:
5656
fields[target] = r.fields
5757
for shapeRecord in r.iterShapeRecords():
5858
shapeRecords[target].append(shapeRecord)
5959

6060

61-
def write_shapefile_with_PyShp(target: Union[str, PathLike]):
61+
def write_shapefile_with_PyShp(target: str | PathLike):
6262
with TempF("wb") as shp, TempF("wb") as dbf, TempF("wb") as shx:
6363
with shapefile.Writer(shp=shp, dbf=dbf, shx=shx) as w: # type: ignore [arg-type]
6464
for field_info_tuple in fields[target]:

0 commit comments

Comments
 (0)