mirror of
https://github.com/zeldaret/oot.git
synced 2024-12-03 00:06:37 +00:00
More type annotations fixes for old Python versions
This commit is contained in:
parent
5f3097e65c
commit
95745454e9
2 changed files with 11 additions and 10 deletions
|
@ -12,15 +12,16 @@ from pathlib import Path
|
|||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
from typing import List, Optional, Tuple
|
||||
|
||||
@dataclass
|
||||
class Inst:
|
||||
func_name: str
|
||||
mnemonic: str
|
||||
regs: list[str]
|
||||
imm: int|None
|
||||
reloc_type: str|None
|
||||
reloc_symbol: str|None
|
||||
regs: List[str]
|
||||
imm: Optional[int]
|
||||
reloc_type: Optional[str]
|
||||
reloc_symbol: Optional[str]
|
||||
|
||||
FUNC_RE = re.compile(r"([0-9a-f]+) <(.*)>:")
|
||||
|
||||
|
@ -59,7 +60,7 @@ def parse_inst(func_name: str, line: str) -> Inst:
|
|||
regs.append(part)
|
||||
return Inst(func_name, mnemonic, regs, imm, None, None)
|
||||
|
||||
def run_objdump(path: Path) -> list[Inst]:
|
||||
def run_objdump(path: Path) -> List[Inst]:
|
||||
if not path.exists():
|
||||
raise Exception(f"file {path} does not exist")
|
||||
|
||||
|
@ -113,7 +114,7 @@ def run_objdump(path: Path) -> list[Inst]:
|
|||
result.pop()
|
||||
return result
|
||||
|
||||
def pair_instructions(insts1: list[Inst], insts2: list[Inst]) -> Iterator[tuple[Inst|None, Inst|None]]:
|
||||
def pair_instructions(insts1: List[Inst], insts2: List[Inst]) -> Iterator[Tuple[Inst|None, Inst|None]]:
|
||||
differ = difflib.SequenceMatcher(
|
||||
a=[(inst.func_name, inst.mnemonic) for inst in insts1],
|
||||
b=[(inst.func_name, inst.mnemonic) for inst in insts2],
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import csv
|
||||
from dataclasses import dataclass
|
||||
from pathlib import Path
|
||||
import typing
|
||||
from typing import List, Optional
|
||||
|
||||
@dataclass
|
||||
class DmaFile:
|
||||
|
@ -10,10 +10,10 @@ class DmaFile:
|
|||
vrom_end: int
|
||||
rom_start: int
|
||||
rom_end: int
|
||||
overlay_vram_start: typing.Optional[int]
|
||||
overlay_dir: typing.Optional[str]
|
||||
overlay_vram_start: Optional[int]
|
||||
overlay_dir: Optional[str]
|
||||
|
||||
def parse_file_addresses(path: Path) -> typing.List[DmaFile]:
|
||||
def parse_file_addresses(path: Path) -> List[DmaFile]:
|
||||
result = []
|
||||
with open(path) as f:
|
||||
reader = csv.DictReader(f)
|
||||
|
|
Loading…
Reference in a new issue