From dd86df83aa992973aed07920437cb10aef66aeab Mon Sep 17 00:00:00 2001 From: Viv Date: Mon, 31 Jul 2023 09:28:17 -0400 Subject: [PATCH] Remove `seek` arguments from read/write struct funcs --- src/tja2fumen/parsers.py | 5 +---- src/tja2fumen/writers.py | 5 +---- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/tja2fumen/parsers.py b/src/tja2fumen/parsers.py index 37c73dd..a3c0d18 100644 --- a/src/tja2fumen/parsers.py +++ b/src/tja2fumen/parsers.py @@ -480,8 +480,7 @@ def parse_fumen(fumen_file: str, def read_struct(file: BinaryIO, order: str, - format_string: str, - seek: int = 0) -> tuple[Any, ...]: + format_string: str) -> tuple[Any, ...]: """ Interpret bytes as packed binary data. @@ -497,8 +496,6 @@ def read_struct(file: BinaryIO, - interpreted_string: A string containing interpreted byte values, based on the specified 'fmt' format characters. """ - if seek: - file.seek(seek) expected_size = struct.calcsize(order + format_string) byte_string = file.read(expected_size) # One "official" fumen (AC11\deo\deo_n.bin) runs out of data early diff --git a/src/tja2fumen/writers.py b/src/tja2fumen/writers.py index 4bc4417..494e2bd 100644 --- a/src/tja2fumen/writers.py +++ b/src/tja2fumen/writers.py @@ -55,10 +55,7 @@ def write_fumen(path_out: str, song: FumenCourse) -> None: def write_struct(file: BinaryIO, order: str, format_string: str, - value_list: list[Any], - seek: int = 0) -> None: + value_list: list[Any]) -> None: """Pack (int, float, etc.) values into a string of bytes, then write.""" - if seek: - file.seek(seek) packed_bytes = struct.pack(order + format_string, *value_list) file.write(packed_bytes)