Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing type hints #1720

Closed
wants to merge 70 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
f9de04d
1st version
Apr 23, 2023
4cc412c
Add more Type Hints
Apr 24, 2023
2c4ecc8
Fix cspotcode's review
Apr 24, 2023
0d166e4
Add types to sprite.py
Apr 24, 2023
3076ed4
Try to fix some issues
Apr 24, 2023
97cb872
Fixed more github stuff
Apr 24, 2023
c3c590f
Fix easing.py somewhat
Apr 24, 2023
ffedb28
Mics changes bc tests are breaking
Apr 24, 2023
be086d0
.
Apr 24, 2023
06b6ddd
Changes bc git complained
Apr 25, 2023
171af9b
Fixes problems in 4 files
Apr 25, 2023
9623b62
Attempt to fix git again
Apr 26, 2023
a432ca6
type hint problems in property.py
Apr 27, 2023
5294ea1
attempts to fix property.py
Apr 28, 2023
5b0d1f0
I was misunderstanding the test error messages
Apr 28, 2023
211f6a2
.
Apr 28, 2023
3698b0f
Attempt to fix property
Apr 28, 2023
51a15eb
.
Apr 28, 2023
71ef4b2
.
Apr 28, 2023
7de2f68
Check changes in mixins.py
Apr 29, 2023
7873b18
Address no slots in View
May 3, 2023
f50d5e7
Partially added __slots__
May 3, 2023
4b3789d
Role back __slots__
May 3, 2023
8563913
.
May 6, 2023
18c7c2c
.
May 6, 2023
857ec84
Merge branch 'pythonarcade:development' into AddMissingTypeHints
gran4 May 6, 2023
8d4fdd0
(View)
May 6, 2023
98fe26e
Merge branch 'AddMissingTypeHints' of https://github.com/gran4/arcade…
May 6, 2023
545fde1
.
May 6, 2023
bfc4bc8
.
May 6, 2023
cb74764
.
May 6, 2023
3d52f73
.
May 6, 2023
5c6e5d6
.
May 6, 2023
f581cbf
.
May 6, 2023
2d44801
.
May 6, 2023
a2097f1
.
May 6, 2023
30b5b26
Add imports to mixins
May 6, 2023
9ee32fb
Change import in mixins
May 6, 2023
b8ab035
Fix shape_list.py
May 6, 2023
b17ffb5
Changed pyproject.toml as @pushfoo sugested
May 7, 2023
a2c6f5c
Revert pyproject change
May 7, 2023
f2ffcab
Add # type: ignore
May 10, 2023
b386371
Small errors fixed
May 12, 2023
9ba0c55
.
May 18, 2023
1ce4b19
Merge branch 'development' into AddMissingTypeHints
gran4 May 23, 2023
16cccf6
Update arcade/application.py
gran4 May 26, 2023
5a8e8fb
Update arcade/gui/property.py
gran4 May 26, 2023
60b6f3d
cspotcode's fixes
May 26, 2023
0034450
//
May 26, 2023
a81a701
Merge branch 'AddMissingTypeHints' of https://github.com/gran4/arcade…
May 26, 2023
1c0af3c
lol
May 26, 2023
93761b6
added future immport annotations
May 26, 2023
5fe6a23
Remove generics
May 27, 2023
7f6de70
Requested fixes
Jun 3, 2023
a3e51d4
correct import in application
Jun 3, 2023
a5a6fc7
Add # type: ignore to speed it up
Jun 3, 2023
58805a7
Line was too long
Jun 4, 2023
3e867fa
Fixes
Jun 13, 2023
971e8f5
Merge branch 'pythonarcade:development' into AddMissingTypeHints
gran4 Jun 17, 2023
29e8632
..
Jun 17, 2023
99595de
Merge branch 'AddMissingTypeHints' of https://github.com/gran4/arcade…
Jun 17, 2023
6a0a779
...
Jun 17, 2023
135f7ca
..
Jun 18, 2023
4b344bf
.
Jun 18, 2023
aeb3819
.
gran4 Jun 22, 2023
929d87f
.
gran4 Jun 22, 2023
eb1f7d7
.
gran4 Jun 28, 2023
53237fa
.
gran4 Jul 5, 2023
21f3a8b
.
gran4 Jul 5, 2023
bc472c2
Update draw_commands.py
gran4 Sep 27, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 21 additions & 30 deletions arcade/draw_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,7 @@ def draw_parabola_outline(start_x: float, start_y: float, end_x: float,
# --- BEGIN CIRCLE FUNCTIONS # # #

def draw_circle_filled(center_x: float, center_y: float, radius: float,
color: RGBA255,
tilt_angle: float = 0,
color: RGBA255, tilt_angle: float = 0,
num_segments: int = -1) -> None:
"""
Draw a filled-in circle.
Expand All @@ -240,8 +239,7 @@ def draw_circle_filled(center_x: float, center_y: float, radius: float,

def draw_circle_outline(center_x: float, center_y: float, radius: float,
color: RGBA255, border_width: float = 1,
tilt_angle: float = 0,
num_segments: int = -1) -> None:
tilt_angle: float = 0, num_segments: int = -1) -> None:
"""
Draw the outline of a circle.

Expand Down Expand Up @@ -315,10 +313,8 @@ def draw_ellipse_filled(center_x: float, center_y: float,


def draw_ellipse_outline(center_x: float, center_y: float,
width: float,
height: float, color: RGBA255,
border_width: float = 1,
tilt_angle: float = 0,
width: float, height: float, color: RGBA255,
border_width: float = 1, tilt_angle: float = 0,
num_segments: int = -1) -> None:
"""
Draw the outline of an ellipse.
Expand Down Expand Up @@ -366,8 +362,7 @@ def draw_ellipse_outline(center_x: float, center_y: float,
# --- BEGIN LINE FUNCTIONS # # #


def _generic_draw_line_strip(point_list: PointList,
color: RGBA255,
def _generic_draw_line_strip(point_list: PointList, color: RGBA255,
mode: int = gl.GL_LINE_STRIP) -> None:
"""
Draw a line strip. A line strip is a set of continuously connected
Expand Down Expand Up @@ -404,8 +399,7 @@ def _generic_draw_line_strip(point_list: PointList,
geometry.render(program, mode=mode)


def draw_line_strip(point_list: PointList,
color: RGBA255,
def draw_line_strip(point_list: PointList, color: RGBA255,
line_width: float = 1) -> None:
"""
Draw a multi-point line.
Expand Down Expand Up @@ -464,8 +458,7 @@ def draw_line(start_x: float, start_y: float, end_x: float, end_y: float,
geometry.render(program, mode=gl.GL_LINES, vertices=2)


def draw_lines(point_list: PointList,
color: RGBA255,
def draw_lines(point_list: PointList, color: RGBA255,
line_width: float = 1) -> None:
"""
Draw a set of lines.
Expand Down Expand Up @@ -559,8 +552,7 @@ def draw_points(point_list: PointList, color: RGBA255, size: float = 1) -> None:
# --- BEGIN POLYGON FUNCTIONS # # #


def draw_polygon_filled(point_list: PointList,
color: RGBA255) -> None:
def draw_polygon_filled(point_list: PointList, color: RGBA255) -> None:
"""
Draw a polygon that is filled in.

Expand All @@ -572,8 +564,7 @@ def draw_polygon_filled(point_list: PointList,
flattened_list = tuple(i for g in triangle_points for i in g)
_generic_draw_line_strip(flattened_list, color, gl.GL_TRIANGLES)

def draw_polygon_outline(point_list: PointList,
color: RGBA255,
def draw_polygon_outline(point_list: PointList, color: RGBA255,
line_width: float = 1) -> None:
"""
Draw a polygon outline. Also known as a "line loop."
Expand All @@ -588,18 +579,18 @@ def draw_polygon_outline(point_list: PointList,
new_point_list.append(point_list[0])

triangle_point_list = []
# This needs a lot of improvement
last_point = None
for point in new_point_list:
if last_point is not None:
points = get_points_for_thick_line(last_point[0], last_point[1], point[0], point[1], line_width)
reordered_points = points[1], points[0], points[2], points[3]
triangle_point_list.extend(reordered_points)
last_point = point

points = get_points_for_thick_line(new_point_list[0][0], new_point_list[0][1], new_point_list[1][0],
new_point_list[1][1], line_width)
triangle_point_list.append(points[1])
for i in range(len(point_list) - 1):
point1 = point_list[i]
point2 = point_list[i + 1]

points = get_points_for_thick_line(point1[0], point1[1], point2[0], point2[1], line_width)
triangle_point_list.extend([points[1], points[0], points[2], points[3]])

# Handle the last segment (connecting back to the start)
point1 = point_list[-1]
point2 = point_list[0]
points = get_points_for_thick_line(point1[0], point1[1], point2[0], point2[1], line_width)
triangle_point_list.extend([points[1], points[0], points[2], points[3]])
Comment on lines +582 to +593
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Why is this in a type hint PR?
  2. Do we have unit tests covering these changes?

If this is a needed improvement. If it works, this should be in another, separate PR.

_generic_draw_line_strip(triangle_point_list, color, gl.GL_TRIANGLE_STRIP)


Expand Down