Skip to content

Commit 97f316a

Browse files
authored
Merge pull request #753 from boriel-basic/refact/fix_typing
typing: fix typing
2 parents 90c3870 + 126f72b commit 97f316a

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

src/zxbpp/base_pplex.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,11 @@ def __init__(
8585
self.next_token = None # if set to something, this will be returned once
8686
self.defines_table = defines_table
8787

88-
if defines_table is None:
88+
if self.defines_table is None:
8989
return
9090

9191
for macro_name, macro_func in self.builtin_macros.items():
92-
# FIXME
93-
self.defines_table[macro_name] = BuiltinMacro(macro_name=macro_name, func=macro_func) # type: ignore[index]
92+
self.defines_table[macro_name] = BuiltinMacro(macro_name=macro_name, func=macro_func)
9493

9594
def put_current_line(self, prefix: str = "", suffix: str = "") -> str:
9695
"""Returns line and file for include / end of include sequences."""

tools/scrview.py

+6-7
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@
3939
]
4040

4141

42-
TABLE = None # Table of bytes to tuple of binaries
42+
TABLE: list[list[int]] = [] # Table of bytes to tuple of binaries
4343

4444

45-
def to_bin(x: int):
45+
def to_bin(x: int) -> list[int]:
4646
result = []
4747

4848
for i in range(8):
@@ -52,7 +52,7 @@ def to_bin(x: int):
5252
return result
5353

5454

55-
def get_attr(data: list[int], offset) -> int:
55+
def get_attr(data: list[int], offset: int) -> int:
5656
"""For a given offset in the drawing region, return the attribute.
5757
This is a bit tricky for the speccy as the screen memory is not linear
5858
"""
@@ -72,12 +72,11 @@ def get_xy_coord(offset: int) -> tuple[int, int]:
7272
return x * SCALE, y * SCALE
7373

7474

75-
def plot_byte(screen, data: list[int], offset: int):
75+
def plot_byte(screen: pygame.Surface, data: list[int], offset: int) -> None:
7676
"""Draws a pixel at the given X, Y coordinate"""
7777
global TABLE
7878

79-
# FIXME
80-
byte_ = TABLE[data[offset]] # type: ignore[index]
79+
byte_ = TABLE[data[offset]]
8180
attr = get_attr(data, offset)
8281

8382
ink_ = attr & 0x7
@@ -94,7 +93,7 @@ def plot_byte(screen, data: list[int], offset: int):
9493
screen.fill(palette[bit_], pygame.Rect(x0 + x * SCALE, y0, SCALE, SCALE))
9594

9695

97-
def paint(data: list[int]):
96+
def paint(data: list[int]) -> None:
9897
src.arch.z80.optimizer.main.init()
9998
screen = pygame.display.set_mode([WIDTH * SCALE, HEIGHT * SCALE])
10099

0 commit comments

Comments
 (0)