mirror of https://github.com/Nonannet/pelfy.git
code style issues fixed
This commit is contained in:
parent
dca6c9ae5b
commit
9ca27dbafd
|
@ -3,6 +3,7 @@ import inspect
|
|||
import fnmatch
|
||||
from io import TextIOWrapper
|
||||
|
||||
|
||||
def write_classes(f: TextIOWrapper, patterns: list[str], module_name: str, title: str, description: str = '', exclude: list[str] = []) -> None:
|
||||
|
||||
module = importlib.import_module(module_name)
|
||||
|
@ -56,4 +57,4 @@ with open('docs/source/modules.md', 'w') as f:
|
|||
f.write('# Functions and classes\n\n')
|
||||
write_functions(f, ['*'], 'pelfy', title='Functions')
|
||||
write_classes(f, ['elf_*'], 'pelfy', title='ELF classes')
|
||||
write_classes(f, ['*_list'], 'pelfy', title='Lists of ELF classes')
|
||||
write_classes(f, ['*_list'], 'pelfy', title='Lists of ELF classes')
|
||||
|
|
|
@ -320,7 +320,7 @@ class section_list(elf_list[elf_section]):
|
|||
def _compact_table(self) -> tuple[list[str], list[list[Union[str, int]]], list[str]]:
|
||||
columns = ['index', 'name', 'type', 'description']
|
||||
data: list[list[Union[str, int]]] = [[item.index, item.name, item.type,
|
||||
item.description] for item in self]
|
||||
item.description] for item in self]
|
||||
return columns, data, ['index']
|
||||
|
||||
|
||||
|
@ -330,7 +330,7 @@ class symbol_list(elf_list[elf_symbol]):
|
|||
def _compact_table(self) -> tuple[list[str], list[list[Union[str, int]]], list[str]]:
|
||||
columns = ['index', 'name', 'info', 'size', 'stb', 'section', 'description']
|
||||
data: list[list[Union[str, int]]] = [[item.index, item.name, item.info, item.fields['st_size'],
|
||||
item.stb, item.section.name if item.section else '', item.description] for item in self]
|
||||
item.stb, item.section.name if item.section else '', item.description] for item in self]
|
||||
return columns, data, ['index', 'size']
|
||||
|
||||
|
||||
|
@ -340,7 +340,7 @@ class relocation_list(elf_list[elf_relocation]):
|
|||
def _compact_table(self) -> tuple[list[str], list[list[Union[str, int]]], list[str]]:
|
||||
columns = ['index', 'symbol name', 'type', 'calculation', 'bits']
|
||||
data: list[list[Union[str, int]]] = [[item.index, item.symbol.name, item.type,
|
||||
item.calculation, item.bits] for item in self]
|
||||
item.calculation, item.bits] for item in self]
|
||||
return columns, data, ['index', 'bits']
|
||||
|
||||
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
import pelfy
|
||||
|
||||
|
||||
def test_readme_example() -> None:
|
||||
elf = pelfy.open_elf_file('tests/obj/test-c-riscv64-linux-gnu-gcc-12-O3.o')
|
||||
|
||||
assert ' description ' in elf.sections.to_markdown()
|
||||
assert ' stb ' in elf.functions.to_markdown()
|
||||
assert ' symbol name ' in elf.symbols['read_float'].relocations.to_markdown()
|
||||
assert ' symbol name ' in elf.symbols['read_float'].relocations.to_markdown()
|
||||
|
|
Loading…
Reference in New Issue