/
usr
/
lib64
/
python3.12
/
/usr/lib64/python3.12
mkdir
upload
Name
Size
Mode
Actions
asyncio/
-
0755
rm
collections/
-
0755
rm
concurrent/
-
0755
rm
config-3.12-x86_64-linux-gnu/
-
0755
rm
ctypes/
-
0755
rm
curses/
-
0755
rm
dbm/
-
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
zipfile/
-
0755
rm
zoneinfo/
-
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
101155
0644
edit
dl
rm
ast.py
64452
0644
edit
dl
rm
base64.py
20634
0755
edit
dl
rm
bdb.py
33573
0644
edit
dl
rm
bisect.py
3423
0644
edit
dl
rm
bz2.py
11847
0644
edit
dl
rm
calendar.py
25864
0644
edit
dl
rm
cgi.py
34418
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
10962
0644
edit
dl
rm
codecs.py
36870
0644
edit
dl
rm
codeop.py
5908
0644
edit
dl
rm
colorsys.py
4062
0644
edit
dl
rm
compileall.py
20507
0644
edit
dl
rm
configparser.py
54205
0644
edit
dl
rm
contextlib.py
27637
0644
edit
dl
rm
contextvars.py
129
0644
edit
dl
rm
copy.py
8412
0644
edit
dl
rm
copyreg.py
7614
0644
edit
dl
rm
cProfile.py
6555
0755
edit
dl
rm
crypt.py
3913
0644
edit
dl
rm
csv.py
17132
0644
edit
dl
rm
dataclasses.py
62085
0644
edit
dl
rm
datetime.py
268
0644
edit
dl
rm
decimal.py
2805
0644
edit
dl
rm
difflib.py
83368
0644
edit
dl
rm
dis.py
30227
0644
edit
dl
rm
doctest.py
106749
0644
edit
dl
rm
enum.py
81540
0644
edit
dl
rm
filecmp.py
10381
0644
edit
dl
rm
fileinput.py
15714
0644
edit
dl
rm
fnmatch.py
5999
0644
edit
dl
rm
fractions.py
38147
0644
edit
dl
rm
ftplib.py
35240
0644
edit
dl
rm
functools.py
37940
0644
edit
dl
rm
genericpath.py
5572
0644
edit
dl
rm
getopt.py
7488
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
9648
0644
edit
dl
rm
gzip.py
25402
0644
edit
dl
rm
hashlib.py
9683
0644
edit
dl
rm
heapq.py
23024
0644
edit
dl
rm
hmac.py
8043
0644
edit
dl
rm
imaplib.py
54209
0644
edit
dl
rm
imghdr.py
4398
0644
edit
dl
rm
inspect.py
127125
0644
edit
dl
rm
io.py
3582
0644
edit
dl
rm
ipaddress.py
81414
0644
edit
dl
rm
keyword.py
1073
0644
edit
dl
rm
LICENSE.txt
13936
0644
edit
dl
rm
linecache.py
5800
0644
edit
dl
rm
locale.py
78599
0644
edit
dl
rm
lzma.py
13277
0644
edit
dl
rm
mailbox.py
78911
0644
edit
dl
rm
mailcap.py
9333
0644
edit
dl
rm
mimetypes.py
23037
0644
edit
dl
rm
modulefinder.py
23699
0644
edit
dl
rm
netrc.py
6922
0644
edit
dl
rm
nntplib.py
41087
0644
edit
dl
rm
ntpath.py
30404
0644
edit
dl
rm
nturl2path.py
2374
0644
edit
dl
rm
numbers.py
11467
0644
edit
dl
rm
opcode.py
13174
0644
edit
dl
rm
operator.py
10965
0644
edit
dl
rm
optparse.py
60369
0644
edit
dl
rm
os.py
40821
0644
edit
dl
rm
pathlib.py
51052
0644
edit
dl
rm
pdb.py
70297
0755
edit
dl
rm
pickle.py
66911
0644
edit
dl
rm
pickletools.py
94052
0644
edit
dl
rm
pipes.py
8978
0644
edit
dl
rm
pkgutil.py
18281
0644
edit
dl
rm
platform.py
43388
0755
edit
dl
rm
plistlib.py
28582
0644
edit
dl
rm
poplib.py
14742
0644
edit
dl
rm
posixpath.py
17356
0644
edit
dl
rm
pprint.py
24158
0644
edit
dl
rm
profile.py
23092
0755
edit
dl
rm
pstats.py
29289
0644
edit
dl
rm
pty.py
6137
0644
edit
dl
rm
pyclbr.py
11396
0644
edit
dl
rm
pydoc.py
113508
0755
edit
dl
rm
py_compile.py
7837
0644
edit
dl
rm
queue.py
11496
0644
edit
dl
rm
quopri.py
7183
0755
edit
dl
rm
random.py
34689
0644
edit
dl
rm
reprlib.py
7148
0644
edit
dl
rm
rlcompleter.py
7827
0644
edit
dl
rm
runpy.py
12885
0644
edit
dl
rm
sched.py
6351
0644
edit
dl
rm
secrets.py
1984
0644
edit
dl
rm
selectors.py
19671
0644
edit
dl
rm
shelve.py
8560
0644
edit
dl
rm
shlex.py
13353
0644
edit
dl
rm
shutil.py
56198
0644
edit
dl
rm
signal.py
2495
0644
edit
dl
rm
site.py
23439
0644
edit
dl
rm
smtplib.py
43531
0755
edit
dl
rm
sndhdr.py
7448
0644
edit
dl
rm
socket.py
37815
0644
edit
dl
rm
socketserver.py
28065
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
50904
0644
edit
dl
rm
stat.py
5485
0644
edit
dl
rm
statistics.py
50227
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
88747
0644
edit
dl
rm
sunau.py
18478
0644
edit
dl
rm
symtable.py
12477
0644
edit
dl
rm
sysconfig.py
33773
0644
edit
dl
rm
tabnanny.py
11531
0755
edit
dl
rm
tarfile.py
115805
0755
edit
dl
rm
telnetlib.py
23334
0644
edit
dl
rm
tempfile.py
32386
0644
edit
dl
rm
textwrap.py
19718
0644
edit
dl
rm
this.py
1003
0644
edit
dl
rm
threading.py
59742
0644
edit
dl
rm
timeit.py
13463
0755
edit
dl
rm
token.py
2511
0644
edit
dl
rm
tokenize.py
21570
0644
edit
dl
rm
trace.py
29352
0755
edit
dl
rm
traceback.py
46393
0644
edit
dl
rm
tracemalloc.py
18047
0644
edit
dl
rm
tty.py
2035
0644
edit
dl
rm
types.py
10993
0644
edit
dl
rm
typing.py
118836
0644
edit
dl
rm
uu.py
7341
0644
edit
dl
rm
uuid.py
29656
0644
edit
dl
rm
warnings.py
21909
0644
edit
dl
rm
wave.py
22769
0644
edit
dl
rm
weakref.py
21513
0644
edit
dl
rm
webbrowser.py
24206
0755
edit
dl
rm
xdrlib.py
5942
0644
edit
dl
rm
zipapp.py
7543
0644
edit
dl
rm
zipimport.py
27840
0644
edit
dl
rm
_aix_support.py
4021
0644
edit
dl
rm
_collections_abc.py
32089
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
_pydatetime.py
92087
0644
edit
dl
rm
_pydecimal.py
227283
0644
edit
dl
rm
_pyio.py
93593
0644
edit
dl
rm
_pylong.py
10790
0644
edit
dl
rm
_py_abc.py
6189
0644
edit
dl
rm
_sitebuiltins.py
3128
0644
edit
dl
rm
_strptime.py
28393
0644
edit
dl
rm
_sysconfigdata__linux_x86_64-linux-gnu.py
72132
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:
/usr/lib64/python3.12/posixpath.py
(17356B)
"""Common operations on Posix pathnames. Instead of importing this module directly, import os and refer to this module as os.path. The "os.path" name is an alias for this module on Posix systems; on other systems (e.g. Windows), os.path provides the same operations in a manner specific to that platform, and is an alias to another module (e.g. ntpath). Some of this can actually be useful on non-Posix systems too, e.g. for manipulation of the pathname component of URLs. """ # Strings representing various path-related bits and pieces. # These are primarily for export; internally, they are hardcoded. # Should be set before imports for resolving cyclic dependency. curdir = '.' pardir = '..' extsep = '.' sep = '/' pathsep = ':' defpath = '/bin:/usr/bin' altsep = None devnull = '/dev/null' import os import sys import stat import genericpath from genericpath import * __all__ = ["normcase","isabs","join","splitdrive","splitroot","split","splitext", "basename","dirname","commonprefix","getsize","getmtime", "getatime","getctime","islink","exists","lexists","isdir","isfile", "ismount", "expanduser","expandvars","normpath","abspath", "samefile","sameopenfile","samestat", "curdir","pardir","sep","pathsep","defpath","altsep","extsep", "devnull","realpath","supports_unicode_filenames","relpath", "commonpath", "isjunction", "ALLOW_MISSING"] def _get_sep(path): if isinstance(path, bytes): return b'/' else: return '/' # Normalize the case of a pathname. Trivial in Posix, string.lower on Mac. # On MS-DOS this may also turn slashes into backslashes; however, other # normalizations (such as optimizing '../' away) are not allowed # (another function should be defined to do that). def normcase(s): """Normalize case of pathname. Has no effect under Posix""" return os.fspath(s) # Return whether a path is absolute. # Trivial in Posix, harder on the Mac or MS-DOS. def isabs(s): """Test whether a path is absolute""" s = os.fspath(s) sep = _get_sep(s) return s.startswith(sep) # Join pathnames. # Ignore the previous parts if a part is absolute. # Insert a '/' unless the first part is empty or already ends in '/'. def join(a, *p): """Join two or more pathname components, inserting '/' as needed. If any component is an absolute path, all previous path components will be discarded. An empty last part will result in a path that ends with a separator.""" a = os.fspath(a) sep = _get_sep(a) path = a try: if not p: path[:0] + sep #23780: Ensure compatible data type even if p is null. for b in map(os.fspath, p): if b.startswith(sep): path = b elif not path or path.endswith(sep): path += b else: path += sep + b except (TypeError, AttributeError, BytesWarning): genericpath._check_arg_types('join', a, *p) raise return path # Split a path in head (everything up to the last '/') and tail (the # rest). If the path ends in '/', tail will be empty. If there is no # '/' in the path, head will be empty. # Trailing '/'es are stripped from head unless it is the root. def split(p): """Split a pathname. Returns tuple "(head, tail)" where "tail" is everything after the final slash. Either part may be empty.""" p = os.fspath(p) sep = _get_sep(p) i = p.rfind(sep) + 1 head, tail = p[:i], p[i:] if head and head != sep*len(head): head = head.rstrip(sep) return head, tail # Split a path in root and extension. # The extension is everything starting at the last dot in the last # pathname component; the root is everything before that. # It is always true that root + ext == p. def splitext(p): p = os.fspath(p) if isinstance(p, bytes): sep = b'/' extsep = b'.' else: sep = '/' extsep = '.' return genericpath._splitext(p, sep, None, extsep) splitext.__doc__ = genericpath._splitext.__doc__ # Split a pathname into a drive specification and the rest of the # path. Useful on DOS/Windows/NT; on Unix, the drive is always empty. def splitdrive(p): """Split a pathname into drive and path. On Posix, drive is always empty.""" p = os.fspath(p) return p[:0], p def splitroot(p): """Split a pathname into drive, root and tail. On Posix, drive is always empty; the root may be empty, a single slash, or two slashes. The tail contains anything after the root. For example: splitroot('foo/bar') == ('', '', 'foo/bar') splitroot('/foo/bar') == ('', '/', 'foo/bar') splitroot('//foo/bar') == ('', '//', 'foo/bar') splitroot('///foo/bar') == ('', '/', '//foo/bar') """ p = os.fspath(p) if isinstance(p, bytes): sep = b'/' empty = b'' else: sep = '/' empty = '' if p[:1] != sep: # Relative path, e.g.: 'foo' return empty, empty, p elif p[1:2] != sep or p[2:3] == sep: # Absolute path, e.g.: '/foo', '///foo', '////foo', etc. return empty, sep, p[1:] else: # Precisely two leading slashes, e.g.: '//foo'. Implementation defined per POSIX, see # https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html#tag_04_13 return empty, p[:2], p[2:] # Return the tail (basename) part of a path, same as split(path)[1]. def basename(p): """Returns the final component of a pathname""" p = os.fspath(p) sep = _get_sep(p) i = p.rfind(sep) + 1 return p[i:] # Return the head (dirname) part of a path, same as split(path)[0]. def dirname(p): """Returns the directory component of a pathname""" p = os.fspath(p) sep = _get_sep(p) i = p.rfind(sep) + 1 head = p[:i] if head and head != sep*len(head): head = head.rstrip(sep) return head # Is a path a junction? def isjunction(path): """Test whether a path is a junction Junctions are not a part of posix semantics""" os.fspath(path) return False # Being true for dangling symbolic links is also useful. def lexists(path): """Test whether a path exists. Returns True for broken symbolic links""" try: os.lstat(path) except (OSError, ValueError): return False return True # Is a path a mount point? # (Does this work for all UNIXes? Is it even guaranteed to work by Posix?) def ismount(path): """Test whether a path is a mount point""" try: s1 = os.lstat(path) except (OSError, ValueError): # It doesn't exist -- so not a mount point. :-) return False else: # A symlink can never be a mount point if stat.S_ISLNK(s1.st_mode): return False path = os.fspath(path) if isinstance(path, bytes): parent = join(path, b'..') else: parent = join(path, '..') parent = realpath(parent) try: s2 = os.lstat(parent) except (OSError, ValueError): return False dev1 = s1.st_dev dev2 = s2.st_dev if dev1 != dev2: return True # path/.. on a different device as path ino1 = s1.st_ino ino2 = s2.st_ino if ino1 == ino2: return True # path/.. is the same i-node as path return False # Expand paths beginning with '~' or '~user'. # '~' means $HOME; '~user' means that user's home directory. # If the path doesn't begin with '~', or if the user or $HOME is unknown, # the path is returned unchanged (leaving error reporting to whatever # function is called with the expanded path as argument). # See also module 'glob' for expansion of *, ? and [...] in pathnames. # (A function should also be defined to do full *sh-style environment # variable expansion.) def expanduser(path): """Expand ~ and ~user constructions. If user or $HOME is unknown, do nothing.""" path = os.fspath(path) if isinstance(path, bytes): tilde = b'~' else: tilde = '~' if not path.startswith(tilde): return path sep = _get_sep(path) i = path.find(sep, 1) if i < 0: i = len(path) if i == 1: if 'HOME' not in os.environ: try: import pwd except ImportError: # pwd module unavailable, return path unchanged return path try: userhome = pwd.getpwuid(os.getuid()).pw_dir except KeyError: # bpo-10496: if the current user identifier doesn't exist in the # password database, return the path unchanged return path else: userhome = os.environ['HOME'] else: try: import pwd except ImportError: # pwd module unavailable, return path unchanged return path name = path[1:i] if isinstance(name, bytes): name = os.fsdecode(name) try: pwent = pwd.getpwnam(name) except KeyError: # bpo-10496: if the user name from the path doesn't exist in the # password database, return the path unchanged return path userhome = pwent.pw_dir # if no user home, return the path unchanged on VxWorks if userhome is None and sys.platform == "vxworks": return path if isinstance(path, bytes): userhome = os.fsencode(userhome) root = b'/' else: root = '/' userhome = userhome.rstrip(root) return (userhome + path[i:]) or root # Expand paths containing shell variable substitutions. # This expands the forms $variable and ${variable} only. # Non-existent variables are left unchanged. _varpattern = r'\$(\w+|\{[^}]*\}?)' _varsub = None _varsubb = None def expandvars(path): """Expand shell variables of form $var and ${var}. Unknown variables are left unchanged.""" path = os.fspath(path) global _varsub, _varsubb if isinstance(path, bytes): if b'$' not in path: return path if not _varsubb: import re _varsubb = re.compile(_varpattern.encode(), re.ASCII).sub sub = _varsubb start = b'{' end = b'}' environ = getattr(os, 'environb', None) else: if '$' not in path: return path if not _varsub: import re _varsub = re.compile(_varpattern, re.ASCII).sub sub = _varsub start = '{' end = '}' environ = os.environ def repl(m): name = m[1] if name.startswith(start): if not name.endswith(end): return m[0] name = name[1:-1] try: if environ is None: value = os.fsencode(os.environ[os.fsdecode(name)]) else: value = environ[name] except KeyError: return m[0] else: return value return sub(repl, path) # Normalize a path, e.g. A//B, A/./B and A/foo/../B all become A/B. # It should be understood that this may change the meaning of the path # if it contains symbolic links! try: from posix import _path_normpath as normpath except ImportError: def normpath(path): """Normalize path, eliminating double slashes, etc.""" path = os.fspath(path) if isinstance(path, bytes): sep = b'/' empty = b'' dot = b'.' dotdot = b'..' else: sep = '/' empty = '' dot = '.' dotdot = '..' if path == empty: return dot _, initial_slashes, path = splitroot(path) comps = path.split(sep) new_comps = [] for comp in comps: if comp in (empty, dot): continue if (comp != dotdot or (not initial_slashes and not new_comps) or (new_comps and new_comps[-1] == dotdot)): new_comps.append(comp) elif new_comps: new_comps.pop() comps = new_comps path = initial_slashes + sep.join(comps) return path or dot def abspath(path): """Return an absolute path.""" path = os.fspath(path) if not isabs(path): if isinstance(path, bytes): cwd = os.getcwdb() else: cwd = os.getcwd() path = join(cwd, path) return normpath(path) # Return a canonical path (i.e. the absolute location of a file on the # filesystem). def realpath(filename, *, strict=False): """Return the canonical path of the specified filename, eliminating any symbolic links encountered in the path.""" filename = os.fspath(filename) path, ok = _joinrealpath(filename[:0], filename, strict, {}) return abspath(path) # Join two paths, normalizing and eliminating any symbolic links # encountered in the second path. def _joinrealpath(path, rest, strict, seen): if isinstance(path, bytes): sep = b'/' curdir = b'.' pardir = b'..' else: sep = '/' curdir = '.' pardir = '..' getcwd = os.getcwd if strict is ALLOW_MISSING: ignored_error = FileNotFoundError elif strict: ignored_error = () else: ignored_error = OSError maxlinks = None if isabs(rest): rest = rest[1:] path = sep while rest: name, _, rest = rest.partition(sep) if not name or name == curdir: # current dir continue if name == pardir: # parent dir if path: path, name = split(path) if name == pardir: path = join(path, pardir, pardir) else: path = pardir continue newpath = join(path, name) try: st = os.lstat(newpath) except ignored_error: is_link = False else: is_link = stat.S_ISLNK(st.st_mode) if not is_link: path = newpath continue # Resolve the symbolic link if newpath in seen: # Already seen this path path = seen[newpath] if path is not None: # use cached value continue # The symlink is not resolved, so we must have a symlink loop. if strict: # Raise OSError(errno.ELOOP) os.stat(newpath) else: # Return already resolved part + rest of the path unchanged. return join(newpath, rest), False seen[newpath] = None # not resolved symlink path, ok = _joinrealpath(path, os.readlink(newpath), strict, seen) if not ok: return join(path, rest), False seen[newpath] = path # resolved symlink return path, True supports_unicode_filenames = (sys.platform == 'darwin') def relpath(path, start=None): """Return a relative version of a path""" if not path: raise ValueError("no path specified") path = os.fspath(path) if isinstance(path, bytes): curdir = b'.' sep = b'/' pardir = b'..' else: curdir = '.' sep = '/' pardir = '..' if start is None: start = curdir else: start = os.fspath(start) try: start_list = [x for x in abspath(start).split(sep) if x] path_list = [x for x in abspath(path).split(sep) if x] # Work out how much of the filepath is shared by start and path. i = len(commonprefix([start_list, path_list])) rel_list = [pardir] * (len(start_list)-i) + path_list[i:] if not rel_list: return curdir return join(*rel_list) except (TypeError, AttributeError, BytesWarning, DeprecationWarning): genericpath._check_arg_types('relpath', path, start) raise # Return the longest common sub-path of the sequence of paths given as input. # The paths are not normalized before comparing them (this is the # responsibility of the caller). Any trailing separator is stripped from the # returned path. def commonpath(paths): """Given a sequence of path names, returns the longest common sub-path.""" if not paths: raise ValueError('commonpath() arg is an empty sequence') paths = tuple(map(os.fspath, paths)) if isinstance(paths[0], bytes): sep = b'/' curdir = b'.' else: sep = '/' curdir = '.' try: split_paths = [path.split(sep) for path in paths] try: isabs, = set(p[:1] == sep for p in paths) except ValueError: raise ValueError("Can't mix absolute and relative paths") from None split_paths = [[c for c in s if c and c != curdir] for s in split_paths] s1 = min(split_paths) s2 = max(split_paths) common = s1 for i, c in enumerate(s1): if c != s2[i]: common = s1[:i] break prefix = sep if isabs else sep[:0] return prefix + sep.join(common) except (TypeError, AttributeError): genericpath._check_arg_types('commonpath', *paths) raise
Save
cmd:
run