8000 examples midi: Fix some 3.10isms in the typing by illume · Pull Request #3868 · pygame/pygame · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

examples midi: Fix some 3.10isms in the typing #3868

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

Merged
merged 1 commit into from
May 20, 2023
Merged
Changes from all commits
Commits
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
14 changes: 7 additions & 7 deletions examples/midi.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

import sys
import os
from typing import Any, Optional, Tuple
from typing import Any, Dict, List, Optional, Set, Tuple, Union

import pygame as pg
import pygame.midi
Expand Down Expand Up @@ -278,7 +278,7 @@ def _right_black_up(self):
null_key = NullKey()


def key_class(updates, image_strip, image_rects: list[pg.Rect], is_white_key=True):
def key_class(updates, image_strip, image_rects: List[pg.Rect], is_white_key=True):
"""Return a keyboard key widget class

Arguments:
Expand Down Expand Up @@ -363,13 +363,13 @@ def key_class(updates, image_strip, image_rects: list[pg.Rect], is_white_key=Tru
# along with corresponding image, for the related event. If no redrawing
# is required for the state change then the image rect is simply None.
#
c_event_down: dict[int, tuple[int, pygame.Rect]] = {
c_event_down: Dict[int, Tuple[int, pygame.Rect]] = {
down_state_none: (down_state_self, image_rects[1])
}
c_event_up: dict[int, tuple[int, pygame.Rect]] = {
c_event_up: Dict[int, Tuple[int, pygame.Rect]] = {
down_state_self: (down_state_none, image_rects[0])
}
c_event_right_white_down: dict[int, tuple[int, pygame.Rect | None]] = {
c_event_right_white_down: Dict[int, Tuple[int, Union[pygame.Rect, None]]] = {
down_state_none: (down_state_none, None),
down_state_self: (down_state_self, None),
}
Expand Down Expand Up @@ -569,7 +569,7 @@ def draw(self, surf, background, dirty_rects):
return Key


def key_images() -> tuple[pg.Surface, dict[str, pg.Rect]]:
def key_images() -> Tuple[pg.Surface, Dict[str, pg.Rect]]:
"""Return a keyboard keys image strip and a mapping of image locations

The return tuple is a pygame.Surface and a dictionary keyed by key name and valued by a pygame.Rect.
Expand Down Expand Up @@ -643,7 +643,7 @@ class Keyboard:
white_key_width, white_key_height = _rects["white none"].size
black_key_width, black_key_height = _rects["black none"].size

_updates: set[Any] = set()
_updates: Set[Any] = set()

# There are five key classes, representing key shape:
# black key (BlackKey), plain white key (WhiteKey), white key to the left
Expand Down
0