77# There are some additional fixes added for reproducability, such as fixing the zero-padding of names in the coff
88# section headers.
99
10- import sys
1110import struct
11+ import sys
1212
1313verbose = True
1414
@@ -96,8 +96,6 @@ def read_lib(fp):
9696 print ("coff length:" , len (result ["o" ][- 1 ]))
9797 h = None
9898
99- return result
100-
10199
102100def write_lib (fp , lib ):
103101 fp .write (libheader )
@@ -184,15 +182,13 @@ def first_lm_read(fp):
184182
185183 offsets = []
186184 strings = []
187- for i in range (nos ):
185+ for _ in range (nos ):
188186 offset = fp .read (4 )
189187 offsets .append (struct .unpack (">L" , offset )[0 ])
190- for i in range (nos ):
188+ for _ in range (nos ):
191189 strings .append (readcstr (fp ))
192190 return {"offsets" : offsets , "strings" : strings }
193191 # sometimes there is an extra \0a after the strings
194- p = peek (fp )
195- return zip (offsets , strings )
196192
197193
198194def first_lm_write (fp , lm ):
@@ -208,16 +204,16 @@ def second_lm_read(fp):
208204 # number of members
209205 m = struct .unpack ("<L" , fp .read (4 ))[0 ] # unsigned long, big-endian
210206 offsets = []
211- for i in range (m ):
207+ for _ in range (m ):
212208 offsets .append (struct .unpack ("<L" , fp .read (4 ))[0 ])
213209
214210 # number of symbols
215211 n = struct .unpack ("<L" , fp .read (4 ))[0 ] # unsigned long, big-endian
216212 indices = []
217- for i in range (n ):
213+ for _ in range (n ):
218214 indices .append (struct .unpack ("<H" , fp .read (2 ))[0 ]) # unsigned short
219215 strings = []
220- for i in range (n ):
216+ for _ in range (n ):
221217 strings .append (readcstr (fp ))
222218
223219 return {"offsets" : offsets , "indices" : indices , "strings" : strings }
@@ -261,7 +257,7 @@ def read_optional_nl(fp):
261257
262258
263259def peek (fp ):
264- """ check the next char """
260+ """check the next char"""
265261 t = fp .tell ()
266262 c = fp .read (1 )
267263 fp .seek (t )
0 commit comments