/
snap
/
core20
/
2866
/
usr
/
lib
/
python3.8
/
/snap/core20/2866/usr/lib/python3.8
mkdir
upload
Name
Size
Mode
Actions
asyncio/
-
0755
rm
collections/
-
0755
rm
concurrent/
-
0755
rm
ctypes/
-
0755
rm
curses/
-
0755
rm
dbm/
-
0755
rm
distutils/
-
0755
rm
email/
-
0755
rm
encodings/
-
0755
rm
html/
-
0755
rm
http/
-
0755
rm
importlib/
-
0755
rm
json/
-
0755
rm
lib-dynload/
-
0755
rm
lib2to3/
-
0755
rm
logging/
-
0755
rm
multiprocessing/
-
0755
rm
pydoc_data/
-
0755
rm
sqlite3/
-
0755
rm
test/
-
0755
rm
unittest/
-
0755
rm
urllib/
-
0755
rm
venv/
-
0755
rm
wsgiref/
-
0755
rm
xml/
-
0755
rm
xmlrpc/
-
0755
rm
__pycache__/
-
0755
rm
abc.py
4489
0644
edit
dl
rm
aifc.py
32814
0644
edit
dl
rm
antigravity.py
477
0644
edit
dl
rm
argparse.py
96311
0644
edit
dl
rm
ast.py
19234
0644
edit
dl
rm
asynchat.py
11328
0644
edit
dl
rm
asyncore.py
20094
0644
edit
dl
rm
base64.py
20382
0755
edit
dl
rm
bdb.py
32056
0644
edit
dl
rm
binhex.py
13954
0644
edit
dl
rm
bisect.py
2214
0644
edit
dl
rm
bz2.py
12558
0644
edit
dl
rm
calendar.py
24832
0644
edit
dl
rm
cgi.py
33932
0755
edit
dl
rm
cgitb.py
12096
0644
edit
dl
rm
chunk.py
5435
0644
edit
dl
rm
cmd.py
14860
0644
edit
dl
rm
code.py
10622
0644
edit
dl
rm
codecs.py
36667
0644
edit
dl
rm
codeop.py
6330
0644
edit
dl
rm
colorsys.py
4064
0644
edit
dl
rm
compileall.py
13678
0644
edit
dl
rm
configparser.py
54374
0644
edit
dl
rm
contextlib.py
24995
0644
edit
dl
rm
contextvars.py
129
0644
edit
dl
rm
copy.py
8661
0644
edit
dl
rm
copyreg.py
7135
0644
edit
dl
rm
cProfile.py
6998
0755
edit
dl
rm
crypt.py
3610
0644
edit
dl
rm
csv.py
16144
0644
edit
dl
rm
dataclasses.py
49973
0644
edit
dl
rm
datetime.py
88287
0644
edit
dl
rm
decimal.py
320
0644
edit
dl
rm
difflib.py
84058
0644
edit
dl
rm
dis.py
20570
0644
edit
dl
rm
doctest.py
104543
0644
edit
dl
rm
dummy_threading.py
2815
0644
edit
dl
rm
enum.py
38136
0644
edit
dl
rm
filecmp.py
9830
0644
edit
dl
rm
fileinput.py
14709
0644
edit
dl
rm
fnmatch.py
4079
0644
edit
dl
rm
formatter.py
15143
0644
edit
dl
rm
fractions.py
24329
0644
edit
dl
rm
ftplib.py
35129
0644
edit
dl
rm
functools.py
37406
0644
edit
dl
rm
genericpath.py
4975
0644
edit
dl
rm
getopt.py
7489
0644
edit
dl
rm
getpass.py
5994
0644
edit
dl
rm
gettext.py
27565
0644
edit
dl
rm
glob.py
5697
0644
edit
dl
rm
gzip.py
21413
0644
edit
dl
rm
hashlib.py
9730
0644
edit
dl
rm
heapq.py
22877
0644
edit
dl
rm
hmac.py
6629
0644
edit
dl
rm
imaplib.py
53606
0644
edit
dl
rm
imghdr.py
3808
0644
edit
dl
rm
imp.py
10536
0644
edit
dl
rm
inspect.py
118550
0644
edit
dl
rm
io.py
3541
0644
edit
dl
rm
ipaddress.py
76336
0644
edit
dl
rm
keyword.py
945
0644
edit
dl
rm
LICENSE.txt
13925
0644
edit
dl
rm
linecache.py
5330
0644
edit
dl
rm
locale.py
78195
0644
edit
dl
rm
lzma.py
12983
0644
edit
dl
rm
mailbox.py
78661
0644
edit
dl
rm
mailcap.py
9067
0644
edit
dl
rm
mimetypes.py
21664
0644
edit
dl
rm
modulefinder.py
24430
0644
edit
dl
rm
netrc.py
5566
0644
edit
dl
rm
nntplib.py
43261
0644
edit
dl
rm
ntpath.py
25814
0644
edit
dl
rm
nturl2path.py
2887
0644
edit
dl
rm
numbers.py
10244
0644
edit
dl
rm
opcode.py
5808
0644
edit
dl
rm
operator.py
10711
0644
edit
dl
rm
optparse.py
60369
0644
edit
dl
rm
os.py
38995
0644
edit
dl
rm
pathlib.py
52610
0644
edit
dl
rm
pdb.py
62738
0755
edit
dl
rm
pickle.py
64467
0644
edit
dl
rm
pickletools.py
93486
0644
edit
dl
rm
pipes.py
8916
0644
edit
dl
rm
pkgutil.py
21461
0644
edit
dl
rm
platform.py
40425
0755
edit
dl
rm
plistlib.py
32460
0644
edit
dl
rm
poplib.py
15077
0644
edit
dl
rm
posixpath.py
15500
0644
edit
dl
rm
pprint.py
21484
0644
edit
dl
rm
profile.py
23534
0755
edit
dl
rm
pstats.py
27345
0644
edit
dl
rm
pty.py
4807
0644
edit
dl
rm
pyclbr.py
15255
0644
edit
dl
rm
pydoc.py
106863
0755
edit
dl
rm
py_compile.py
8148
0644
edit
dl
rm
queue.py
11356
0644
edit
dl
rm
quopri.py
7252
0755
edit
dl
rm
random.py
28802
0644
edit
dl
rm
re.py
15861
0644
edit
dl
rm
reprlib.py
5267
0644
edit
dl
rm
rlcompleter.py
7097
0644
edit
dl
rm
runpy.py
12052
0644
edit
dl
rm
sched.py
6442
0644
edit
dl
rm
secrets.py
2038
0644
edit
dl
rm
selectors.py
18561
0644
edit
dl
rm
shelve.py
8527
0644
edit
dl
rm
shlex.py
13325
0644
edit
dl
rm
shutil.py
51474
0644
edit
dl
rm
signal.py
2273
0644
edit
dl
rm
site.py
22336
0644
edit
dl
rm
sitecustomize.py
-
0
edit
dl
rm
smtpd.py
34709
0755
edit
dl
rm
smtplib.py
44804
0755
edit
dl
rm
sndhdr.py
7099
0644
edit
dl
rm
socket.py
35243
0644
edit
dl
rm
socketserver.py
27296
0644
edit
dl
rm
sre_compile.py
26695
0644
edit
dl
rm
sre_constants.py
7154
0644
edit
dl
rm
sre_parse.py
40230
0644
edit
dl
rm
ssl.py
52363
0644
edit
dl
rm
stat.py
5485
0644
edit
dl
rm
statistics.py
39690
0644
edit
dl
rm
string.py
10535
0644
edit
dl
rm
stringprep.py
12917
0644
edit
dl
rm
struct.py
257
0644
edit
dl
rm
subprocess.py
77330
0644
edit
dl
rm
sunau.py
18375
0644
edit
dl
rm
symbol.py
2109
0644
edit
dl
rm
symtable.py
8021
0644
edit
dl
rm
sysconfig.py
25035
0644
edit
dl
rm
tabnanny.py
11406
0755
edit
dl
rm
tarfile.py
95580
0755
edit
dl
rm
telnetlib.py
23254
0644
edit
dl
rm
tempfile.py
32920
0644
edit
dl
rm
textwrap.py
19407
0644
edit
dl
rm
this.py
1003
0644
edit
dl
rm
threading.py
50820
0644
edit
dl
rm
timeit.py
13480
0755
edit
dl
rm
token.py
2368
0644
edit
dl
rm
tokenize.py
25841
0644
edit
dl
rm
trace.py
29858
0755
edit
dl
rm
traceback.py
23611
0644
edit
dl
rm
tracemalloc.py
17076
0644
edit
dl
rm
tty.py
879
0644
edit
dl
rm
turtle.py
143716
0644
edit
dl
rm
types.py
9713
0644
edit
dl
rm
typing.py
68962
0644
edit
dl
rm
uu.py
6957
0755
edit
dl
rm
uuid.py
30466
0644
edit
dl
rm
warnings.py
19688
0644
edit
dl
rm
wave.py
18230
0644
edit
dl
rm
weakref.py
21387
0644
edit
dl
rm
webbrowser.py
24083
0755
edit
dl
rm
xdrlib.py
5913
0644
edit
dl
rm
zipapp.py
7535
0644
edit
dl
rm
zipfile.py
89135
0644
edit
dl
rm
zipimport.py
30765
0644
edit
dl
rm
_bootlocale.py
1801
0644
edit
dl
rm
_collections_abc.py
26100
0644
edit
dl
rm
_compat_pickle.py
8749
0644
edit
dl
rm
_compression.py
5340
0644
edit
dl
rm
_dummy_thread.py
6027
0644
edit
dl
rm
_markupbase.py
14598
0644
edit
dl
rm
_osx_support.py
21774
0644
edit
dl
rm
_pydecimal.py
228666
0644
edit
dl
rm
_pyio.py
93177
0644
edit
dl
rm
_py_abc.py
6189
0644
edit
dl
rm
_sitebuiltins.py
3115
0644
edit
dl
rm
_strptime.py
25268
0644
edit
dl
rm
_sysconfigdata__linux_x86_64-linux-gnu.py
25834
0644
edit
dl
rm
_sysconfigdata__x86_64-linux-gnu.py
25834
0644
edit
dl
rm
_threading_local.py
7220
0644
edit
dl
rm
_weakrefset.py
5735
0644
edit
dl
rm
__future__.py
5147
0644
edit
dl
rm
__phello__.foo.py
64
0644
edit
dl
rm
Edit:
/snap/core20/2866/usr/lib/python3.8/lzma.py
(12983B)
"""Interface to the liblzma compression library. This module provides a class for reading and writing compressed files, classes for incremental (de)compression, and convenience functions for one-shot (de)compression. These classes and functions support both the XZ and legacy LZMA container formats, as well as raw compressed data streams. """ __all__ = [ "CHECK_NONE", "CHECK_CRC32", "CHECK_CRC64", "CHECK_SHA256", "CHECK_ID_MAX", "CHECK_UNKNOWN", "FILTER_LZMA1", "FILTER_LZMA2", "FILTER_DELTA", "FILTER_X86", "FILTER_IA64", "FILTER_ARM", "FILTER_ARMTHUMB", "FILTER_POWERPC", "FILTER_SPARC", "FORMAT_AUTO", "FORMAT_XZ", "FORMAT_ALONE", "FORMAT_RAW", "MF_HC3", "MF_HC4", "MF_BT2", "MF_BT3", "MF_BT4", "MODE_FAST", "MODE_NORMAL", "PRESET_DEFAULT", "PRESET_EXTREME", "LZMACompressor", "LZMADecompressor", "LZMAFile", "LZMAError", "open", "compress", "decompress", "is_check_supported", ] import builtins import io import os from _lzma import * from _lzma import _encode_filter_properties, _decode_filter_properties import _compression _MODE_CLOSED = 0 _MODE_READ = 1 # Value 2 no longer used _MODE_WRITE = 3 class LZMAFile(_compression.BaseStream): """A file object providing transparent LZMA (de)compression. An LZMAFile can act as a wrapper for an existing file object, or refer directly to a named file on disk. Note that LZMAFile provides a *binary* file interface - data read is returned as bytes, and data to be written must be given as bytes. """ def __init__(self, filename=None, mode="r", *, format=None, check=-1, preset=None, filters=None): """Open an LZMA-compressed file in binary mode. filename can be either an actual file name (given as a str, bytes, or PathLike object), in which case the named file is opened, or it can be an existing file object to read from or write to. mode can be "r" for reading (default), "w" for (over)writing, "x" for creating exclusively, or "a" for appending. These can equivalently be given as "rb", "wb", "xb" and "ab" respectively. format specifies the container format to use for the file. If mode is "r", this defaults to FORMAT_AUTO. Otherwise, the default is FORMAT_XZ. check specifies the integrity check to use. This argument can only be used when opening a file for writing. For FORMAT_XZ, the default is CHECK_CRC64. FORMAT_ALONE and FORMAT_RAW do not support integrity checks - for these formats, check must be omitted, or be CHECK_NONE. When opening a file for reading, the *preset* argument is not meaningful, and should be omitted. The *filters* argument should also be omitted, except when format is FORMAT_RAW (in which case it is required). When opening a file for writing, the settings used by the compressor can be specified either as a preset compression level (with the *preset* argument), or in detail as a custom filter chain (with the *filters* argument). For FORMAT_XZ and FORMAT_ALONE, the default is to use the PRESET_DEFAULT preset level. For FORMAT_RAW, the caller must always specify a filter chain; the raw compressor does not support preset compression levels. preset (if provided) should be an integer in the range 0-9, optionally OR-ed with the constant PRESET_EXTREME. filters (if provided) should be a sequence of dicts. Each dict should have an entry for "id" indicating ID of the filter, plus additional entries for options to the filter. """ self._fp = None self._closefp = False self._mode = _MODE_CLOSED if mode in ("r", "rb"): if check != -1: raise ValueError("Cannot specify an integrity check " "when opening a file for reading") if preset is not None: raise ValueError("Cannot specify a preset compression " "level when opening a file for reading") if format is None: format = FORMAT_AUTO mode_code = _MODE_READ elif mode in ("w", "wb", "a", "ab", "x", "xb"): if format is None: format = FORMAT_XZ mode_code = _MODE_WRITE self._compressor = LZMACompressor(format=format, check=check, preset=preset, filters=filters) self._pos = 0 else: raise ValueError("Invalid mode: {!r}".format(mode)) if isinstance(filename, (str, bytes, os.PathLike)): if "b" not in mode: mode += "b" self._fp = builtins.open(filename, mode) self._closefp = True self._mode = mode_code elif hasattr(filename, "read") or hasattr(filename, "write"): self._fp = filename self._mode = mode_code else: raise TypeError("filename must be a str, bytes, file or PathLike object") if self._mode == _MODE_READ: raw = _compression.DecompressReader(self._fp, LZMADecompressor, trailing_error=LZMAError, format=format, filters=filters) self._buffer = io.BufferedReader(raw) def close(self): """Flush and close the file. May be called more than once without error. Once the file is closed, any other operation on it will raise a ValueError. """ if self._mode == _MODE_CLOSED: return try: if self._mode == _MODE_READ: self._buffer.close() self._buffer = None elif self._mode == _MODE_WRITE: self._fp.write(self._compressor.flush()) self._compressor = None finally: try: if self._closefp: self._fp.close() finally: self._fp = None self._closefp = False self._mode = _MODE_CLOSED @property def closed(self): """True if this file is closed.""" return self._mode == _MODE_CLOSED def fileno(self): """Return the file descriptor for the underlying file.""" self._check_not_closed() return self._fp.fileno() def seekable(self): """Return whether the file supports seeking.""" return self.readable() and self._buffer.seekable() def readable(self): """Return whether the file was opened for reading.""" self._check_not_closed() return self._mode == _MODE_READ def writable(self): """Return whether the file was opened for writing.""" self._check_not_closed() return self._mode == _MODE_WRITE def peek(self, size=-1): """Return buffered data without advancing the file position. Always returns at least one byte of data, unless at EOF. The exact number of bytes returned is unspecified. """ self._check_can_read() # Relies on the undocumented fact that BufferedReader.peek() always # returns at least one byte (except at EOF) return self._buffer.peek(size) def read(self, size=-1): """Read up to size uncompressed bytes from the file. If size is negative or omitted, read until EOF is reached. Returns b"" if the file is already at EOF. """ self._check_can_read() return self._buffer.read(size) def read1(self, size=-1): """Read up to size uncompressed bytes, while trying to avoid making multiple reads from the underlying stream. Reads up to a buffer's worth of data if size is negative. Returns b"" if the file is at EOF. """ self._check_can_read() if size < 0: size = io.DEFAULT_BUFFER_SIZE return self._buffer.read1(size) def readline(self, size=-1): """Read a line of uncompressed bytes from the file. The terminating newline (if present) is retained. If size is non-negative, no more than size bytes will be read (in which case the line may be incomplete). Returns b'' if already at EOF. """ self._check_can_read() return self._buffer.readline(size) def write(self, data): """Write a bytes object to the file. Returns the number of uncompressed bytes written, which is always len(data). Note that due to buffering, the file on disk may not reflect the data written until close() is called. """ self._check_can_write() compressed = self._compressor.compress(data) self._fp.write(compressed) self._pos += len(data) return len(data) def seek(self, offset, whence=io.SEEK_SET): """Change the file position. The new position is specified by offset, relative to the position indicated by whence. Possible values for whence are: 0: start of stream (default): offset must not be negative 1: current stream position 2: end of stream; offset must not be positive Returns the new file position. Note that seeking is emulated, so depending on the parameters, this operation may be extremely slow. """ self._check_can_seek() return self._buffer.seek(offset, whence) def tell(self): """Return the current file position.""" self._check_not_closed() if self._mode == _MODE_READ: return self._buffer.tell() return self._pos def open(filename, mode="rb", *, format=None, check=-1, preset=None, filters=None, encoding=None, errors=None, newline=None): """Open an LZMA-compressed file in binary or text mode. filename can be either an actual file name (given as a str, bytes, or PathLike object), in which case the named file is opened, or it can be an existing file object to read from or write to. The mode argument can be "r", "rb" (default), "w", "wb", "x", "xb", "a", or "ab" for binary mode, or "rt", "wt", "xt", or "at" for text mode. The format, check, preset and filters arguments specify the compression settings, as for LZMACompressor, LZMADecompressor and LZMAFile. For binary mode, this function is equivalent to the LZMAFile constructor: LZMAFile(filename, mode, ...). In this case, the encoding, errors and newline arguments must not be provided. For text mode, an LZMAFile object is created, and wrapped in an io.TextIOWrapper instance with the specified encoding, error handling behavior, and line ending(s). """ if "t" in mode: if "b" in mode: raise ValueError("Invalid mode: %r" % (mode,)) else: if encoding is not None: raise ValueError("Argument 'encoding' not supported in binary mode") if errors is not None: raise ValueError("Argument 'errors' not supported in binary mode") if newline is not None: raise ValueError("Argument 'newline' not supported in binary mode") lz_mode = mode.replace("t", "") binary_file = LZMAFile(filename, lz_mode, format=format, check=check, preset=preset, filters=filters) if "t" in mode: return io.TextIOWrapper(binary_file, encoding, errors, newline) else: return binary_file def compress(data, format=FORMAT_XZ, check=-1, preset=None, filters=None): """Compress a block of data. Refer to LZMACompressor's docstring for a description of the optional arguments *format*, *check*, *preset* and *filters*. For incremental compression, use an LZMACompressor instead. """ comp = LZMACompressor(format, check, preset, filters) return comp.compress(data) + comp.flush() def decompress(data, format=FORMAT_AUTO, memlimit=None, filters=None): """Decompress a block of data. Refer to LZMADecompressor's docstring for a description of the optional arguments *format*, *check* and *filters*. For incremental decompression, use an LZMADecompressor instead. """ results = [] while True: decomp = LZMADecompressor(format, memlimit, filters) try: res = decomp.decompress(data) except LZMAError: if results: break # Leftover data is not a valid LZMA/XZ stream; ignore it. else: raise # Error on the first iteration; bail out. results.append(res) if not decomp.eof: raise LZMAError("Compressed data ended before the " "end-of-stream marker was reached") data = decomp.unused_data if not data: break return b"".join(results)
Save
cmd:
run