Edit File by line
/home/barbar84/www/wp-conte.../plugins/sujqvwi/AnonR/anonr.TX.../usr/lib64/python3....
File: gzip.py
hex(self._crc)))
[500] Fix | Delete
elif isize != (self._stream_size & 0xffffffff):
[501] Fix | Delete
raise OSError("Incorrect length of data produced")
[502] Fix | Delete
[503] Fix | Delete
# Gzip files can be padded with zeroes and still have archives.
[504] Fix | Delete
# Consume all zero bytes and set the file position to the first
[505] Fix | Delete
# non-zero byte. See http://www.gzip.org/#faq8
[506] Fix | Delete
c = b"\x00"
[507] Fix | Delete
while c == b"\x00":
[508] Fix | Delete
c = self._fp.read(1)
[509] Fix | Delete
if c:
[510] Fix | Delete
self._fp.prepend(c)
[511] Fix | Delete
[512] Fix | Delete
def _rewind(self):
[513] Fix | Delete
super()._rewind()
[514] Fix | Delete
self._new_member = True
[515] Fix | Delete
[516] Fix | Delete
def compress(data, compresslevel=9):
[517] Fix | Delete
"""Compress data in one shot and return the compressed string.
[518] Fix | Delete
Optional argument is the compression level, in range of 0-9.
[519] Fix | Delete
"""
[520] Fix | Delete
buf = io.BytesIO()
[521] Fix | Delete
with GzipFile(fileobj=buf, mode='wb', compresslevel=compresslevel) as f:
[522] Fix | Delete
f.write(data)
[523] Fix | Delete
return buf.getvalue()
[524] Fix | Delete
[525] Fix | Delete
def decompress(data):
[526] Fix | Delete
"""Decompress a gzip compressed string in one shot.
[527] Fix | Delete
Return the decompressed string.
[528] Fix | Delete
"""
[529] Fix | Delete
with GzipFile(fileobj=io.BytesIO(data)) as f:
[530] Fix | Delete
return f.read()
[531] Fix | Delete
[532] Fix | Delete
[533] Fix | Delete
def _test():
[534] Fix | Delete
# Act like gzip; with -d, act like gunzip.
[535] Fix | Delete
# The input file is not deleted, however, nor are any other gzip
[536] Fix | Delete
# options or features supported.
[537] Fix | Delete
args = sys.argv[1:]
[538] Fix | Delete
decompress = args and args[0] == "-d"
[539] Fix | Delete
if decompress:
[540] Fix | Delete
args = args[1:]
[541] Fix | Delete
if not args:
[542] Fix | Delete
args = ["-"]
[543] Fix | Delete
for arg in args:
[544] Fix | Delete
if decompress:
[545] Fix | Delete
if arg == "-":
[546] Fix | Delete
f = GzipFile(filename="", mode="rb", fileobj=sys.stdin.buffer)
[547] Fix | Delete
g = sys.stdout.buffer
[548] Fix | Delete
else:
[549] Fix | Delete
if arg[-3:] != ".gz":
[550] Fix | Delete
print("filename doesn't end in .gz:", repr(arg))
[551] Fix | Delete
continue
[552] Fix | Delete
f = open(arg, "rb")
[553] Fix | Delete
g = builtins.open(arg[:-3], "wb")
[554] Fix | Delete
else:
[555] Fix | Delete
if arg == "-":
[556] Fix | Delete
f = sys.stdin.buffer
[557] Fix | Delete
g = GzipFile(filename="", mode="wb", fileobj=sys.stdout.buffer)
[558] Fix | Delete
else:
[559] Fix | Delete
f = builtins.open(arg, "rb")
[560] Fix | Delete
g = open(arg + ".gz", "wb")
[561] Fix | Delete
while True:
[562] Fix | Delete
chunk = f.read(1024)
[563] Fix | Delete
if not chunk:
[564] Fix | Delete
break
[565] Fix | Delete
g.write(chunk)
[566] Fix | Delete
if g is not sys.stdout.buffer:
[567] Fix | Delete
g.close()
[568] Fix | Delete
if f is not sys.stdin.buffer:
[569] Fix | Delete
f.close()
[570] Fix | Delete
[571] Fix | Delete
if __name__ == '__main__':
[572] Fix | Delete
_test()
[573] Fix | Delete
[574] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function