Psyduck - 可達鴨 之 鴨力山大2


Server : LiteSpeed
System : Linux premium217.web-hosting.com 4.18.0-553.54.1.lve.el8.x86_64 #1 SMP Wed Jun 4 13:01:13 UTC 2025 x86_64
User : alloknri ( 880)
PHP Version : 8.1.34
Disable Function : NONE
Directory :  /opt/alt/python33/lib64/python3.3/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //opt/alt/python33/lib64/python3.3/imp.py
"""This module provides the components needed to build your own __import__
function.  Undocumented functions are obsolete.

In most cases it is preferred you consider using the importlib module's
functionality over this module.

"""
# (Probably) need to stay in _imp
from _imp import (lock_held, acquire_lock, release_lock,
                  get_frozen_object, is_frozen_package,
                  init_builtin, init_frozen, is_builtin, is_frozen,
                  _fix_co_filename)
try:
    from _imp import load_dynamic
except ImportError:
    # Platform doesn't support dynamic loading.
    load_dynamic = None

# Directly exposed by this module
from importlib._bootstrap import new_module
from importlib._bootstrap import cache_from_source, source_from_cache


from importlib import _bootstrap
from importlib import machinery
import os
import sys
import tokenize
import warnings


# DEPRECATED
SEARCH_ERROR = 0
PY_SOURCE = 1
PY_COMPILED = 2
C_EXTENSION = 3
PY_RESOURCE = 4
PKG_DIRECTORY = 5
C_BUILTIN = 6
PY_FROZEN = 7
PY_CODERESOURCE = 8
IMP_HOOK = 9


def get_magic():
    """Return the magic number for .pyc or .pyo files."""
    return _bootstrap._MAGIC_BYTES


def get_tag():
    """Return the magic tag for .pyc or .pyo files."""
    return sys.implementation.cache_tag


def get_suffixes():
    warnings.warn('imp.get_suffixes() is deprecated; use the constants '
                  'defined on importlib.machinery instead',
                  DeprecationWarning, 2)
    extensions = [(s, 'rb', C_EXTENSION) for s in machinery.EXTENSION_SUFFIXES]
    source = [(s, 'U', PY_SOURCE) for s in machinery.SOURCE_SUFFIXES]
    bytecode = [(s, 'rb', PY_COMPILED) for s in machinery.BYTECODE_SUFFIXES]

    return extensions + source + bytecode


class NullImporter:

    """Null import object."""

    def __init__(self, path):
        if path == '':
            raise ImportError('empty pathname', path='')
        elif os.path.isdir(path):
            raise ImportError('existing directory', path=path)

    def find_module(self, fullname):
        """Always returns None."""
        return None


class _HackedGetData:

    """Compatibiilty support for 'file' arguments of various load_*()
    functions."""

    def __init__(self, fullname, path, file=None):
        super().__init__(fullname, path)
        self.file = file

    def get_data(self, path):
        """Gross hack to contort loader to deal w/ load_*()'s bad API."""
        if self.file and path == self.path:
            if not self.file.closed:
                file = self.file
            else:
                self.file = file = open(self.path, 'r')

            with file:
                # Technically should be returning bytes, but
                # SourceLoader.get_code() just passed what is returned to
                # compile() which can handle str. And converting to bytes would
                # require figuring out the encoding to decode to and
                # tokenize.detect_encoding() only accepts bytes.
                return file.read()
        else:
            return super().get_data(path)


class _LoadSourceCompatibility(_HackedGetData, _bootstrap.SourceFileLoader):

    """Compatibility support for implementing load_source()."""


def load_source(name, pathname, file=None):
    msg = ('imp.load_source() is deprecated; use '
           'importlib.machinery.SourceFileLoader(name, pathname).load_module()'
           ' instead')
    warnings.warn(msg, DeprecationWarning, 2)
    _LoadSourceCompatibility(name, pathname, file).load_module(name)
    module = sys.modules[name]
    # To allow reloading to potentially work, use a non-hacked loader which
    # won't rely on a now-closed file object.
    module.__loader__ = _bootstrap.SourceFileLoader(name, pathname)
    return module


class _LoadCompiledCompatibility(_HackedGetData,
        _bootstrap.SourcelessFileLoader):

    """Compatibility support for implementing load_compiled()."""


def load_compiled(name, pathname, file=None):
    msg = ('imp.load_compiled() is deprecated; use '
           'importlib.machinery.SourcelessFileLoader(name, pathname).'
           'load_module() instead ')
    warnings.warn(msg, DeprecationWarning, 2)
    _LoadCompiledCompatibility(name, pathname, file).load_module(name)
    module = sys.modules[name]
    # To allow reloading to potentially work, use a non-hacked loader which
    # won't rely on a now-closed file object.
    module.__loader__ = _bootstrap.SourcelessFileLoader(name, pathname)
    return module


def load_package(name, path):
    msg = ('imp.load_package() is deprecated; use either '
           'importlib.machinery.SourceFileLoader() or '
           'importlib.machinery.SourcelessFileLoader() instead')
    warnings.warn(msg, DeprecationWarning, 2)
    if os.path.isdir(path):
        extensions = (machinery.SOURCE_SUFFIXES[:] +
                      machinery.BYTECODE_SUFFIXES[:])
        for extension in extensions:
            path = os.path.join(path, '__init__'+extension)
            if os.path.exists(path):
                break
        else:
            raise ValueError('{!r} is not a package'.format(path))
    return _bootstrap.SourceFileLoader(name, path).load_module(name)


def load_module(name, file, filename, details):
    """**DEPRECATED**

    Load a module, given information returned by find_module().

    The module name must include the full package name, if any.

    """
    suffix, mode, type_ = details
    with warnings.catch_warnings():
        warnings.simplefilter('ignore')
        if mode and (not mode.startswith(('r', 'U')) or '+' in mode):
            raise ValueError('invalid file open mode {!r}'.format(mode))
        elif file is None and type_ in {PY_SOURCE, PY_COMPILED}:
            msg = 'file object required for import (type code {})'.format(type_)
            raise ValueError(msg)
        elif type_ == PY_SOURCE:
            return load_source(name, filename, file)
        elif type_ == PY_COMPILED:
            return load_compiled(name, filename, file)
        elif type_ == C_EXTENSION and load_dynamic is not None:
            if file is None:
                with open(filename, 'rb') as opened_file:
                    return load_dynamic(name, filename, opened_file)
            else:
                return load_dynamic(name, filename, file)
        elif type_ == PKG_DIRECTORY:
            return load_package(name, filename)
        elif type_ == C_BUILTIN:
            return init_builtin(name)
        elif type_ == PY_FROZEN:
            return init_frozen(name)
        else:
            msg =  "Don't know how to import {} (type code {})".format(name, type_)
            raise ImportError(msg, name=name)


def find_module(name, path=None):
    """**DEPRECATED**

    Search for a module.

    If path is omitted or None, search for a built-in, frozen or special
    module and continue search in sys.path. The module name cannot
    contain '.'; to search for a submodule of a package, pass the
    submodule name and the package's __path__.

    """
    if not isinstance(name, str):
        raise TypeError("'name' must be a str, not {}".format(type(name)))
    elif not isinstance(path, (type(None), list)):
        # Backwards-compatibility
        raise RuntimeError("'list' must be None or a list, "
                           "not {}".format(type(name)))

    if path is None:
        if is_builtin(name):
            return None, None, ('', '', C_BUILTIN)
        elif is_frozen(name):
            return None, None, ('', '', PY_FROZEN)
        else:
            path = sys.path

    for entry in path:
        package_directory = os.path.join(entry, name)
        for suffix in ['.py', machinery.BYTECODE_SUFFIXES[0]]:
            package_file_name = '__init__' + suffix
            file_path = os.path.join(package_directory, package_file_name)
            if os.path.isfile(file_path):
                return None, package_directory, ('', '', PKG_DIRECTORY)
        with warnings.catch_warnings():
            warnings.simplefilter('ignore')
            for suffix, mode, type_ in get_suffixes():
                file_name = name + suffix
                file_path = os.path.join(entry, file_name)
                if os.path.isfile(file_path):
                    break
            else:
                continue
            break  # Break out of outer loop when breaking out of inner loop.
    else:
        raise ImportError(_bootstrap._ERR_MSG.format(name), name=name)

    encoding = None
    if mode == 'U':
        with open(file_path, 'rb') as file:
            encoding = tokenize.detect_encoding(file.readline)[0]
    file = open(file_path, mode, encoding=encoding)
    return file, file_path, (suffix, mode, type_)


_RELOADING = {}

def reload(module):
    """Reload the module and return it.

    The module must have been successfully imported before.

    """
    if not module or type(module) != type(sys):
        raise TypeError("reload() argument must be module")
    name = module.__name__
    if name not in sys.modules:
        msg = "module {} not in sys.modules"
        raise ImportError(msg.format(name), name=name)
    if name in _RELOADING:
        return _RELOADING[name]
    _RELOADING[name] = module
    try:
        parent_name = name.rpartition('.')[0]
        if parent_name and parent_name not in sys.modules:
            msg = "parent {!r} not in sys.modules"
            raise ImportError(msg.format(parent_name), name=parent_name)
        module.__loader__.load_module(name)
        # The module may have replaced itself in sys.modules!
        return sys.modules[module.__name__]
    finally:
        try:
            del _RELOADING[name]
        except KeyError:
            pass
Name
Size
Permissions
Options
__pycache__
--
drwxr-xr-x
collections
--
drwxr-xr-x
concurrent
--
drwxr-xr-x
config-3.3m
--
drwxr-xr-x
ctypes
--
drwxr-xr-x
curses
--
drwxr-xr-x
dbm
--
drwxr-xr-x
distutils
--
drwxr-xr-x
email
--
drwxr-xr-x
encodings
--
drwxr-xr-x
html
--
drwxr-xr-x
http
--
drwxr-xr-x
idlelib
--
drwxr-xr-x
importlib
--
drwxr-xr-x
json
--
drwxr-xr-x
lib-dynload
--
drwxr-xr-x
lib2to3
--
drwxr-xr-x
logging
--
drwxr-xr-x
multiprocessing
--
drwxr-xr-x
plat-linux
--
drwxr-xr-x
pydoc_data
--
drwxr-xr-x
site-packages
--
drwxr-xr-x
sqlite3
--
drwxr-xr-x
test
--
drwxr-xr-x
unittest
--
drwxr-xr-x
urllib
--
drwxr-xr-x
venv
--
drwxr-xr-x
wsgiref
--
drwxr-xr-x
xml
--
drwxr-xr-x
xmlrpc
--
drwxr-xr-x
__future__.py
4.477 KB
-rw-r--r--
__phello__.foo.py
0.063 KB
-rw-r--r--
_compat_pickle.py
4.236 KB
-rw-r--r--
_dummy_thread.py
4.657 KB
-rw-r--r--
_markupbase.py
14.256 KB
-rw-r--r--
_osx_support.py
18.413 KB
-rw-r--r--
_pyio.py
71.196 KB
-rw-r--r--
_strptime.py
21.166 KB
-rw-r--r--
_sysconfigdata.py
22.307 KB
-rw-r--r--
_threading_local.py
7.236 KB
-rw-r--r--
_weakrefset.py
5.571 KB
-rw-r--r--
abc.py
7.868 KB
-rw-r--r--
aifc.py
30.326 KB
-rw-r--r--
antigravity.py
0.464 KB
-rw-r--r--
argparse.py
86.981 KB
-rw-r--r--
ast.py
11.857 KB
-rw-r--r--
asynchat.py
11.316 KB
-rw-r--r--
asyncore.py
20.267 KB
-rw-r--r--
base64.py
13.658 KB
-rwxr-xr-x
bdb.py
21.381 KB
-rw-r--r--
binhex.py
13.387 KB
-rw-r--r--
bisect.py
2.534 KB
-rw-r--r--
bz2.py
18.04 KB
-rw-r--r--
cProfile.py
6.212 KB
-rwxr-xr-x
calendar.py
22.402 KB
-rw-r--r--
cgi.py
34.721 KB
-rwxr-xr-x
cgitb.py
11.759 KB
-rw-r--r--
chunk.py
5.251 KB
-rw-r--r--
cmd.py
14.512 KB
-rw-r--r--
code.py
9.795 KB
-rw-r--r--
codecs.py
35.113 KB
-rw-r--r--
codeop.py
5.854 KB
-rw-r--r--
colorsys.py
3.604 KB
-rw-r--r--
compileall.py
9.515 KB
-rw-r--r--
configparser.py
48.278 KB
-rw-r--r--
contextlib.py
8.911 KB
-rw-r--r--
copy.py
8.78 KB
-rw-r--r--
copyreg.py
6.456 KB
-rw-r--r--
crypt.py
1.835 KB
-rw-r--r--
csv.py
15.806 KB
-rw-r--r--
datetime.py
73.197 KB
-rw-r--r--
decimal.py
223.201 KB
-rw-r--r--
difflib.py
80.585 KB
-rw-r--r--
dis.py
9.896 KB
-rw-r--r--
doctest.py
100.521 KB
-rw-r--r--
dummy_threading.py
2.749 KB
-rw-r--r--
filecmp.py
9.372 KB
-rw-r--r--
fileinput.py
13.922 KB
-rw-r--r--
fnmatch.py
3.089 KB
-rw-r--r--
formatter.py
14.58 KB
-rw-r--r--
fractions.py
22.493 KB
-rw-r--r--
ftplib.py
39.31 KB
-rw-r--r--
functools.py
13.277 KB
-rw-r--r--
genericpath.py
3.021 KB
-rw-r--r--
getopt.py
7.313 KB
-rw-r--r--
getpass.py
5.657 KB
-rw-r--r--
gettext.py
20.153 KB
-rw-r--r--
glob.py
2.771 KB
-rw-r--r--
gzip.py
23.831 KB
-rw-r--r--
hashlib.py
6.048 KB
-rw-r--r--
heapq.py
17.575 KB
-rw-r--r--
hmac.py
4.336 KB
-rw-r--r--
imaplib.py
48.937 KB
-rw-r--r--
imghdr.py
3.445 KB
-rw-r--r--
imp.py
9.499 KB
-rw-r--r--
inspect.py
77.109 KB
-rw-r--r--
io.py
3.203 KB
-rw-r--r--
ipaddress.py
68.655 KB
-rw-r--r--
keyword.py
2.012 KB
-rwxr-xr-x
linecache.py
3.773 KB
-rw-r--r--
locale.py
91.03 KB
-rw-r--r--
lzma.py
17.045 KB
-rw-r--r--
macpath.py
5.485 KB
-rw-r--r--
macurl2path.py
2.668 KB
-rw-r--r--
mailbox.py
77.239 KB
-rw-r--r--
mailcap.py
7.263 KB
-rw-r--r--
mimetypes.py
20.249 KB
-rw-r--r--
modulefinder.py
22.654 KB
-rw-r--r--
netrc.py
5.612 KB
-rw-r--r--
nntplib.py
41.783 KB
-rw-r--r--
ntpath.py
19.958 KB
-rw-r--r--
nturl2path.py
2.34 KB
-rw-r--r--
numbers.py
10.154 KB
-rw-r--r--
opcode.py
4.979 KB
-rw-r--r--
optparse.py
58.932 KB
-rw-r--r--
os.py
33.964 KB
-rw-r--r--
os2emxpath.py
4.55 KB
-rw-r--r--
pdb.py
59.231 KB
-rwxr-xr-x
pickle.py
46.736 KB
-rw-r--r--
pickletools.py
79.442 KB
-rw-r--r--
pipes.py
8.707 KB
-rw-r--r--
pkgutil.py
21.034 KB
-rw-r--r--
platform.py
49.553 KB
-rwxr-xr-x
plistlib.py
14.431 KB
-rw-r--r--
poplib.py
11.105 KB
-rw-r--r--
posixpath.py
13.92 KB
-rw-r--r--
pprint.py
12.402 KB
-rw-r--r--
profile.py
20.945 KB
-rwxr-xr-x
pstats.py
25.754 KB
-rw-r--r--
pty.py
4.937 KB
-rw-r--r--
py_compile.py
6.56 KB
-rw-r--r--
pyclbr.py
13.123 KB
-rw-r--r--
pydoc.py
99.262 KB
-rwxr-xr-x
queue.py
8.628 KB
-rw-r--r--
quopri.py
7.144 KB
-rwxr-xr-x
random.py
25.059 KB
-rw-r--r--
re.py
14.622 KB
-rw-r--r--
reprlib.py
4.99 KB
-rw-r--r--
rlcompleter.py
5.396 KB
-rw-r--r--
runpy.py
10.169 KB
-rw-r--r--
sched.py
6.249 KB
-rw-r--r--
shelve.py
8.05 KB
-rw-r--r--
shlex.py
11.232 KB
-rw-r--r--
shutil.py
38.229 KB
-rw-r--r--
site.py
21.456 KB
-rw-r--r--
smtpd.py
29.499 KB
-rwxr-xr-x
smtplib.py
37.13 KB
-rwxr-xr-x
sndhdr.py
6.073 KB
-rw-r--r--
socket.py
14.563 KB
-rw-r--r--
socketserver.py
23.629 KB
-rw-r--r--
sre_compile.py
15.962 KB
-rw-r--r--
sre_constants.py
7.062 KB
-rw-r--r--
sre_parse.py
29.504 KB
-rw-r--r--
ssl.py
23.904 KB
-rw-r--r--
stat.py
4.203 KB
-rw-r--r--
string.py
9.189 KB
-rw-r--r--
stringprep.py
12.614 KB
-rw-r--r--
struct.py
0.232 KB
-rw-r--r--
subprocess.py
65.994 KB
-rw-r--r--
sunau.py
17.112 KB
-rw-r--r--
symbol.py
2.003 KB
-rwxr-xr-x
symtable.py
7.21 KB
-rw-r--r--
sysconfig.py
24.584 KB
-rw-r--r--
tabnanny.py
11.143 KB
-rwxr-xr-x
tarfile.py
86.781 KB
-rwxr-xr-x
telnetlib.py
26.708 KB
-rw-r--r--
tempfile.py
22.474 KB
-rw-r--r--
textwrap.py
16.102 KB
-rw-r--r--
this.py
0.979 KB
-rw-r--r--
threading.py
44.571 KB
-rw-r--r--
timeit.py
12.104 KB
-rwxr-xr-x
token.py
2.963 KB
-rw-r--r--
tokenize.py
24.293 KB
-rw-r--r--
trace.py
30.749 KB
-rwxr-xr-x
traceback.py
11.701 KB
-rw-r--r--
tty.py
0.858 KB
-rw-r--r--
types.py
3.093 KB
-rw-r--r--
uu.py
6.607 KB
-rwxr-xr-x
uuid.py
21.825 KB
-rw-r--r--
warnings.py
13.501 KB
-rw-r--r--
wave.py
18.144 KB
-rw-r--r--
weakref.py
11.226 KB
-rw-r--r--
webbrowser.py
22.376 KB
-rwxr-xr-x
xdrlib.py
5.255 KB
-rw-r--r--
zipfile.py
64.867 KB
-rw-r--r--