|
1 | 1 | from geometry.shapes.shape_types.closed_shapes import ClosedShape
|
2 | 2 | from geometry.shapes.shape_types.intersecting_self_shapes import IntersectSelfShape
|
3 | 3 | from geometry.shapes.side import Side
|
| 4 | +from typing import TypeVar |
| 5 | + |
| 6 | +PolygonType = TypeVar("PolygonType", bound="Polygon") |
4 | 7 |
|
5 | 8 |
|
6 | 9 | class Polygon(ClosedShape, IntersectSelfShape):
|
@@ -43,26 +46,26 @@ class Polygon(ClosedShape, IntersectSelfShape):
|
43 | 46 |
|
44 | 47 | """
|
45 | 48 |
|
46 |
| - def __init__(self): |
| 49 | + def __init__(self) -> None: |
47 | 50 | self.sides: list[Side] = []
|
48 | 51 |
|
49 |
| - def get_side(self, index): |
| 52 | + def get_side(self, index: int) -> Side: |
50 | 53 | return self.sides[index]
|
51 | 54 |
|
52 |
| - def set_side(self, index, side): |
| 55 | + def set_side(self, index: int, side: Side) -> None: |
53 | 56 | self.sides[index] = side
|
54 | 57 |
|
55 |
| - def add_side(self, side): |
| 58 | + def add_side(self, side: Side) -> None: |
56 | 59 | self.sides.append(side)
|
57 | 60 |
|
58 |
| - def area(self): |
| 61 | + def area(self) -> float: |
59 | 62 | pass
|
60 | 63 |
|
61 |
| - def is_similar(self, compared_shape): |
| 64 | + def is_similar(self, compared_shape: PolygonType) -> bool: |
62 | 65 | pass
|
63 | 66 |
|
64 |
| - def perimeter(self): |
| 67 | + def perimeter(self) -> float: |
65 | 68 | pass
|
66 | 69 |
|
67 |
| - def split(self): |
| 70 | + def split(self) -> float: |
68 | 71 | pass
|
0 commit comments