Skip to content

Commit bd0295a

Browse files
committed
Minor cleanup
1 parent d774940 commit bd0295a

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

pymunk/autogeometry.py

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""This module contain functions for automatic generation of geometry, for
1+
"""This module contain functions for automatic generation of geometry, for
22
example from an image.
33
44
Example::
@@ -23,19 +23,20 @@
2323
>>> print(len(pl_set))
2424
2
2525
26-
The information in segments can now be used to create geometry, for example as
26+
The information in segments can now be used to create geometry, for example as
2727
a Pymunk Poly or Segment::
2828
2929
>>> s = pymunk.Space()
3030
>>> for poly_line in pl_set:
3131
... for i in range(len(poly_line) - 1):
3232
... a = poly_line[i]
3333
... b = poly_line[i + 1]
34-
... segment = pymunk.Segment(s.static_body, a, b, 1)
34+
... segment = pymunk.Segment(s.static_body, a, b, 1)
3535
... s.add(segment)
3636
3737
3838
"""
39+
3940
__docformat__ = "reStructuredText"
4041

4142
from typing import TYPE_CHECKING, Callable, List, Sequence, Tuple, Union, overload
@@ -47,7 +48,6 @@
4748
from ._chipmunk_cffi import ffi, lib
4849
from .vec2d import Vec2d
4950

50-
_SegmentFunc = Callable[[Tuple[float, float], Tuple[float, float]], None]
5151
_SampleFunc = Callable[[Tuple[float, float]], float]
5252

5353
_Polyline = Union[List[Tuple[float, float]], List[Vec2d]]
@@ -201,19 +201,19 @@ def __len__(self) -> int:
201201
return self._set.count
202202

203203
@overload
204-
def __getitem__(self, index: int) -> List[Vec2d]:
205-
...
204+
def __getitem__(self, index: int) -> List[Vec2d]: ...
206205

207206
@overload
208-
def __getitem__(self, index: slice) -> "PolylineSet":
209-
...
207+
def __getitem__(self, index: slice) -> "PolylineSet": ...
210208

211-
def __getitem__(self, key: Union[int, slice]) -> Union[List[Vec2d], "PolylineSet"]:
212-
assert not isinstance(key, slice), "Slice indexing not supported"
213-
if key >= self._set.count:
209+
def __getitem__(
210+
self, index: Union[int, slice]
211+
) -> Union[List[Vec2d], "PolylineSet"]:
212+
assert not isinstance(index, slice), "Slice indexing not supported"
213+
if index >= self._set.count:
214214
raise IndexError
215215
line = []
216-
l = self._set.lines[key]
216+
l = self._set.lines[index]
217217
for i in range(l.count):
218218
line.append(Vec2d(l.verts[i].x, l.verts[i].y))
219219
return line

0 commit comments

Comments
 (0)