@@ -42,7 +42,9 @@ def __init__(self, fh: BinaryIO):
4242 self .header = self .c_elf .Ehdr (fh )
4343 self .segments = SegmentTable .from_elf (self )
4444 self .section_table = SectionTable .from_elf (self )
45- self .symbol_tables : list [SymbolTable ] = self .section_table .by_type ([SHT .SYMTAB , SHT .DYNSYM ])
45+ self .symbol_tables : list [SymbolTable ] = self .section_table .by_type (
46+ [SHT .SYMTAB , SHT .DYNSYM ]
47+ )
4648
4749 def __repr__ (self ) -> str :
4850 return str (self .header )
@@ -98,7 +100,9 @@ def find(self, condition: Callable, **kwargs) -> list[T]:
98100
99101
100102class Section :
101- def __init__ (self , fh : BinaryIO , idx : Optional [int ] = None , c_elf : cstruct = c_elf_64 ):
103+ def __init__ (
104+ self , fh : BinaryIO , idx : Optional [int ] = None , c_elf : cstruct = c_elf_64
105+ ):
102106 self .fh = fh
103107 self .idx = idx
104108
@@ -224,7 +228,9 @@ def dump_data(self) -> list[tuple[int, bytes]]:
224228
225229
226230class Segment :
227- def __init__ (self , fh : BinaryIO , idx : Optional [int ] = None , c_elf : cstruct = c_elf_64 ):
231+ def __init__ (
232+ self , fh : BinaryIO , idx : Optional [int ] = None , c_elf : cstruct = c_elf_64
233+ ):
228234 self .fh = fh
229235 self .idx = idx
230236 self .c_elf = c_elf
@@ -246,7 +252,9 @@ def __repr__(self) -> str:
246252 return repr (self .header )
247253
248254 @classmethod
249- def from_segment_table (cls , table : SegmentTable , idx : Optional [int ] = None ) -> Segment :
255+ def from_segment_table (
256+ cls , table : SegmentTable , idx : Optional [int ] = None
257+ ) -> Segment :
250258 fh = table .fh
251259 return cls (fh , idx , table .c_elf )
252260
@@ -277,7 +285,14 @@ def patch(self, new_data: bytes) -> None:
277285
278286
279287class SegmentTable (Table [Segment ]):
280- def __init__ (self , fh : BinaryIO , offset : int , entries : int , size : int , c_elf : cstruct = c_elf_64 ):
288+ def __init__ (
289+ self ,
290+ fh : BinaryIO ,
291+ offset : int ,
292+ entries : int ,
293+ size : int ,
294+ c_elf : cstruct = c_elf_64 ,
295+ ):
281296 super ().__init__ (entries )
282297 self .fh = fh
283298 self .offset = offset
@@ -297,7 +312,9 @@ def from_elf(cls, elf: ELF) -> SegmentTable:
297312 offset = header .e_phoff
298313 entries = header .e_phnum
299314 size = header .e_phentsize
300- return cls (fh = elf .fh , offset = offset , entries = entries , size = size , c_elf = elf .c_elf )
315+ return cls (
316+ fh = elf .fh , offset = offset , entries = entries , size = size , c_elf = elf .c_elf
317+ )
301318
302319 def related_segments (self , section : Section ) -> list [Segment ]:
303320 return self .find (lambda x : x .is_related (section ))
@@ -318,7 +335,9 @@ def dump_table(self) -> tuple[int, bytearray]:
318335
319336
320337class StringTable (Section ):
321- def __init__ (self , fh : BinaryIO , idx : Optional [int ] = None , c_elf : cstruct = c_elf_64 ):
338+ def __init__ (
339+ self , fh : BinaryIO , idx : Optional [int ] = None , c_elf : cstruct = c_elf_64
340+ ):
322341 super ().__init__ (fh , idx , c_elf )
323342
324343 self ._get_string = lru_cache (256 )(self ._get_string )
@@ -333,7 +352,9 @@ def _get_string(self, index: int) -> str:
333352
334353
335354class Symbol :
336- def __init__ (self , fh : BinaryIO , idx : Optional [int ] = None , c_elf : cstruct = c_elf_64 ):
355+ def __init__ (
356+ self , fh : BinaryIO , idx : Optional [int ] = None , c_elf : cstruct = c_elf_64
357+ ):
337358 self .symbol = c_elf .Sym (fh )
338359 self .idx = idx
339360 self .c_elf = c_elf
@@ -388,7 +409,9 @@ def value_based_on_shndx(self, table: SectionTable) -> int:
388409
389410
390411class SymbolTable (Section , Table [Symbol ]):
391- def __init__ (self , fh : BinaryIO , idx : Optional [int ] = None , c_elf : cstruct = c_elf_64 ):
412+ def __init__ (
413+ self , fh : BinaryIO , idx : Optional [int ] = None , c_elf : cstruct = c_elf_64
414+ ):
392415 # Initializes Section info
393416 Section .__init__ (self , fh , idx , c_elf )
394417 count = self .size // self .entry_size
0 commit comments