PATH: //proc/self/root/proc/self/root/proc/self/root/lib64/python3.9
FILE_BARU
CREATE
FOLDER_BARU
MKDIR
UPLOAD_FILE
GO
[ .. KEMBALI ]
π LICENSE.txt
β
X
π __future__.py
β
X
π __phello__.foo.py
β
X
π __pycache__/
X
π _aix_support.py
β
X
π _bootlocale.py
β
X
π _bootsubprocess.py
β
X
π _collections_abc.py
β
X
π _compat_pickle.py
β
X
π _compression.py
β
X
π _markupbase.py
β
X
π _osx_support.py
β
X
π _py_abc.py
β
X
π _pydecimal.py
β
X
π _pyio.py
β
X
π _sitebuiltins.py
β
X
π _strptime.py
β
X
π _sysconfigdata__linux_x86_64-linux-gnu.py
β
X
π _threading_local.py
β
X
π _weakrefset.py
β
X
π abc.py
β
X
π aifc.py
β
X
π antigravity.py
β
X
π argparse.py
β
X
π ast.py
β
X
π asynchat.py
β
X
π asyncio/
X
π asyncore.py
β
X
π base64.py
β
X
π bdb.py
β
X
π binhex.py
β
X
π bisect.py
β
X
π bz2.py
β
X
π cProfile.py
β
X
π calendar.py
β
X
π cgi.py
β
X
π cgitb.py
β
X
π chunk.py
β
X
π cmd.py
β
X
π code.py
β
X
π codecs.py
β
X
π codeop.py
β
X
π collections/
X
π colorsys.py
β
X
π compileall.py
β
X
π concurrent/
X
π config-3.9-x86_64-linux-gnu/
X
π configparser.py
β
X
π contextlib.py
β
X
π contextvars.py
β
X
π copy.py
β
X
π copyreg.py
β
X
π crypt.py
β
X
π csv.py
β
X
π ctypes/
X
π curses/
X
π dataclasses.py
β
X
π datetime.py
β
X
π dbm/
X
π decimal.py
β
X
π difflib.py
β
X
π dis.py
β
X
π distutils/
X
π doctest.py
β
X
π email/
X
π encodings/
X
π ensurepip/
X
π enum.py
β
X
π filecmp.py
β
X
π fileinput.py
β
X
π fnmatch.py
β
X
π formatter.py
β
X
π fractions.py
β
X
π ftplib.py
β
X
π functools.py
β
X
π genericpath.py
β
X
π getopt.py
β
X
π getpass.py
β
X
π gettext.py
β
X
π glob.py
β
X
π graphlib.py
β
X
π gzip.py
β
X
π hashlib.py
β
X
π heapq.py
β
X
π hmac.py
β
X
π html/
X
π http/
X
π imaplib.py
β
X
π imghdr.py
β
X
π imp.py
β
X
π importlib/
X
π inspect.py
β
X
π io.py
β
X
π ipaddress.py
β
X
π json/
X
π keyword.py
β
X
π lib-dynload/
X
π lib2to3/
X
π linecache.py
β
X
π locale.py
β
X
π logging/
X
π lzma.py
β
X
π mailbox.py
β
X
π mailcap.py
β
X
π mimetypes.py
β
X
π modulefinder.py
β
X
π multiprocessing/
X
π netrc.py
β
X
π nntplib.py
β
X
π ntpath.py
β
X
π nturl2path.py
β
X
π numbers.py
β
X
π opcode.py
β
X
π operator.py
β
X
π optparse.py
β
X
π os.py
β
X
π pathlib.py
β
X
π pdb.py
β
X
π pickle.py
β
X
π pickletools.py
β
X
π pipes.py
β
X
π pkgutil.py
β
X
π platform.py
β
X
π plistlib.py
β
X
π poplib.py
β
X
π posixpath.py
β
X
π pprint.py
β
X
π profile.py
β
X
π pstats.py
β
X
π pty.py
β
X
π py_compile.py
β
X
π pyclbr.py
β
X
π pydoc.py
β
X
π pydoc_data/
X
π queue.py
β
X
π quopri.py
β
X
π random.py
β
X
π re.py
β
X
π reprlib.py
β
X
π rlcompleter.py
β
X
π runpy.py
β
X
π sched.py
β
X
π secrets.py
β
X
π selectors.py
β
X
π shelve.py
β
X
π shlex.py
β
X
π shutil.py
β
X
π signal.py
β
X
π site-packages/
X
π site.py
β
X
π smtpd.py
β
X
π smtplib.py
β
X
π sndhdr.py
β
X
π socket.py
β
X
π socketserver.py
β
X
π sqlite3/
X
π sre_compile.py
β
X
π sre_constants.py
β
X
π sre_parse.py
β
X
π ssl.py
β
X
π stat.py
β
X
π statistics.py
β
X
π string.py
β
X
π stringprep.py
β
X
π struct.py
β
X
π subprocess.py
β
X
π sunau.py
β
X
π symbol.py
β
X
π symtable.py
β
X
π sysconfig.py
β
X
π tabnanny.py
β
X
π tarfile.py
β
X
π telnetlib.py
β
X
π tempfile.py
β
X
π textwrap.py
β
X
π this.py
β
X
π threading.py
β
X
π timeit.py
β
X
π tkinter/
X
π token.py
β
X
π tokenize.py
β
X
π trace.py
β
X
π traceback.py
β
X
π tracemalloc.py
β
X
π tty.py
β
X
π turtle.py
β
X
π turtledemo/
X
π types.py
β
X
π typing.py
β
X
π unittest/
X
π urllib/
X
π uu.py
β
X
π uuid.py
β
X
π venv/
X
π warnings.py
β
X
π wave.py
β
X
π weakref.py
β
X
π webbrowser.py
β
X
π wsgiref/
X
π xdrlib.py
β
X
π xml/
X
π xmlrpc/
X
π zipapp.py
β
X
π zipfile.py
β
X
π zipimport.py
β
X
π zoneinfo/
X
SAVING...
BERHASIL DIUBAH!
EDITING: zipapp.py
import contextlib import os import pathlib import shutil import stat import sys import zipfile __all__ = ['ZipAppError', 'create_archive', 'get_interpreter'] # The __main__.py used if the users specifies "-m module:fn". # Note that this will always be written as UTF-8 (module and # function names can be non-ASCII in Python 3). # We add a coding cookie even though UTF-8 is the default in Python 3 # because the resulting archive may be intended to be run under Python 2. MAIN_TEMPLATE = """\ # -*- coding: utf-8 -*- import {module} {module}.{fn}() """ # The Windows launcher defaults to UTF-8 when parsing shebang lines if the # file has no BOM. So use UTF-8 on Windows. # On Unix, use the filesystem encoding. if sys.platform.startswith('win'): shebang_encoding = 'utf-8' else: shebang_encoding = sys.getfilesystemencoding() class ZipAppError(ValueError): pass @contextlib.contextmanager def _maybe_open(archive, mode): if isinstance(archive, (str, os.PathLike)): with open(archive, mode) as f: yield f else: yield archive def _write_file_prefix(f, interpreter): """Write a shebang line.""" if interpreter: shebang = b'#!' + interpreter.encode(shebang_encoding) + b'\n' f.write(shebang) def _copy_archive(archive, new_archive, interpreter=None): """Copy an application archive, modifying the shebang line.""" with _maybe_open(archive, 'rb') as src: # Skip the shebang line from the source. # Read 2 bytes of the source and check if they are #!. first_2 = src.read(2) if first_2 == b'#!': # Discard the initial 2 bytes and the rest of the shebang line. first_2 = b'' src.readline() with _maybe_open(new_archive, 'wb') as dst: _write_file_prefix(dst, interpreter) # If there was no shebang, "first_2" contains the first 2 bytes # of the source file, so write them before copying the rest # of the file. dst.write(first_2) shutil.copyfileobj(src, dst) if interpreter and isinstance(new_archive, str): os.chmod(new_archive, os.stat(new_archive).st_mode | stat.S_IEXEC) def create_archive(source, target=None, interpreter=None, main=None, filter=None, compressed=False): """Create an application archive from SOURCE. The SOURCE can be the name of a directory, or a filename or a file-like object referring to an existing archive. The content of SOURCE is packed into an application archive in TARGET, which can be a filename or a file-like object. If SOURCE is a directory, TARGET can be omitted and will default to the name of SOURCE with .pyz appended. The created application archive will have a shebang line specifying that it should run with INTERPRETER (there will be no shebang line if INTERPRETER is None), and a __main__.py which runs MAIN (if MAIN is not specified, an existing __main__.py will be used). It is an error to specify MAIN for anything other than a directory source with no __main__.py, and it is an error to omit MAIN if the directory has no __main__.py. """ # Are we copying an existing archive? source_is_file = False if hasattr(source, 'read') and hasattr(source, 'readline'): source_is_file = True else: source = pathlib.Path(source) if source.is_file(): source_is_file = True if source_is_file: _copy_archive(source, target, interpreter) return # We are creating a new archive from a directory. if not source.exists(): raise ZipAppError("Source does not exist") has_main = (source / '__main__.py').is_file() if main and has_main: raise ZipAppError( "Cannot specify entry point if the source has __main__.py") if not (main or has_main): raise ZipAppError("Archive has no entry point") main_py = None if main: # Check that main has the right format. mod, sep, fn = main.partition(':') mod_ok = all(part.isidentifier() for part in mod.split('.')) fn_ok = all(part.isidentifier() for part in fn.split('.')) if not (sep == ':' and mod_ok and fn_ok): raise ZipAppError("Invalid entry point: " + main) main_py = MAIN_TEMPLATE.format(module=mod, fn=fn) if target is None: target = source.with_suffix('.pyz') elif not hasattr(target, 'write'): target = pathlib.Path(target) with _maybe_open(target, 'wb') as fd: _write_file_prefix(fd, interpreter) compression = (zipfile.ZIP_DEFLATED if compressed else zipfile.ZIP_STORED) with zipfile.ZipFile(fd, 'w', compression=compression) as z: for child in source.rglob('*'): arcname = child.relative_to(source) if filter is None or filter(arcname): z.write(child, arcname.as_posix()) if main_py: z.writestr('__main__.py', main_py.encode('utf-8')) if interpreter and not hasattr(target, 'write'): target.chmod(target.stat().st_mode | stat.S_IEXEC) def get_interpreter(archive): with _maybe_open(archive, 'rb') as f: if f.read(2) == b'#!': return f.readline().strip().decode(shebang_encoding) def main(args=None): """Run the zipapp command line interface. The ARGS parameter lets you specify the argument list directly. Omitting ARGS (or setting it to None) works as for argparse, using sys.argv[1:] as the argument list. """ import argparse parser = argparse.ArgumentParser() parser.add_argument('--output', '-o', default=None, help="The name of the output archive. " "Required if SOURCE is an archive.") parser.add_argument('--python', '-p', default=None, help="The name of the Python interpreter to use " "(default: no shebang line).") parser.add_argument('--main', '-m', default=None, help="The main function of the application " "(default: use an existing __main__.py).") parser.add_argument('--compress', '-c', action='store_true', help="Compress files with the deflate method. " "Files are stored uncompressed by default.") parser.add_argument('--info', default=False, action='store_true', help="Display the interpreter from the archive.") parser.add_argument('source', help="Source directory (or existing archive).") args = parser.parse_args(args) # Handle `python -m zipapp archive.pyz --info`. if args.info: if not os.path.isfile(args.source): raise SystemExit("Can only get info for an archive file") interpreter = get_interpreter(args.source) print("Interpreter: {}".format(interpreter or "<none>")) sys.exit(0) if os.path.isfile(args.source): if args.output is None or (os.path.exists(args.output) and os.path.samefile(args.source, args.output)): raise SystemExit("In-place editing of archives is not supported") if args.main: raise SystemExit("Cannot change the main function when copying") create_archive(args.source, args.output, interpreter=args.python, main=args.main, compressed=args.compress) if __name__ == '__main__': main()
SIMPAN PERUBAHAN