/
opt
/
alt
/
python311
/
lib64
/
python3.11
/
/opt/alt/python311/lib64/python3.11
mkdir
upload
Name
Size
Mode
Actions
asyncio/
-
0755
rm
collections/
-
0755
rm
concurrent/
-
0755
rm
config-3.11-x86_64-linux-gnu/
-
0755
rm
ctypes/
-
0755
rm
curses/
-
0755
rm
dbm/
-
0755
rm
distutils/
-
0755
rm
email/
-
0755
rm
encodings/
-
0755
rm
ensurepip/
-
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
re/
-
0755
rm
site-packages/
-
0755
rm
sqlite3/
-
0755
rm
tomllib/
-
0755
rm
unittest/
-
0755
rm
urllib/
-
0755
rm
venv/
-
0755
rm
wsgiref/
-
0755
rm
xml/
-
0755
rm
xmlrpc/
-
0755
rm
zoneinfo/
-
0755
rm
__phello__/
-
0755
rm
__pycache__/
-
0755
rm
abc.py
6538
0644
edit
dl
rm
aifc.py
34211
0644
edit
dl
rm
antigravity.py
500
0644
edit
dl
rm
argparse.py
100283
0644
edit
dl
rm
ast.py
61444
0644
edit
dl
rm
asynchat.py
11570
0644
edit
dl
rm
asyncore.py
20310
0644
edit
dl
rm
base64.py
21041
0755
edit
dl
rm
bdb.py
32463
0644
edit
dl
rm
bisect.py
3135
0644
edit
dl
rm
bz2.py
11847
0644
edit
dl
rm
calendar.py
24731
0644
edit
dl
rm
cgi.py
34432
0755
edit
dl
rm
cgitb.py
12421
0644
edit
dl
rm
chunk.py
5500
0644
edit
dl
rm
cmd.py
14873
0644
edit
dl
rm
code.py
10622
0644
edit
dl
rm
codecs.py
37150
0644
edit
dl
rm
codeop.py
5907
0644
edit
dl
rm
colorsys.py
4062
0644
edit
dl
rm
compileall.py
20252
0644
edit
dl
rm
configparser.py
55660
0644
edit
dl
rm
contextlib.py
27414
0644
edit
dl
rm
contextvars.py
129
0644
edit
dl
rm
copy.py
8681
0644
edit
dl
rm
copyreg.py
7677
0644
edit
dl
rm
cProfile.py
6359
0755
edit
dl
rm
crypt.py
3913
0644
edit
dl
rm
csv.py
16030
0644
edit
dl
rm
dataclasses.py
58472
0644
edit
dl
rm
datetime.py
91832
0644
edit
dl
rm
decimal.py
320
0644
edit
dl
rm
difflib.py
83308
0644
edit
dl
rm
dis.py
28906
0644
edit
dl
rm
doctest.py
106297
0644
edit
dl
rm
enum.py
79583
0644
edit
dl
rm
filecmp.py
10178
0644
edit
dl
rm
fileinput.py
15714
0644
edit
dl
rm
fnmatch.py
5999
0644
edit
dl
rm
fractions.py
28677
0644
edit
dl
rm
ftplib.py
35815
0644
edit
dl
rm
functools.py
38413
0644
edit
dl
rm
genericpath.py
4975
0644
edit
dl
rm
getopt.py
7489
0644
edit
dl
rm
getpass.py
5990
0644
edit
dl
rm
gettext.py
21320
0644
edit
dl
rm
glob.py
8732
0644
edit
dl
rm
graphlib.py
9656
0644
edit
dl
rm
gzip.py
24074
0644
edit
dl
rm
hashlib.py
11765
0644
edit
dl
rm
heapq.py
23024
0644
edit
dl
rm
hmac.py
7716
0644
edit
dl
rm
imaplib.py
55217
0644
edit
dl
rm
imghdr.py
3952
0644
edit
dl
rm
imp.py
10606
0644
edit
dl
rm
inspect.py
123419
0644
edit
dl
rm
io.py
4320
0644
edit
dl
rm
ipaddress.py
79124
0644
edit
dl
rm
keyword.py
1061
0644
edit
dl
rm
LICENSE.txt
13936
0644
edit
dl
rm
linecache.py
5649
0644
edit
dl
rm
locale.py
79095
0644
edit
dl
rm
lzma.py
13277
0644
edit
dl
rm
mailbox.py
78830
0644
edit
dl
rm
mailcap.py
9369
0644
edit
dl
rm
mimetypes.py
22962
0644
edit
dl
rm
modulefinder.py
23699
0644
edit
dl
rm
netrc.py
6929
0644
edit
dl
rm
nntplib.py
41087
0644
edit
dl
rm
ntpath.py
30222
0644
edit
dl
rm
nturl2path.py
2887
0644
edit
dl
rm
numbers.py
10348
0644
edit
dl
rm
opcode.py
10447
0644
edit
dl
rm
operator.py
10965
0644
edit
dl
rm
optparse.py
60369
0644
edit
dl
rm
os.py
39530
0644
edit
dl
rm
pathlib.py
48566
0644
edit
dl
rm
pdb.py
64186
0755
edit
dl
rm
pickle.py
65132
0644
edit
dl
rm
pickletools.py
93861
0644
edit
dl
rm
pipes.py
8978
0644
edit
dl
rm
pkgutil.py
24638
0644
edit
dl
rm
platform.py
42287
0755
edit
dl
rm
plistlib.py
28354
0644
edit
dl
rm
poplib.py
15198
0644
edit
dl
rm
posixpath.py
17013
0644
edit
dl
rm
pprint.py
24583
0644
edit
dl
rm
profile.py
22896
0755
edit
dl
rm
pstats.py
29356
0644
edit
dl
rm
pty.py
6317
0644
edit
dl
rm
pyclbr.py
11396
0644
edit
dl
rm
pydoc.py
112664
0755
edit
dl
rm
py_compile.py
7837
0644
edit
dl
rm
queue.py
11496
0644
edit
dl
rm
quopri.py
7281
0755
edit
dl
rm
random.py
32162
0644
edit
dl
rm
reprlib.py
5437
0644
edit
dl
rm
rlcompleter.py
7827
0644
edit
dl
rm
runpy.py
13159
0644
edit
dl
rm
sched.py
6351
0644
edit
dl
rm
secrets.py
2028
0644
edit
dl
rm
selectors.py
19671
0644
edit
dl
rm
shelve.py
8560
0644
edit
dl
rm
shlex.py
13501
0644
edit
dl
rm
shutil.py
56517
0644
edit
dl
rm
signal.py
2495
0644
edit
dl
rm
site.py
22987
0644
edit
dl
rm
smtpd.py
31175
0755
edit
dl
rm
smtplib.py
45431
0755
edit
dl
rm
sndhdr.py
7448
0644
edit
dl
rm
socket.py
37557
0644
edit
dl
rm
socketserver.py
27586
0644
edit
dl
rm
sre_compile.py
231
0644
edit
dl
rm
sre_constants.py
232
0644
edit
dl
rm
sre_parse.py
229
0644
edit
dl
rm
ssl.py
54305
0644
edit
dl
rm
stat.py
5485
0644
edit
dl
rm
statistics.py
47705
0644
edit
dl
rm
string.py
11786
0644
edit
dl
rm
stringprep.py
12917
0644
edit
dl
rm
struct.py
257
0644
edit
dl
rm
subprocess.py
88725
0644
edit
dl
rm
sunau.py
18480
0644
edit
dl
rm
symtable.py
10368
0644
edit
dl
rm
sysconfig.py
30315
0644
edit
dl
rm
tabnanny.py
11312
0755
edit
dl
rm
tarfile.py
107876
0755
edit
dl
rm
telnetlib.py
23301
0644
edit
dl
rm
tempfile.py
31873
0644
edit
dl
rm
textwrap.py
19718
0644
edit
dl
rm
this.py
1003
0644
edit
dl
rm
threading.py
58231
0644
edit
dl
rm
timeit.py
13532
0755
edit
dl
rm
token.py
2386
0644
edit
dl
rm
tokenize.py
26336
0644
edit
dl
rm
trace.py
29196
0755
edit
dl
rm
traceback.py
40547
0644
edit
dl
rm
tracemalloc.py
18047
0644
edit
dl
rm
tty.py
879
0644
edit
dl
rm
types.py
10067
0644
edit
dl
rm
typing.py
120951
0644
edit
dl
rm
uu.py
7341
0644
edit
dl
rm
uuid.py
27597
0644
edit
dl
rm
warnings.py
21110
0644
edit
dl
rm
wave.py
21818
0644
edit
dl
rm
weakref.py
21513
0644
edit
dl
rm
webbrowser.py
25149
0755
edit
dl
rm
xdrlib.py
5977
0644
edit
dl
rm
zipapp.py
7535
0644
edit
dl
rm
zipfile.py
93788
0644
edit
dl
rm
zipimport.py
30897
0644
edit
dl
rm
_aix_support.py
3389
0644
edit
dl
rm
_bootsubprocess.py
2675
0644
edit
dl
rm
_collections_abc.py
30193
0644
edit
dl
rm
_compat_pickle.py
8761
0644
edit
dl
rm
_compression.py
5681
0644
edit
dl
rm
_markupbase.py
14653
0644
edit
dl
rm
_osx_support.py
22023
0644
edit
dl
rm
_pydecimal.py
229202
0644
edit
dl
rm
_pyio.py
94193
0644
edit
dl
rm
_py_abc.py
6189
0644
edit
dl
rm
_sitebuiltins.py
3128
0644
edit
dl
rm
_strptime.py
25175
0644
edit
dl
rm
_sysconfigdata_d_linux_x86_64-linux-gnu.py
58878
0644
edit
dl
rm
_sysconfigdata__linux_x86_64-linux-gnu.py
59645
0644
edit
dl
rm
_threading_local.py
7220
0644
edit
dl
rm
_weakrefset.py
5893
0644
edit
dl
rm
__future__.py
5218
0644
edit
dl
rm
__hello__.py
227
0644
edit
dl
rm
Edit:
/opt/alt/python311/lib64/python3.11/py_compile.py
(7837B)
"""Routine to "compile" a .py file to a .pyc file. This module has intimate knowledge of the format of .pyc files. """ import enum import importlib._bootstrap_external import importlib.machinery import importlib.util import os import os.path import sys import traceback __all__ = ["compile", "main", "PyCompileError", "PycInvalidationMode"] class PyCompileError(Exception): """Exception raised when an error occurs while attempting to compile the file. To raise this exception, use raise PyCompileError(exc_type,exc_value,file[,msg]) where exc_type: exception type to be used in error message type name can be accesses as class variable 'exc_type_name' exc_value: exception value to be used in error message can be accesses as class variable 'exc_value' file: name of file being compiled to be used in error message can be accesses as class variable 'file' msg: string message to be written as error message If no value is given, a default exception message will be given, consistent with 'standard' py_compile output. message (or default) can be accesses as class variable 'msg' """ def __init__(self, exc_type, exc_value, file, msg=''): exc_type_name = exc_type.__name__ if exc_type is SyntaxError: tbtext = ''.join(traceback.format_exception_only( exc_type, exc_value)) errmsg = tbtext.replace('File "<string>"', 'File "%s"' % file) else: errmsg = "Sorry: %s: %s" % (exc_type_name,exc_value) Exception.__init__(self,msg or errmsg,exc_type_name,exc_value,file) self.exc_type_name = exc_type_name self.exc_value = exc_value self.file = file self.msg = msg or errmsg def __str__(self): return self.msg class PycInvalidationMode(enum.Enum): TIMESTAMP = 1 CHECKED_HASH = 2 UNCHECKED_HASH = 3 def _get_default_invalidation_mode(): if os.environ.get('SOURCE_DATE_EPOCH'): return PycInvalidationMode.CHECKED_HASH else: return PycInvalidationMode.TIMESTAMP def compile(file, cfile=None, dfile=None, doraise=False, optimize=-1, invalidation_mode=None, quiet=0): """Byte-compile one Python source file to Python bytecode. :param file: The source file name. :param cfile: The target byte compiled file name. When not given, this defaults to the PEP 3147/PEP 488 location. :param dfile: Purported file name, i.e. the file name that shows up in error messages. Defaults to the source file name. :param doraise: Flag indicating whether or not an exception should be raised when a compile error is found. If an exception occurs and this flag is set to False, a string indicating the nature of the exception will be printed, and the function will return to the caller. If an exception occurs and this flag is set to True, a PyCompileError exception will be raised. :param optimize: The optimization level for the compiler. Valid values are -1, 0, 1 and 2. A value of -1 means to use the optimization level of the current interpreter, as given by -O command line options. :param invalidation_mode: :param quiet: Return full output with False or 0, errors only with 1, and no output with 2. :return: Path to the resulting byte compiled file. Note that it isn't necessary to byte-compile Python modules for execution efficiency -- Python itself byte-compiles a module when it is loaded, and if it can, writes out the bytecode to the corresponding .pyc file. However, if a Python installation is shared between users, it is a good idea to byte-compile all modules upon installation, since other users may not be able to write in the source directories, and thus they won't be able to write the .pyc file, and then they would be byte-compiling every module each time it is loaded. This can slow down program start-up considerably. See compileall.py for a script/module that uses this module to byte-compile all installed files (or all files in selected directories). Do note that FileExistsError is raised if cfile ends up pointing at a non-regular file or symlink. Because the compilation uses a file renaming, the resulting file would be regular and thus not the same type of file as it was previously. """ if invalidation_mode is None: invalidation_mode = _get_default_invalidation_mode() if cfile is None: if optimize >= 0: optimization = optimize if optimize >= 1 else '' cfile = importlib.util.cache_from_source(file, optimization=optimization) else: cfile = importlib.util.cache_from_source(file) if os.path.islink(cfile): msg = ('{} is a symlink and will be changed into a regular file if ' 'import writes a byte-compiled file to it') raise FileExistsError(msg.format(cfile)) elif os.path.exists(cfile) and not os.path.isfile(cfile): msg = ('{} is a non-regular file and will be changed into a regular ' 'one if import writes a byte-compiled file to it') raise FileExistsError(msg.format(cfile)) loader = importlib.machinery.SourceFileLoader('<py_compile>', file) source_bytes = loader.get_data(file) try: code = loader.source_to_code(source_bytes, dfile or file, _optimize=optimize) except Exception as err: py_exc = PyCompileError(err.__class__, err, dfile or file) if quiet < 2: if doraise: raise py_exc else: sys.stderr.write(py_exc.msg + '\n') return try: dirname = os.path.dirname(cfile) if dirname: os.makedirs(dirname) except FileExistsError: pass if invalidation_mode == PycInvalidationMode.TIMESTAMP: source_stats = loader.path_stats(file) bytecode = importlib._bootstrap_external._code_to_timestamp_pyc( code, source_stats['mtime'], source_stats['size']) else: source_hash = importlib.util.source_hash(source_bytes) bytecode = importlib._bootstrap_external._code_to_hash_pyc( code, source_hash, (invalidation_mode == PycInvalidationMode.CHECKED_HASH), ) mode = importlib._bootstrap_external._calc_mode(file) importlib._bootstrap_external._write_atomic(cfile, bytecode, mode) return cfile def main(): import argparse description = 'A simple command-line interface for py_compile module.' parser = argparse.ArgumentParser(description=description) parser.add_argument( '-q', '--quiet', action='store_true', help='Suppress error output', ) parser.add_argument( 'filenames', nargs='+', help='Files to compile', ) args = parser.parse_args() if args.filenames == ['-']: filenames = [filename.rstrip('\n') for filename in sys.stdin.readlines()] else: filenames = args.filenames for filename in filenames: try: compile(filename, doraise=True) except PyCompileError as error: if args.quiet: parser.exit(1) else: parser.exit(1, error.msg) except OSError as error: if args.quiet: parser.exit(1) else: parser.exit(1, str(error)) if __name__ == "__main__": main()
Save
cmd:
run