diff --git a/bemani/backend/bishi/bishi.py b/bemani/backend/bishi/bishi.py index 04e3457..3955927 100644 --- a/bemani/backend/bishi/bishi.py +++ b/bemani/backend/bishi/bishi.py @@ -162,7 +162,7 @@ class TheStarBishiBashi( # Reconstruct table unlock_bits = unlock_bits[::-1] - csvs[11] = ''.join(['{:02x}'.format(x) for x in unlock_bits]).encode('ascii') + csvs[11] = ''.join([f'{x:02x}' for x in unlock_bits]).encode('ascii') # This is a valid profile node for this type, lets return only the profile values strdata = b','.join(csvs[2:]) diff --git a/bemani/backend/popn/eclale.py b/bemani/backend/popn/eclale.py index 9f2c53a..ec59cb5 100644 --- a/bemani/backend/popn/eclale.py +++ b/bemani/backend/popn/eclale.py @@ -399,7 +399,7 @@ class PopnMusicEclale(PopnMusicBase): def format_extid(self, extid: int) -> str: data = str(extid) crc = abs(binascii.crc32(data.encode('ascii'))) % 10000 - return '{}{:04d}'.format(data, crc) + return f'{data}{crc:04d}' def format_profile(self, userid: UserID, profile: ValidatedDict) -> Node: root = Node.void('player23') diff --git a/bemani/backend/popn/usaneko.py b/bemani/backend/popn/usaneko.py index 2f31feb..d52830d 100644 --- a/bemani/backend/popn/usaneko.py +++ b/bemani/backend/popn/usaneko.py @@ -681,7 +681,7 @@ class PopnMusicUsaNeko(PopnMusicBase): def format_extid(self, extid: int) -> str: data = str(extid) crc = abs(binascii.crc32(data.encode('ascii'))) % 10000 - return '{}{:04d}'.format(data, crc) + return f'{data}{crc:04d}' def format_profile(self, userid: UserID, profile: ValidatedDict) -> Node: root = Node.void('player24') diff --git a/bemani/utils/psmap.py b/bemani/utils/psmap.py index dec7e09..9b27719 100644 --- a/bemani/utils/psmap.py +++ b/bemani/utils/psmap.py @@ -19,7 +19,7 @@ def parse_psmap(data: bytes, offset: str, rootname: str) -> Node: if offset >= start and offset < end: return (offset - start) + section.PointerToRawData - raise Exception('Couldn\'t find raw offset for virtual offset 0x{:08x}'.format(offset)) + raise Exception(f'Couldn\'t find raw offset for virtual offset 0x{offset:08x}') if base >= pe.OPTIONAL_HEADER.ImageBase: # Assume this is virtual @@ -68,7 +68,7 @@ def parse_psmap(data: bytes, offset: str, rootname: str) -> Node: pass if nodetype == 0x00: - raise Exception('Invalid node type 0x{:02x}'.format(nodetype)) + raise Exception(f'Invalid node type 0x{nodetype:02x}') elif nodetype == 0x01: # This is a void node, so we should handle by recursing node = Node.void(name) @@ -171,7 +171,7 @@ def parse_psmap(data: bytes, offset: str, rootname: str) -> Node: else: node = Node.bool(name, False) else: - raise Exception('Unimplemented node type 0x{:02x}'.format(nodetype)) + raise Exception(f'Unimplemented node type 0x{nodetype:02x}') # Append it root.add_child(node) diff --git a/bemani/utils/read.py b/bemani/utils/read.py index 0d014a6..1161935 100644 --- a/bemani/utils/read.py +++ b/bemani/utils/read.py @@ -404,7 +404,7 @@ class ImportPopn(ImportBase): if offset >= start and offset < end: return (offset - start) + section.PointerToRawData - raise Exception('Couldn\'t find raw offset for virtual offset 0x{:08x}'.format(offset)) + raise Exception(f'Couldn\'t find raw offset for virtual offset 0x{offset:08x}') if self.version == VersionConstants.POPN_MUSIC_TUNE_STREET: # Based on K39:J:A:A:2010122200 @@ -2445,7 +2445,7 @@ class ImportSDVX(ImportBase): if offset >= start and offset < end: return (offset - start) + section.PointerToRawData - raise Exception('Couldn\'t find raw offset for virtual offset 0x{:08x}'.format(offset)) + raise Exception(f'Couldn\'t find raw offset for virtual offset 0x{offset:08x}') if self.version == VersionConstants.SDVX_BOOTH: offset = 0xFFF28 diff --git a/bemani/utils/struct.py b/bemani/utils/struct.py index 1a3d372..af5de13 100644 --- a/bemani/utils/struct.py +++ b/bemani/utils/struct.py @@ -15,7 +15,7 @@ def parse_struct(data: bytes, startaddr: str, endaddr: str, fmt: str) -> None: if offset >= start and offset < end: return (offset - start) + section.PointerToRawData - raise Exception('Couldn\'t find raw offset for virtual offset 0x{:08x}'.format(offset)) + raise Exception(f'Couldn\'t find raw offset for virtual offset 0x{offset:08x}') if start >= pe.OPTIONAL_HEADER.ImageBase: # Assume this is virtual