Skip to content

Commit

Permalink
Adding positional-only parameter notation (/ in function signature) (
Browse files Browse the repository at this point in the history
  • Loading branch information
Matiiss authored Nov 22, 2023
1 parent 2867369 commit b01e892
Show file tree
Hide file tree
Showing 62 changed files with 645 additions and 644 deletions.
4 changes: 2 additions & 2 deletions buildconfig/stubs/pygame/_window.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ class Window:
def restore(self) -> None: ...
def maximize(self) -> None: ...
def minimize(self) -> None: ...
def set_modal_for(self, parent: Window) -> None: ...
def set_icon(self, icon: Surface) -> None: ...
def set_modal_for(self, parent: Window, /) -> None: ...
def set_icon(self, icon: Surface, /) -> None: ...
def get_surface(self) -> Surface: ...
def flip(self) -> None: ...

Expand Down
6 changes: 3 additions & 3 deletions buildconfig/stubs/pygame/base.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ def init() -> Tuple[int, int]: ...
def quit() -> None: ...
def get_init() -> bool: ...
def get_error() -> str: ...
def set_error(error_msg: str) -> None: ...
def set_error(error_msg: str, /) -> None: ...
def get_sdl_version(linked: bool = True) -> Tuple[int, int, int]: ...
def get_sdl_byteorder() -> int: ...
def register_quit(callable: Callable[[], Any]) -> None: ...
def register_quit(callable: Callable[[], Any], /) -> None: ...

# undocumented part of pygame API, kept here to make stubtest happy
def get_array_interface(arg: Any) -> dict: ...
def get_array_interface(arg: Any, /) -> dict: ...
24 changes: 12 additions & 12 deletions buildconfig/stubs/pygame/color.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -48,35 +48,35 @@ class Color(Collection[int]):
def __setattr__(self, attr: str, value: Union[Color, tuple]) -> None: ...
@overload
@classmethod
def from_cmy(cls, object: Tuple[float, float, float]) -> Color: ...
def from_cmy(cls, object: Tuple[float, float, float], /) -> Color: ...
@overload
@classmethod
def from_cmy(cls, c: float, m: float, y: float) -> Color: ...
def from_cmy(cls, c: float, m: float, y: float, /) -> Color: ...
@overload
@classmethod
def from_hsva(cls, object: Tuple[float, float, float, float]) -> Color: ...
def from_hsva(cls, object: Tuple[float, float, float, float], /) -> Color: ...
@overload
@classmethod
def from_hsva(cls, h: float, s: float, v: float, a: float) -> Color: ...
def from_hsva(cls, h: float, s: float, v: float, a: float, /) -> Color: ...
@overload
@classmethod
def from_hsla(cls, object: Tuple[float, float, float, float]) -> Color: ...
def from_hsla(cls, object: Tuple[float, float, float, float], /) -> Color: ...
@overload
@classmethod
def from_hsla(cls, h: float, s: float, l: float, a: float) -> Color: ...
def from_hsla(cls, h: float, s: float, l: float, a: float, /) -> Color: ...
@overload
@classmethod
def from_i1i2i3(cls, object: Tuple[float, float, float]) -> Color: ...
def from_i1i2i3(cls, object: Tuple[float, float, float], /) -> Color: ...
@overload
@classmethod
def from_i1i2i3(cls, i1: float, i2: float, i3: float) -> Color: ...
def from_i1i2i3(cls, i1: float, i2: float, i3: float, /) -> Color: ...
def normalize(self) -> Tuple[float, float, float, float]: ...
def correct_gamma(self, gamma: float) -> Color: ...
def set_length(self, length: int) -> None: ...
def correct_gamma(self, gamma: float, /) -> Color: ...
def set_length(self, length: int, /) -> None: ...
def lerp(self, color: ColorValue, amount: float) -> Color: ...
def premul_alpha(self) -> Color: ...
def grayscale(self) -> Color: ...
@overload
def update(self, r: int, g: int, b: int, a: int = 255) -> None: ...
def update(self, r: int, g: int, b: int, a: int = 255, /) -> None: ...
@overload
def update(self, rgbvalue: ColorValue) -> None: ...
def update(self, rgbvalue: ColorValue, /) -> None: ...
20 changes: 10 additions & 10 deletions buildconfig/stubs/pygame/display.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ def get_surface() -> Surface: ...
def flip() -> None: ...
@overload
def update(
rectangle: Optional[Union[RectValue, Sequence[Optional[RectValue]]]] = None
rectangle: Optional[Union[RectValue, Sequence[Optional[RectValue]]]] = None, /
) -> None: ...
@overload
def update(x: int, y: int, w: int, h: int) -> None: ...
def update(x: int, y: int, w: int, h: int, /) -> None: ...
@overload
def update(xy: Coordinate, wh: Coordinate) -> None: ...
def update(xy: Coordinate, wh: Coordinate, /) -> None: ...
def get_driver() -> str: ...
def Info() -> _VidInfo: ...
def get_wm_info() -> Dict[str, int]: ...
Expand All @@ -67,19 +67,19 @@ def mode_ok(
depth: int = 0,
display: int = 0,
) -> int: ...
def gl_get_attribute(flag: int) -> int: ...
def gl_set_attribute(flag: int, value: int) -> None: ...
def gl_get_attribute(flag: int, /) -> int: ...
def gl_set_attribute(flag: int, value: int, /) -> None: ...
def get_active() -> bool: ...
def iconify() -> bool: ...
def toggle_fullscreen() -> int: ...
def set_gamma(red: float, green: float = ..., blue: float = ...) -> int: ...
def set_gamma(red: float, green: float = ..., blue: float = ..., /) -> int: ...
def set_gamma_ramp(
red: Sequence[int], green: Sequence[int], blue: Sequence[int]
red: Sequence[int], green: Sequence[int], blue: Sequence[int], /
) -> int: ...
def set_icon(surface: Surface) -> None: ...
def set_caption(title: str, icontitle: Optional[str] = None) -> None: ...
def set_icon(surface: Surface, /) -> None: ...
def set_caption(title: str, icontitle: Optional[str] = None, /) -> None: ...
def get_caption() -> Tuple[str, str]: ...
def set_palette(palette: Sequence[ColorValue]) -> None: ...
def set_palette(palette: Sequence[ColorValue], /) -> None: ...
def get_num_displays() -> int: ...
def get_window_size() -> Tuple[int, int]: ...
def get_allow_screensaver() -> bool: ...
Expand Down
12 changes: 6 additions & 6 deletions buildconfig/stubs/pygame/event.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ def poll() -> Event: ...
def wait(timeout: int = 0) -> Event: ...
def peek(eventtype: Optional[_EventTypes] = None, pump: Any = True) -> bool: ...
def clear(eventtype: Optional[_EventTypes] = None, pump: Any = True) -> None: ...
def event_name(type: int) -> str: ...
def set_blocked(type: Optional[_EventTypes]) -> None: ...
def set_allowed(type: Optional[_EventTypes]) -> None: ...
def get_blocked(type: _EventTypes) -> bool: ...
def set_grab(grab: bool) -> None: ...
def event_name(type: int, /) -> str: ...
def set_blocked(type: Optional[_EventTypes], /) -> None: ...
def set_allowed(type: Optional[_EventTypes], /) -> None: ...
def get_blocked(type: _EventTypes, /) -> bool: ...
def set_grab(grab: bool, /) -> None: ...
def get_grab() -> bool: ...
def post(event: Event) -> bool: ...
def post(event: Event, /) -> bool: ...
def custom_type() -> int: ...

EventType = Event
16 changes: 8 additions & 8 deletions buildconfig/stubs/pygame/font.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -65,25 +65,25 @@ class Font:
bgcolor: Optional[ColorValue] = None,
wraplength: int = 0,
) -> Surface: ...
def size(self, text: Union[str, bytes]) -> Tuple[int, int]: ...
def set_underline(self, value: bool) -> None: ...
def size(self, text: Union[str, bytes], /) -> Tuple[int, int]: ...
def set_underline(self, value: bool, /) -> None: ...
def get_underline(self) -> bool: ...
def set_strikethrough(self, value: bool) -> None: ...
def set_strikethrough(self, value: bool, /) -> None: ...
def get_strikethrough(self) -> bool: ...
def set_bold(self, value: bool) -> None: ...
def set_bold(self, value: bool, /) -> None: ...
def get_bold(self) -> bool: ...
def set_italic(self, value: bool) -> None: ...
def set_italic(self, value: bool, /) -> None: ...
def metrics(
self, text: Union[str, bytes]
self, text: Union[str, bytes], /
) -> List[Tuple[int, int, int, int, int]]: ...
def get_italic(self) -> bool: ...
def get_linesize(self) -> int: ...
def get_height(self) -> int: ...
def get_ascent(self) -> int: ...
def get_descent(self) -> int: ...
def set_script(self, script_code: str) -> None: ...
def set_script(self, script_code: str, /) -> None: ...
def set_direction(self, direction: int) -> None: ...
def get_point_size(self) -> int: ...
def set_point_size(self, val: int) -> None: ...
def set_point_size(self, val: int, /) -> None: ...

FontType = Font
10 changes: 5 additions & 5 deletions buildconfig/stubs/pygame/freetype.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def get_init() -> bool: ...
def was_init() -> bool: ...
def get_cache_size() -> int: ...
def get_default_resolution() -> int: ...
def set_default_resolution(resolution: int) -> None: ...
def set_default_resolution(resolution: int, /) -> None: ...
def SysFont(
name: Union[str, bytes, Iterable[Union[str, bytes]], None],
size: int,
Expand Down Expand Up @@ -148,10 +148,10 @@ class Font:
def get_metrics(
self, text: str, size: float = 0
) -> List[Tuple[int, int, int, int, float, float]]: ...
def get_sized_ascender(self, size: float) -> int: ...
def get_sized_descender(self, size: float) -> int: ...
def get_sized_height(self, size: float) -> int: ...
def get_sized_glyph_height(self, size: float) -> int: ...
def get_sized_ascender(self, size: float, /) -> int: ...
def get_sized_descender(self, size: float, /) -> int: ...
def get_sized_height(self, size: float, /) -> int: ...
def get_sized_glyph_height(self, size: float, /) -> int: ...
def get_sizes(self) -> List[Tuple[int, int, int, float, float]]: ...
def render(
self,
Expand Down
44 changes: 22 additions & 22 deletions buildconfig/stubs/pygame/gfxdraw.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,27 @@ from pygame.surface import Surface

from ._common import ColorValue, Coordinate, RectValue, Sequence

def pixel(surface: Surface, x: int, y: int, color: ColorValue) -> None: ...
def hline(surface: Surface, x1: int, x2: int, y: int, color: ColorValue) -> None: ...
def vline(surface: Surface, x: int, y1: int, y2: int, color: ColorValue) -> None: ...
def pixel(surface: Surface, x: int, y: int, color: ColorValue, /) -> None: ...
def hline(surface: Surface, x1: int, x2: int, y: int, color: ColorValue, /) -> None: ...
def vline(surface: Surface, x: int, y1: int, y2: int, color: ColorValue, /) -> None: ...
def line(
surface: Surface, x1: int, y1: int, x2: int, y2: int, color: ColorValue
surface: Surface, x1: int, y1: int, x2: int, y2: int, color: ColorValue, /
) -> None: ...
def rectangle(surface: Surface, rect: RectValue, color: ColorValue) -> None: ...
def box(surface: Surface, rect: RectValue, color: ColorValue) -> None: ...
def circle(surface: Surface, x: int, y: int, r: int, color: ColorValue) -> None: ...
def aacircle(surface: Surface, x: int, y: int, r: int, color: ColorValue) -> None: ...
def rectangle(surface: Surface, rect: RectValue, color: ColorValue, /) -> None: ...
def box(surface: Surface, rect: RectValue, color: ColorValue, /) -> None: ...
def circle(surface: Surface, x: int, y: int, r: int, color: ColorValue, /) -> None: ...
def aacircle(surface: Surface, x: int, y: int, r: int, color: ColorValue, /) -> None: ...
def filled_circle(
surface: Surface, x: int, y: int, r: int, color: ColorValue
surface: Surface, x: int, y: int, r: int, color: ColorValue, /
) -> None: ...
def ellipse(
surface: Surface, x: int, y: int, rx: int, ry: int, color: ColorValue
surface: Surface, x: int, y: int, rx: int, ry: int, color: ColorValue, /
) -> None: ...
def aaellipse(
surface: Surface, x: int, y: int, rx: int, ry: int, color: ColorValue
surface: Surface, x: int, y: int, rx: int, ry: int, color: ColorValue, /
) -> None: ...
def filled_ellipse(
surface: Surface, x: int, y: int, rx: int, ry: int, color: ColorValue
surface: Surface, x: int, y: int, rx: int, ry: int, color: ColorValue, /
) -> None: ...
def arc(
surface: Surface,
Expand All @@ -31,7 +31,7 @@ def arc(
r: int,
start_angle: int,
atp_angle: int,
color: ColorValue,
color: ColorValue, /
) -> None: ...
def pie(
surface: Surface,
Expand All @@ -40,7 +40,7 @@ def pie(
r: int,
start_angle: int,
atp_angle: int,
color: ColorValue,
color: ColorValue, /
) -> None: ...
def trigon(
surface: Surface,
Expand All @@ -50,7 +50,7 @@ def trigon(
y2: int,
x3: int,
y3: int,
color: ColorValue,
color: ColorValue, /
) -> None: ...
def aatrigon(
surface: Surface,
Expand All @@ -60,7 +60,7 @@ def aatrigon(
y2: int,
x3: int,
y3: int,
color: ColorValue,
color: ColorValue, /
) -> None: ...
def filled_trigon(
surface: Surface,
Expand All @@ -70,20 +70,20 @@ def filled_trigon(
y2: int,
x3: int,
y3: int,
color: ColorValue,
color: ColorValue, /
) -> None: ...
def polygon(
surface: Surface, points: Sequence[Coordinate], color: ColorValue
surface: Surface, points: Sequence[Coordinate], color: ColorValue, /
) -> None: ...
def aapolygon(
surface: Surface, points: Sequence[Coordinate], color: ColorValue
surface: Surface, points: Sequence[Coordinate], color: ColorValue, /
) -> None: ...
def filled_polygon(
surface: Surface, points: Sequence[Coordinate], color: ColorValue
surface: Surface, points: Sequence[Coordinate], color: ColorValue, /
) -> None: ...
def textured_polygon(
surface: Surface, points: Sequence[Coordinate], texture: Surface, tx: int, ty: int
surface: Surface, points: Sequence[Coordinate], texture: Surface, tx: int, ty: int, /
) -> None: ...
def bezier(
surface: Surface, points: Sequence[Coordinate], steps: int, color: ColorValue
surface: Surface, points: Sequence[Coordinate], steps: int, color: ColorValue, /
) -> None: ...
2 changes: 1 addition & 1 deletion buildconfig/stubs/pygame/image.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,6 @@ def frombuffer(
format: _from_buffer_format,
pitch: int = -1,
) -> Surface: ...
def load_basic(file: FileArg) -> Surface: ...
def load_basic(file: FileArg, /) -> Surface: ...
def load_extended(file: FileArg, namehint: str = "") -> Surface: ...
def save_extended(surface: Surface, file: FileArg, namehint: str = "") -> None: ...
10 changes: 5 additions & 5 deletions buildconfig/stubs/pygame/joystick.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ class JoystickType:
def get_power_level(self) -> str: ...
def get_name(self) -> str: ...
def get_numaxes(self) -> int: ...
def get_axis(self, axis_number: int) -> float: ...
def get_axis(self, axis_number: int, /) -> float: ...
def get_numballs(self) -> int: ...
def get_ball(self, ball_number: int) -> Tuple[float, float]: ...
def get_ball(self, ball_number: int, /) -> Tuple[float, float]: ...
def get_numbuttons(self) -> int: ...
def get_button(self, button: int) -> bool: ...
def get_button(self, button: int, /) -> bool: ...
def get_numhats(self) -> int: ...
def get_hat(self, hat_number: int) -> Tuple[float, float]: ...
def get_hat(self, hat_number: int, /) -> Tuple[float, float]: ...
def rumble(
self, low_frequency: float, high_frequency: float, duration: int
) -> bool: ...
Expand All @@ -32,4 +32,4 @@ class JoystickType:
# a JoystickType instance. In the future, when the C implementation is fixed to
# add __init__/__new__ to Joystick and it's exported directly, the typestubs
# here must be updated too
def Joystick(id: int) -> JoystickType: ...
def Joystick(id: int, /) -> JoystickType: ...
6 changes: 3 additions & 3 deletions buildconfig/stubs/pygame/key.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ def get_pressed() -> ScancodeWrapper: ...
def get_just_pressed() -> ScancodeWrapper: ...
def get_just_released() -> ScancodeWrapper: ...
def get_mods() -> int: ...
def set_mods(mods: int) -> None: ...
def set_repeat(delay: int = 0, interval: int = 0) -> None: ...
def set_mods(mods: int, /) -> None: ...
def set_repeat(delay: int = 0, interval: int = 0, /) -> None: ...
def get_repeat() -> Tuple[int, int]: ...
def name(key: int, use_compat: bool = True) -> str: ...
def key_code(name: str) -> int: ...
def start_text_input() -> None: ...
def stop_text_input() -> None: ...
def set_text_input_rect(rect: RectValue) -> None: ...
def set_text_input_rect(rect: RectValue, /) -> None: ...
Loading

0 comments on commit b01e892

Please sign in to comment.