Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4ff015b

Browse files
committed
Ruff reformat
1 parent 3bd25b4 commit 4ff015b

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

shapefile.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
from urllib.parse import urlparse, urlunparse
2424
from urllib.request import urlopen, Request
2525

26-
from typing import Any, Union, Iterable, ByteString
26+
from typing import Any, Union, ByteString
2727
from collections.abc import Sequence
2828

2929
# Create named logger
@@ -108,7 +108,9 @@ def b(v: Any, encoding="utf-8", encodingErrors="strict") -> bytes:
108108

109109

110110
def u(
111-
v: Union[bytes, str, None, int, ByteString], encoding="utf-8", encodingErrors="strict"
111+
v: Union[bytes, str, None, int, ByteString],
112+
encoding="utf-8",
113+
encodingErrors="strict",
112114
) -> str:
113115
if isinstance(v, bytes):
114116
# For python 3 decode bytes to str.
@@ -145,10 +147,12 @@ class _Array(array.array):
145147
def __repr__(self):
146148
return str(self.tolist())
147149

150+
148151
Point_T = Sequence[float]
149152
Coords_T = Sequence[Point_T]
150153
BBox_T = tuple[float, float, float, float]
151154

155+
152156
def signed_area(coords: Coords_T, fast: bool = False) -> float:
153157
"""Return the signed area enclosed by a ring using the linear time
154158
algorithm. A value >= 0 indicates a counter-clockwise oriented ring.
@@ -185,19 +189,15 @@ def ring_bbox(coords: Coords_T) -> BBox_T:
185189
return bbox
186190

187191

188-
def bbox_overlap(
189-
bbox1: BBox_T, bbox2: BBox_T
190-
) -> bool:
192+
def bbox_overlap(bbox1: BBox_T, bbox2: BBox_T) -> bool:
191193
"""Tests whether two bounding boxes overlap, returning a boolean"""
192194
xmin1, ymin1, xmax1, ymax1 = bbox1
193195
xmin2, ymin2, xmax2, ymax2 = bbox2
194196
overlap = xmin1 <= xmax2 and xmax1 >= xmin2 and ymin1 <= ymax2 and ymax1 >= ymin2
195197
return overlap
196198

197199

198-
def bbox_contains(
199-
bbox1: BBox_T, bbox2: BBox_T
200-
) -> bool:
200+
def bbox_contains(bbox1: BBox_T, bbox2: BBox_T) -> bool:
201201
"""Tests whether bbox1 fully contains bbox2, returning a boolean"""
202202
xmin1, ymin1, xmax1, ymax1 = bbox1
203203
xmin2, ymin2, xmax2, ymax2 = bbox2
@@ -250,9 +250,7 @@ def ring_contains_point(coords: Coords_T, p: Point_T) -> bool:
250250
return inside_flag
251251

252252

253-
def ring_sample(
254-
coords: Coords_T, ccw: bool = False
255-
) -> Point_T:
253+
def ring_sample(coords: Coords_T, ccw: bool = False) -> Point_T:
256254
"""Return a sample point guaranteed to be within a ring, by efficiently
257255
finding the first centroid of a coordinate triplet whose orientation
258256
matches the orientation of the ring and passes the point-in-ring test.

0 commit comments

Comments
 (0)