Skip to content

Commit ea05c09

Browse files
committed
py3k: Wrap fwfetcher lines for PEP8.
Signed-off-by: Elliott Sales de Andrade <[email protected]>
1 parent b479afd commit ea05c09

File tree

1 file changed

+22
-20
lines changed

1 file changed

+22
-20
lines changed

src/fwfetcher.py

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
Note that it dumps UTF-16 characters in text strings as-is.
2626
"""
2727

28-
################################################################################
28+
###############################################################################
2929

3030
def check_size(fsize, minsize):
3131
"""Ensure that the filesize is at least minsize bytes.
@@ -40,7 +40,7 @@ def check_size(fsize, minsize):
4040
(fsize, minsize)
4141
return fsize >= minsize
4242

43-
################################################################################
43+
###############################################################################
4444

4545
def nice_open_file(filename):
4646
"""Checks if the output file with the given name already exists,
@@ -57,7 +57,7 @@ def nice_open_file(filename):
5757
else:
5858
return True
5959

60-
################################################################################
60+
###############################################################################
6161

6262
def nice_open_dir(dirname):
6363
"""Checks if the output directory with the given name already exists,
@@ -75,7 +75,7 @@ def nice_open_dir(dirname):
7575
else:
7676
return True
7777

78-
################################################################################
78+
###############################################################################
7979

8080
def do_mkdir(dirname):
8181
"""Version of os.mkdir() which does not throw an exception if the directory
@@ -90,7 +90,7 @@ def do_mkdir(dirname):
9090
if errno == 17:
9191
pass # directory already exists
9292

93-
################################################################################
93+
###############################################################################
9494

9595
def strip_blanks(instring):
9696
"""Strip the leading and trailing blanks from the input string.
@@ -103,7 +103,7 @@ def strip_blanks(instring):
103103
rstr = instring.rstrip("\0 \t\n\r\v\f\377")
104104
return rstr.lstrip(" \t\n\r\v\f\377")
105105

106-
################################################################################
106+
###############################################################################
107107

108108
def open_info_file(infile):
109109
"""Open the informational text file.
@@ -122,7 +122,7 @@ def open_info_file(infile):
122122
else:
123123
return None
124124

125-
################################################################################
125+
###############################################################################
126126

127127
def dump_png(infile, pnglen, maxlen, pngid):
128128
"""Dump the embedded PNG file from the archive file to an output file.
@@ -146,7 +146,7 @@ def dump_png(infile, pnglen, maxlen, pngid):
146146
print "PNG image %s too large (%i instead of maximal %i bytes), " \
147147
"file not written." % (pngid, pnglen, maxlen)
148148

149-
################################################################################
149+
###############################################################################
150150

151151
def dump_info(infile, txtfile, what):
152152
"""Dumps the 9 information strings from the input file.
@@ -163,7 +163,7 @@ def dump_info(infile, txtfile, what):
163163
if len(info) > 0:
164164
print >> txtfile, lang[i], ":", info
165165

166-
################################################################################
166+
###############################################################################
167167

168168
def mstime(intime):
169169
"""Convert the time given in Microsoft format to a normal time tuple.
@@ -180,7 +180,7 @@ def mstime(intime):
180180
(num_t & 0xFFFF) >> 11, (num_t >> 5) & 0x3F, (num_t & 0x1F) * 2,
181181
0, 0, -1)
182182

183-
################################################################################
183+
###############################################################################
184184

185185
def do_utime(targetname, atime, mtime):
186186
"""Set the access and update date/time of the target.
@@ -199,7 +199,7 @@ def do_utime(targetname, atime, mtime):
199199
os.utime(targetname,
200200
(time.mktime(mstime(atime)), time.mktime(mstime(mtime))))
201201

202-
################################################################################
202+
###############################################################################
203203

204204
def check_sha1(sha1, entry, infile, start, end):
205205
"""Check the SHA1 value of the specified range of the input file.
@@ -231,7 +231,7 @@ def check_sha1(sha1, entry, infile, start, end):
231231
return ret + "wrong (should be " + hexdig + " actual " + \
232232
found_sha1.hexdigest() + ")"
233233

234-
################################################################################
234+
###############################################################################
235235

236236
def get_cluster(startclust, offset):
237237
"""get the real starting cluster"""
@@ -243,7 +243,7 @@ def get_cluster(startclust, offset):
243243
# END wxPirs
244244
return rst
245245

246-
################################################################################
246+
###############################################################################
247247

248248
def fill_directory(infile, txtfile, contents, firstclust, makedir, start,
249249
offset):
@@ -345,7 +345,7 @@ def fill_directory(infile, txtfile, contents, firstclust, makedir, start,
345345
for _ in xrange(paths[oldpathind].count("/")):
346346
os.chdir("..")
347347

348-
################################################################################
348+
###############################################################################
349349

350350
def write_common_part(infile, txtfile, png2stop, start):
351351
"""Writes out the common part of PIRS/LIVE and CON files.
@@ -459,7 +459,7 @@ def write_common_part(infile, txtfile, png2stop, start):
459459

460460
txtfile.close()
461461

462-
################################################################################
462+
###############################################################################
463463

464464
def handle_live_pirs(infile, fsize):
465465
"""LIVE and PIRS files are archive files.
@@ -498,13 +498,14 @@ def handle_live_pirs(infile, fsize):
498498
### END wxPirs ###
499499
write_common_part(infile, txtfile, 0xB000, start)
500500

501-
################################################################################
501+
###############################################################################
502502

503503
# End of code taken from extract360.py.
504504

505505
def getFileOrURL(filename, url):
506506
# Check if a file named filename exists on disk.
507-
# If so, return its contents. If not, download it, save it, and return its contents.
507+
# If so, return its contents. If not, download it, save it, and return its
508+
# contents.
508509
try:
509510
f = open(filename)
510511
print "Found", filename, "cached on disk, using local copy"
@@ -544,11 +545,12 @@ def extractPirsFromZip(systemupdate):
544545
if len(sys.argv) == 2:
545546
target = sys.argv[1]
546547
if not os.path.isfile(target):
547-
fw = getFileOrURL("SystemUpdate.zip", "http://www.xbox.com/system-update-usb")
548+
fw = getFileOrURL("SystemUpdate.zip",
549+
"http://www.xbox.com/system-update-usb")
548550
pirs = extractPirsFromZip(fw)
549551

550-
lang = ["English", "Japanese", "German", "French", "Spanish", "Italian",
551-
"Korean", "Chinese", "Portuguese"]
552+
lang = ["English", "Japanese", "German", "French", "Spanish",
553+
"Italian", "Korean", "Chinese", "Portuguese"]
552554
sio = StringIO.StringIO(pirs)
553555
basename = "FFFE07DF00000001"
554556
sio.name = basename

0 commit comments

Comments
 (0)