Skip to content

Commit a4eca2a

Browse files
committed
Fix some types
1 parent 4dbb3dd commit a4eca2a

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

staticmaps/circle.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,5 @@ def compute_circle(center: s2sphere.LatLng, radius_km: float) -> typing.Iterator
5656
first = latlng
5757
yield latlng
5858
angle = angle + delta_angle
59-
yield first
59+
if first:
60+
yield first

staticmaps/context.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,10 +189,11 @@ def object_bounds(self) -> typing.Optional[s2sphere.LatLngRect]:
189189
if len(self._objects) != 0:
190190
bounds = s2sphere.LatLngRect()
191191
for obj in self._objects:
192+
assert bounds
192193
bounds = bounds.union(obj.bounds())
193194
return self._custom_bounds(bounds)
194195

195-
def _custom_bounds(self, bounds: s2sphere.LatLngRect) -> typing.Optional[s2sphere.LatLngRect]:
196+
def _custom_bounds(self, bounds: typing.Optional[s2sphere.LatLngRect]) -> typing.Optional[s2sphere.LatLngRect]:
196197
"""check for additional bounds and return the union with object bounds
197198
198199
:param bounds: boundaries from objects
@@ -261,6 +262,7 @@ def _determine_zoom(
261262
b = s2sphere.LatLngRect(c, c)
262263
else:
263264
b = b.union(s2sphere.LatLngRect(c, c))
265+
assert b
264266
if b.is_point():
265267
return self._clamp_zoom(15)
266268

0 commit comments

Comments
 (0)