@@ -10,31 +10,26 @@ from typing import (
1010
1111from pygame import Rect , FRect
1212from pygame .typing import Point , RectLike , SequenceLike
13- from .math import Vector2
1413
15- _CanBeCircle = Union [Circle , Tuple [Point , float ], SequenceLike [float ]]
16- _CanBeLine = Union [
17- Line ,
18- SequenceLike [float ],
19- SequenceLike [Point ],
20- ]
21-
22- class _HasCirclettribute (Protocol ):
14+ class _HasCircleAttribute (Protocol ):
2315 # An object that has a circle attribute that is either a circle, or a function
2416 # that returns a circle
25- circle : Union [_CanBeCircle , Callable [[], _CanBeCircle ]]
17+ @property
18+ def circle (self ) -> Union [_CircleLike , Callable [[], _CircleLike ]]: ...
2619
27- _CircleValue = Union [_CanBeCircle , _HasCirclettribute ]
20+ _CircleLike = Union [
21+ Circle , Tuple [Point , float ], SequenceLike [float ], _HasCircleAttribute
22+ ]
2823
2924class _HasLineAttribute (Protocol ):
3025 # An object that has a line attribute that is either a line, or a function
3126 # that returns a line
32- line : Union [ _CanBeLine , Callable [[], _CanBeLine ]]
33-
27+ @ property
28+ def line ( self ) -> Union [ _LineLike , Callable [[], _LineLike ]]: ...
3429
35- _LineValue = Union [_CanBeLine , _HasLineAttribute ]
30+ _LineLike = Union [Line , SequenceLike [ float ], SequenceLike [ Point ] , _HasLineAttribute ]
3631
37- _CanBeCollided = Union [Circle , Rect , FRect , Point , Vector2 ]
32+ _CanBeCollided = Union [Circle , Rect , FRect , Point ]
3833_CanBeIntersected = Union [Circle ]
3934
4035class Circle :
@@ -99,7 +94,7 @@ class Circle:
9994 @overload
10095 def __init__ (self , pos : Point , r : float ) -> None : ...
10196 @overload
102- def __init__ (self , circle : _CircleValue ) -> None : ...
97+ def __init__ (self , circle : _CircleLike ) -> None : ...
10398 @overload
10499 def move (self , x : float , y : float , / ) -> Circle : ...
105100 @overload
@@ -113,7 +108,7 @@ class Circle:
113108 @overload
114109 def collidepoint (self , point : Point , / ) -> bool : ...
115110 @overload
116- def collidecircle (self , circle : _CircleValue , / ) -> bool : ...
111+ def collidecircle (self , circle : _CircleLike , / ) -> bool : ...
117112 @overload
118113 def collidecircle (self , x : float , y : float , r : float , / ) -> bool : ...
119114 @overload
@@ -128,9 +123,9 @@ class Circle:
128123 def collidelist (self , colliders : Sequence [_CanBeCollided ], / ) -> int : ...
129124 def collidelistall (self , colliders : Sequence [_CanBeCollided ], / ) -> List [int ]: ...
130125 def intersect (self , other : _CanBeIntersected , / ) -> List [Tuple [float , float ]]: ...
131- def contains (self , shape : _CanBeCollided ) -> bool : ...
126+ def contains (self , shape : _CanBeCollided , / ) -> bool : ...
132127 @overload
133- def update (self , circle : _CircleValue , / ) -> None : ...
128+ def update (self , circle : _CircleLike , / ) -> None : ...
134129 @overload
135130 def update (self , x : float , y : float , r : float , / ) -> None : ...
136131 @overload
@@ -178,6 +173,6 @@ class Line:
178173 @overload
179174 def __init__ (self , a : Point , b : Point ) -> None : ...
180175 @overload
181- def __init__ (self , line : _LineValue ) -> None : ...
176+ def __init__ (self , line : _LineLike ) -> None : ...
182177 def __copy__ (self ) -> Line : ...
183178 def copy (self ) -> Line : ...
0 commit comments