Convert more format() uses to f-strings.
This commit is contained in:
parent
509cb4f0d9
commit
9c85759dc6
@ -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:])
|
||||
|
@ -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')
|
||||
|
@ -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')
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user