dump-auxv: apply "ruff format"

This commit is contained in:
Yu Watanabe
2026-05-18 02:44:47 +09:00
parent 5aa172e263
commit 7e62c9be6f
+37 -17
View File
@@ -85,24 +85,43 @@ AT_AUXV = {
'AT_L3_CACHEGEOMETRY' : 47, 'AT_L3_CACHEGEOMETRY' : 47,
'AT_MINSIGSTKSZ' : 51, # Stack needed for signal delivery 'AT_MINSIGSTKSZ' : 51, # Stack needed for signal delivery
} } # fmt: skip
AT_AUXV_NAMES = {v:k for k,v in AT_AUXV.items()} AT_AUXV_NAMES = {v: k for k, v in AT_AUXV.items()}
@click.command(help=__doc__) @click.command(help=__doc__)
@click.option('-b', '--big-endian', 'endian', @click.option(
flag_value='>', '-b',
help='Input is big-endian') '--big-endian',
@click.option('-l', '--little-endian', 'endian', 'endian',
flag_value='<', flag_value='>',
help='Input is little-endian') help='Input is big-endian',
@click.option('-3', '--32', 'field_width', )
flag_value=32, @click.option(
help='Input is 32-bit') '-l',
@click.option('-6', '--64', 'field_width', '--little-endian',
flag_value=64, 'endian',
help='Input is 64-bit') flag_value='<',
@click.argument('file', help='Input is little-endian',
type=click.File(mode='rb')) )
@click.option(
'-3',
'--32',
'field_width',
flag_value=32,
help='Input is 32-bit',
)
@click.option(
'-6',
'--64',
'field_width',
flag_value=64,
help='Input is 64-bit',
)
@click.argument(
'file',
type=click.File(mode='rb'),
)
def dump(endian, field_width, file): def dump(endian, field_width, file):
data = file.read() data = file.read()
@@ -111,7 +130,7 @@ def dump(endian, field_width, file):
if endian is None: if endian is None:
endian = '@' endian = '@'
width = {32:'II', 64:'QQ'}[field_width] width = {32: 'II', 64: 'QQ'}[field_width]
format_str = f'{endian}{width}' format_str = f'{endian}{width}'
print(f'# {format_str=}') print(f'# {format_str=}')
@@ -137,5 +156,6 @@ def dump(endian, field_width, file):
if not seen_null: if not seen_null:
print('# array not terminated with AT_NULL') print('# array not terminated with AT_NULL')
if __name__ == '__main__': if __name__ == '__main__':
dump() dump()