def test_using_rom_str(self, _, file): # This test assumes the Python STR model works! # This can only test basic consistency. from skytemple_files.data.str.model import Str for by in Str.internal__get_all_raw_strings_from(file): self.assertEqual( by, self.handler.serialize(self.handler.deserialize(by)))
def replace_text_main(string_file: Str, replace_map: Dict[str, str], start_idx, end_idx): new_strings = [] for idx, string in enumerate(string_file.strings): if idx < start_idx or idx > end_idx: new_strings.append(replace_strings(string, replace_map)) else: new_strings.append(string) string_file.strings = new_strings
def serialize(cls, data: Str) -> bytes: return data.to_bytes()
def deserialize(cls, data: bytes, **kwargs) -> Str: return Str(data)
def serialize(cls, data: Str, **kwargs: OptionalKwargs) -> bytes: return data.to_bytes()
def deserialize(cls, data: bytes, *, string_encoding: str = PMD2_STR_ENCODER, **kwargs: OptionalKwargs) -> Str: # type: ignore return Str(data, string_encoding)