PATH:
snap
/
core26
/
462
/
usr
/
lib
/
python3.14
"""Convert a NT pathname to a file URL and vice versa. This module only exists to provide OS-specific code for urllib.requests, thus do not use directly. """ # Testing is done through test_nturl2path. import warnings warnings._deprecated( __name__, message=f"{warnings._DEPRECATED_MSG}; use 'urllib.request' instead", remove=(3, 19)) def url2pathname(url): """OS-specific conversion from a relative URL of the 'file' scheme to a file system path; not recommended for general use.""" # e.g. # ///C|/foo/bar/spam.foo # and # ///C:/foo/bar/spam.foo # become # C:\foo\bar\spam.foo import urllib.parse if url[:3] == '///': # URL has an empty authority section, so the path begins on the third # character. url = url[2:] elif url[:12] == '//localhost/': # Skip past 'localhost' authority. url = url[11:] if url[:3] == '///': # Skip past extra slash before UNC drive in URL path. url = url[1:] else: if url[:1] == '/' and url[2:3] in (':', '|'): # Skip past extra slash before DOS drive in URL path. url = url[1:] if url[1:2] == '|': # Older URLs use a pipe after a drive letter url = url[:1] + ':' + url[2:] return urllib.parse.unquote(url.replace('/', '\\')) def pathname2url(p): """OS-specific conversion from a file system path to a relative URL of the 'file' scheme; not recommended for general use.""" # e.g. # C:\foo\bar\spam.foo # becomes # ///C:/foo/bar/spam.foo import ntpath import urllib.parse # First, clean up some special forms. We are going to sacrifice # the additional information anyway p = p.replace('\\', '/') if p[:4] == '//?/': p = p[4:] if p[:4].upper() == 'UNC/': p = '//' + p[4:] drive, root, tail = ntpath.splitroot(p) if drive: if drive[1:] == ':': # DOS drive specified. Add three slashes to the start, producing # an authority section with a zero-length authority, and a path # section starting with a single slash. drive = f'///{drive}' drive = urllib.parse.quote(drive, safe='/:') elif root: # Add explicitly empty authority to path beginning with one slash. root = f'//{root}' tail = urllib.parse.quote(tail) return drive + root + tail
[+]
..
[-] __future__.py
[edit]
[-] __hello__.py
[edit]
[+]
__phello__
[+]
__pycache__
[-] _aix_support.py
[edit]
[-] _ast_unparse.py
[edit]
[-] _collections_abc.py
[edit]
[-] _colorize.py
[edit]
[-] _compat_pickle.py
[edit]
[-] _distutils_system_mod.py
[edit]
[-] _markupbase.py
[edit]
[-] _opcode_metadata.py
[edit]
[-] _osx_support.py
[edit]
[-] _py_abc.py
[edit]
[-] _py_warnings.py
[edit]
[-] _pydatetime.py
[edit]
[-] _pydecimal.py
[edit]
[-] _pyio.py
[edit]
[-] _pylong.py
[edit]
[+]
_pyrepl
[-] _sitebuiltins.py
[edit]
[-] _strptime.py
[edit]
[-] _sysconfig_vars__linux_x86_64-linux-gnu.json
[edit]
[-] _sysconfigdata__linux_x86_64-linux-gnu.py
[edit]
[-] _sysconfigdata__x86_64-linux-gnu.py
[edit]
[-] _threading_local.py
[edit]
[-] _weakrefset.py
[edit]
[-] abc.py
[edit]
[-] annotationlib.py
[edit]
[-] antigravity.py
[edit]
[-] argparse.py
[edit]
[-] ast.py
[edit]
[+]
asyncio
[-] base64.py
[edit]
[-] bdb.py
[edit]
[-] bisect.py
[edit]
[-] bz2.py
[edit]
[-] cProfile.py
[edit]
[-] calendar.py
[edit]
[-] cmd.py
[edit]
[-] code.py
[edit]
[-] codecs.py
[edit]
[-] codeop.py
[edit]
[+]
collections
[-] colorsys.py
[edit]
[-] compileall.py
[edit]
[+]
compression
[+]
concurrent
[-] configparser.py
[edit]
[-] contextlib.py
[edit]
[-] contextvars.py
[edit]
[-] copy.py
[edit]
[-] copyreg.py
[edit]
[-] csv.py
[edit]
[+]
ctypes
[+]
curses
[-] dataclasses.py
[edit]
[-] datetime.py
[edit]
[+]
dbm
[-] decimal.py
[edit]
[-] difflib.py
[edit]
[-] dis.py
[edit]
[-] doctest.py
[edit]
[+]
email
[+]
encodings
[-] enum.py
[edit]
[-] filecmp.py
[edit]
[-] fileinput.py
[edit]
[-] fnmatch.py
[edit]
[-] fractions.py
[edit]
[-] ftplib.py
[edit]
[-] functools.py
[edit]
[-] genericpath.py
[edit]
[-] getopt.py
[edit]
[-] getpass.py
[edit]
[-] gettext.py
[edit]
[-] glob.py
[edit]
[-] graphlib.py
[edit]
[-] gzip.py
[edit]
[-] hashlib.py
[edit]
[-] heapq.py
[edit]
[-] hmac.py
[edit]
[+]
html
[+]
http
[-] imaplib.py
[edit]
[+]
importlib
[-] inspect.py
[edit]
[-] io.py
[edit]
[-] ipaddress.py
[edit]
[+]
json
[-] keyword.py
[edit]
[+]
lib-dynload
[-] linecache.py
[edit]
[-] locale.py
[edit]
[+]
logging
[-] lzma.py
[edit]
[-] mailbox.py
[edit]
[-] mimetypes.py
[edit]
[-] modulefinder.py
[edit]
[+]
multiprocessing
[-] netrc.py
[edit]
[-] ntpath.py
[edit]
[-] nturl2path.py
[edit]
[-] numbers.py
[edit]
[-] opcode.py
[edit]
[-] operator.py
[edit]
[-] optparse.py
[edit]
[-] os.py
[edit]
[+]
pathlib
[-] pdb.py
[edit]
[-] pickle.py
[edit]
[-] pickletools.py
[edit]
[-] pkgutil.py
[edit]
[-] platform.py
[edit]
[-] plistlib.py
[edit]
[-] poplib.py
[edit]
[-] posixpath.py
[edit]
[-] pprint.py
[edit]
[-] profile.py
[edit]
[-] pstats.py
[edit]
[-] pty.py
[edit]
[-] py_compile.py
[edit]
[-] pyclbr.py
[edit]
[-] pydoc.py
[edit]
[+]
pydoc_data
[-] queue.py
[edit]
[-] quopri.py
[edit]
[-] random.py
[edit]
[+]
re
[-] reprlib.py
[edit]
[-] rlcompleter.py
[edit]
[-] runpy.py
[edit]
[-] sched.py
[edit]
[-] secrets.py
[edit]
[-] selectors.py
[edit]
[-] shelve.py
[edit]
[-] shlex.py
[edit]
[-] shutil.py
[edit]
[-] signal.py
[edit]
[-] site.py
[edit]
[-] sitecustomize.py
[edit]
[-] smtplib.py
[edit]
[-] socket.py
[edit]
[-] socketserver.py
[edit]
[+]
sqlite3
[-] sre_compile.py
[edit]
[-] sre_constants.py
[edit]
[-] sre_parse.py
[edit]
[-] ssl.py
[edit]
[-] stat.py
[edit]
[-] statistics.py
[edit]
[+]
string
[-] stringprep.py
[edit]
[-] struct.py
[edit]
[-] subprocess.py
[edit]
[-] symtable.py
[edit]
[+]
sysconfig
[-] tabnanny.py
[edit]
[-] tarfile.py
[edit]
[-] tempfile.py
[edit]
[+]
test
[-] textwrap.py
[edit]
[-] this.py
[edit]
[-] threading.py
[edit]
[-] timeit.py
[edit]
[-] token.py
[edit]
[-] tokenize.py
[edit]
[+]
tomllib
[-] trace.py
[edit]
[-] traceback.py
[edit]
[-] tracemalloc.py
[edit]
[-] tty.py
[edit]
[-] turtle.py
[edit]
[-] types.py
[edit]
[-] typing.py
[edit]
[+]
unittest
[+]
urllib
[-] uuid.py
[edit]
[+]
venv
[-] warnings.py
[edit]
[-] wave.py
[edit]
[-] weakref.py
[edit]
[-] webbrowser.py
[edit]
[+]
wsgiref
[+]
xml
[+]
xmlrpc
[-] zipapp.py
[edit]
[+]
zipfile
[-] zipimport.py
[edit]
[+]
zoneinfo