Current File : /home/mmdealscpanel/yummmdeals.com/importlib.tar
_bootstrap_external.py000064400000200634150327175300011204 0ustar00"""Core implementation of path-based import.

This module is NOT meant to be directly imported! It has been designed such
that it can be bootstrapped into Python as the implementation of import. As
such it requires the injection of specific modules and attributes in order to
work. One should use importlib as the public-facing version of this module.

"""
# IMPORTANT: Whenever making changes to this module, be sure to run a top-level
# `make regen-importlib` followed by `make` in order to get the frozen version
# of the module updated. Not doing so will result in the Makefile to fail for
# all others who don't have a ./python around to freeze the module in the early
# stages of compilation.
#

# See importlib._setup() for what is injected into the global namespace.

# When editing this code be aware that code executed at import time CANNOT
# reference any injected objects! This includes not only global code but also
# anything specified at the class level.

# Import builtin modules
import _imp
import _io
import sys
import _warnings
import marshal


_MS_WINDOWS = (sys.platform == 'win32')
if _MS_WINDOWS:
    import nt as _os
    import winreg
else:
    import posix as _os


if _MS_WINDOWS:
    path_separators = ['\\', '/']
else:
    path_separators = ['/']
# Assumption made in _path_join()
assert all(len(sep) == 1 for sep in path_separators)
path_sep = path_separators[0]
path_sep_tuple = tuple(path_separators)
path_separators = ''.join(path_separators)
_pathseps_with_colon = {f':{s}' for s in path_separators}


# Bootstrap-related code ######################################################
_CASE_INSENSITIVE_PLATFORMS_STR_KEY = 'win',
_CASE_INSENSITIVE_PLATFORMS_BYTES_KEY = 'cygwin', 'darwin'
_CASE_INSENSITIVE_PLATFORMS =  (_CASE_INSENSITIVE_PLATFORMS_BYTES_KEY
                                + _CASE_INSENSITIVE_PLATFORMS_STR_KEY)


def _make_relax_case():
    if sys.platform.startswith(_CASE_INSENSITIVE_PLATFORMS):
        if sys.platform.startswith(_CASE_INSENSITIVE_PLATFORMS_STR_KEY):
            key = 'PYTHONCASEOK'
        else:
            key = b'PYTHONCASEOK'

        def _relax_case():
            """True if filenames must be checked case-insensitively."""
            return key in _os.environ
    else:
        def _relax_case():
            """True if filenames must be checked case-insensitively."""
            return False
    return _relax_case


def _pack_uint32(x):
    """Convert a 32-bit integer to little-endian."""
    return (int(x) & 0xFFFFFFFF).to_bytes(4, 'little')


def _unpack_uint32(data):
    """Convert 4 bytes in little-endian to an integer."""
    assert len(data) == 4
    return int.from_bytes(data, 'little')

def _unpack_uint16(data):
    """Convert 2 bytes in little-endian to an integer."""
    assert len(data) == 2
    return int.from_bytes(data, 'little')


if _MS_WINDOWS:
    def _path_join(*path_parts):
        """Replacement for os.path.join()."""
        if not path_parts:
            return ""
        if len(path_parts) == 1:
            return path_parts[0]
        root = ""
        path = []
        for new_root, tail in map(_os._path_splitroot, path_parts):
            if new_root.startswith(path_sep_tuple) or new_root.endswith(path_sep_tuple):
                root = new_root.rstrip(path_separators) or root
                path = [path_sep + tail]
            elif new_root.endswith(':'):
                if root.casefold() != new_root.casefold():
                    # Drive relative paths have to be resolved by the OS, so we reset the
                    # tail but do not add a path_sep prefix.
                    root = new_root
                    path = [tail]
                else:
                    path.append(tail)
            else:
                root = new_root or root
                path.append(tail)
        path = [p.rstrip(path_separators) for p in path if p]
        if len(path) == 1 and not path[0]:
            # Avoid losing the root's trailing separator when joining with nothing
            return root + path_sep
        return root + path_sep.join(path)

else:
    def _path_join(*path_parts):
        """Replacement for os.path.join()."""
        return path_sep.join([part.rstrip(path_separators)
                              for part in path_parts if part])


def _path_split(path):
    """Replacement for os.path.split()."""
    i = max(path.rfind(p) for p in path_separators)
    if i < 0:
        return '', path
    return path[:i], path[i + 1:]


def _path_stat(path):
    """Stat the path.

    Made a separate function to make it easier to override in experiments
    (e.g. cache stat results).

    """
    return _os.stat(path)


def _path_is_mode_type(path, mode):
    """Test whether the path is the specified mode type."""
    try:
        stat_info = _path_stat(path)
    except OSError:
        return False
    return (stat_info.st_mode & 0o170000) == mode


def _path_isfile(path):
    """Replacement for os.path.isfile."""
    return _path_is_mode_type(path, 0o100000)


def _path_isdir(path):
    """Replacement for os.path.isdir."""
    if not path:
        path = _os.getcwd()
    return _path_is_mode_type(path, 0o040000)


if _MS_WINDOWS:
    def _path_isabs(path):
        """Replacement for os.path.isabs."""
        if not path:
            return False
        root = _os._path_splitroot(path)[0].replace('/', '\\')
        return len(root) > 1 and (root.startswith('\\\\') or root.endswith('\\'))

else:
    def _path_isabs(path):
        """Replacement for os.path.isabs."""
        return path.startswith(path_separators)


def _write_atomic(path, data, mode=0o666):
    """Best-effort function to write data to a path atomically.
    Be prepared to handle a FileExistsError if concurrent writing of the
    temporary file is attempted."""
    # id() is used to generate a pseudo-random filename.
    path_tmp = '{}.{}'.format(path, id(path))
    fd = _os.open(path_tmp,
                  _os.O_EXCL | _os.O_CREAT | _os.O_WRONLY, mode & 0o666)
    try:
        # We first write data to a temporary file, and then use os.replace() to
        # perform an atomic rename.
        with _io.FileIO(fd, 'wb') as file:
            file.write(data)
        _os.replace(path_tmp, path)
    except OSError:
        try:
            _os.unlink(path_tmp)
        except OSError:
            pass
        raise


_code_type = type(_write_atomic.__code__)


# Finder/loader utility code ###############################################

# Magic word to reject .pyc files generated by other Python versions.
# It should change for each incompatible change to the bytecode.
#
# The value of CR and LF is incorporated so if you ever read or write
# a .pyc file in text mode the magic number will be wrong; also, the
# Apple MPW compiler swaps their values, botching string constants.
#
# There were a variety of old schemes for setting the magic number.
# The current working scheme is to increment the previous value by
# 10.
#
# Starting with the adoption of PEP 3147 in Python 3.2, every bump in magic
# number also includes a new "magic tag", i.e. a human readable string used
# to represent the magic number in __pycache__ directories.  When you change
# the magic number, you must also set a new unique magic tag.  Generally this
# can be named after the Python major version of the magic number bump, but
# it can really be anything, as long as it's different than anything else
# that's come before.  The tags are included in the following table, starting
# with Python 3.2a0.
#
# Known values:
#  Python 1.5:   20121
#  Python 1.5.1: 20121
#     Python 1.5.2: 20121
#     Python 1.6:   50428
#     Python 2.0:   50823
#     Python 2.0.1: 50823
#     Python 2.1:   60202
#     Python 2.1.1: 60202
#     Python 2.1.2: 60202
#     Python 2.2:   60717
#     Python 2.3a0: 62011
#     Python 2.3a0: 62021
#     Python 2.3a0: 62011 (!)
#     Python 2.4a0: 62041
#     Python 2.4a3: 62051
#     Python 2.4b1: 62061
#     Python 2.5a0: 62071
#     Python 2.5a0: 62081 (ast-branch)
#     Python 2.5a0: 62091 (with)
#     Python 2.5a0: 62092 (changed WITH_CLEANUP opcode)
#     Python 2.5b3: 62101 (fix wrong code: for x, in ...)
#     Python 2.5b3: 62111 (fix wrong code: x += yield)
#     Python 2.5c1: 62121 (fix wrong lnotab with for loops and
#                          storing constants that should have been removed)
#     Python 2.5c2: 62131 (fix wrong code: for x, in ... in listcomp/genexp)
#     Python 2.6a0: 62151 (peephole optimizations and STORE_MAP opcode)
#     Python 2.6a1: 62161 (WITH_CLEANUP optimization)
#     Python 2.7a0: 62171 (optimize list comprehensions/change LIST_APPEND)
#     Python 2.7a0: 62181 (optimize conditional branches:
#                          introduce POP_JUMP_IF_FALSE and POP_JUMP_IF_TRUE)
#     Python 2.7a0  62191 (introduce SETUP_WITH)
#     Python 2.7a0  62201 (introduce BUILD_SET)
#     Python 2.7a0  62211 (introduce MAP_ADD and SET_ADD)
#     Python 3000:   3000
#                    3010 (removed UNARY_CONVERT)
#                    3020 (added BUILD_SET)
#                    3030 (added keyword-only parameters)
#                    3040 (added signature annotations)
#                    3050 (print becomes a function)
#                    3060 (PEP 3115 metaclass syntax)
#                    3061 (string literals become unicode)
#                    3071 (PEP 3109 raise changes)
#                    3081 (PEP 3137 make __file__ and __name__ unicode)
#                    3091 (kill str8 interning)
#                    3101 (merge from 2.6a0, see 62151)
#                    3103 (__file__ points to source file)
#     Python 3.0a4: 3111 (WITH_CLEANUP optimization).
#     Python 3.0b1: 3131 (lexical exception stacking, including POP_EXCEPT
                          #3021)
#     Python 3.1a1: 3141 (optimize list, set and dict comprehensions:
#                         change LIST_APPEND and SET_ADD, add MAP_ADD #2183)
#     Python 3.1a1: 3151 (optimize conditional branches:
#                         introduce POP_JUMP_IF_FALSE and POP_JUMP_IF_TRUE
                          #4715)
#     Python 3.2a1: 3160 (add SETUP_WITH #6101)
#                   tag: cpython-32
#     Python 3.2a2: 3170 (add DUP_TOP_TWO, remove DUP_TOPX and ROT_FOUR #9225)
#                   tag: cpython-32
#     Python 3.2a3  3180 (add DELETE_DEREF #4617)
#     Python 3.3a1  3190 (__class__ super closure changed)
#     Python 3.3a1  3200 (PEP 3155 __qualname__ added #13448)
#     Python 3.3a1  3210 (added size modulo 2**32 to the pyc header #13645)
#     Python 3.3a2  3220 (changed PEP 380 implementation #14230)
#     Python 3.3a4  3230 (revert changes to implicit __class__ closure #14857)
#     Python 3.4a1  3250 (evaluate positional default arguments before
#                        keyword-only defaults #16967)
#     Python 3.4a1  3260 (add LOAD_CLASSDEREF; allow locals of class to override
#                        free vars #17853)
#     Python 3.4a1  3270 (various tweaks to the __class__ closure #12370)
#     Python 3.4a1  3280 (remove implicit class argument)
#     Python 3.4a4  3290 (changes to __qualname__ computation #19301)
#     Python 3.4a4  3300 (more changes to __qualname__ computation #19301)
#     Python 3.4rc2 3310 (alter __qualname__ computation #20625)
#     Python 3.5a1  3320 (PEP 465: Matrix multiplication operator #21176)
#     Python 3.5b1  3330 (PEP 448: Additional Unpacking Generalizations #2292)
#     Python 3.5b2  3340 (fix dictionary display evaluation order #11205)
#     Python 3.5b3  3350 (add GET_YIELD_FROM_ITER opcode #24400)
#     Python 3.5.2  3351 (fix BUILD_MAP_UNPACK_WITH_CALL opcode #27286)
#     Python 3.6a0  3360 (add FORMAT_VALUE opcode #25483)
#     Python 3.6a1  3361 (lineno delta of code.co_lnotab becomes signed #26107)
#     Python 3.6a2  3370 (16 bit wordcode #26647)
#     Python 3.6a2  3371 (add BUILD_CONST_KEY_MAP opcode #27140)
#     Python 3.6a2  3372 (MAKE_FUNCTION simplification, remove MAKE_CLOSURE
#                         #27095)
#     Python 3.6b1  3373 (add BUILD_STRING opcode #27078)
#     Python 3.6b1  3375 (add SETUP_ANNOTATIONS and STORE_ANNOTATION opcodes
#                         #27985)
#     Python 3.6b1  3376 (simplify CALL_FUNCTIONs & BUILD_MAP_UNPACK_WITH_CALL
                          #27213)
#     Python 3.6b1  3377 (set __class__ cell from type.__new__ #23722)
#     Python 3.6b2  3378 (add BUILD_TUPLE_UNPACK_WITH_CALL #28257)
#     Python 3.6rc1 3379 (more thorough __class__ validation #23722)
#     Python 3.7a1  3390 (add LOAD_METHOD and CALL_METHOD opcodes #26110)
#     Python 3.7a2  3391 (update GET_AITER #31709)
#     Python 3.7a4  3392 (PEP 552: Deterministic pycs #31650)
#     Python 3.7b1  3393 (remove STORE_ANNOTATION opcode #32550)
#     Python 3.7b5  3394 (restored docstring as the first stmt in the body;
#                         this might affected the first line number #32911)
#     Python 3.8a1  3400 (move frame block handling to compiler #17611)
#     Python 3.8a1  3401 (add END_ASYNC_FOR #33041)
#     Python 3.8a1  3410 (PEP570 Python Positional-Only Parameters #36540)
#     Python 3.8b2  3411 (Reverse evaluation order of key: value in dict
#                         comprehensions #35224)
#     Python 3.8b2  3412 (Swap the position of positional args and positional
#                         only args in ast.arguments #37593)
#     Python 3.8b4  3413 (Fix "break" and "continue" in "finally" #37830)
#
# MAGIC must change whenever the bytecode emitted by the compiler may no
# longer be understood by older implementations of the eval loop (usually
# due to the addition of new opcodes).
#
# Whenever MAGIC_NUMBER is changed, the ranges in the magic_values array
# in PC/launcher.c must also be updated.

MAGIC_NUMBER = (3413).to_bytes(2, 'little') + b'\r\n'
_RAW_MAGIC_NUMBER = int.from_bytes(MAGIC_NUMBER, 'little')  # For import.c

_PYCACHE = '__pycache__'
_OPT = 'opt-'

SOURCE_SUFFIXES = ['.py']  # _setup() adds .pyw as needed.

BYTECODE_SUFFIXES = ['.pyc']
# Deprecated.
DEBUG_BYTECODE_SUFFIXES = OPTIMIZED_BYTECODE_SUFFIXES = BYTECODE_SUFFIXES

def cache_from_source(path, debug_override=None, *, optimization=None):
    """Given the path to a .py file, return the path to its .pyc file.

    The .py file does not need to exist; this simply returns the path to the
    .pyc file calculated as if the .py file were imported.

    The 'optimization' parameter controls the presumed optimization level of
    the bytecode file. If 'optimization' is not None, the string representation
    of the argument is taken and verified to be alphanumeric (else ValueError
    is raised).

    The debug_override parameter is deprecated. If debug_override is not None,
    a True value is the same as setting 'optimization' to the empty string
    while a False value is equivalent to setting 'optimization' to '1'.

    If sys.implementation.cache_tag is None then NotImplementedError is raised.

    """
    if debug_override is not None:
        _warnings.warn('the debug_override parameter is deprecated; use '
                       "'optimization' instead", DeprecationWarning)
        if optimization is not None:
            message = 'debug_override or optimization must be set to None'
            raise TypeError(message)
        optimization = '' if debug_override else 1
    path = _os.fspath(path)
    head, tail = _path_split(path)
    base, sep, rest = tail.rpartition('.')
    tag = sys.implementation.cache_tag
    if tag is None:
        raise NotImplementedError('sys.implementation.cache_tag is None')
    almost_filename = ''.join([(base if base else rest), sep, tag])
    if optimization is None:
        if sys.flags.optimize == 0:
            optimization = ''
        else:
            optimization = sys.flags.optimize
    optimization = str(optimization)
    if optimization != '':
        if not optimization.isalnum():
            raise ValueError('{!r} is not alphanumeric'.format(optimization))
        almost_filename = '{}.{}{}'.format(almost_filename, _OPT, optimization)
    filename = almost_filename + BYTECODE_SUFFIXES[0]
    if sys.pycache_prefix is not None:
        # We need an absolute path to the py file to avoid the possibility of
        # collisions within sys.pycache_prefix, if someone has two different
        # `foo/bar.py` on their system and they import both of them using the
        # same sys.pycache_prefix. Let's say sys.pycache_prefix is
        # `C:\Bytecode`; the idea here is that if we get `Foo\Bar`, we first
        # make it absolute (`C:\Somewhere\Foo\Bar`), then make it root-relative
        # (`Somewhere\Foo\Bar`), so we end up placing the bytecode file in an
        # unambiguous `C:\Bytecode\Somewhere\Foo\Bar\`.
        if not _path_isabs(head):
            head = _path_join(_os.getcwd(), head)

        # Strip initial drive from a Windows path. We know we have an absolute
        # path here, so the second part of the check rules out a POSIX path that
        # happens to contain a colon at the second character.
        if head[1] == ':' and head[0] not in path_separators:
            head = head[2:]

        # Strip initial path separator from `head` to complete the conversion
        # back to a root-relative path before joining.
        return _path_join(
            sys.pycache_prefix,
            head.lstrip(path_separators),
            filename,
        )
    return _path_join(head, _PYCACHE, filename)


def source_from_cache(path):
    """Given the path to a .pyc. file, return the path to its .py file.

    The .pyc file does not need to exist; this simply returns the path to
    the .py file calculated to correspond to the .pyc file.  If path does
    not conform to PEP 3147/488 format, ValueError will be raised. If
    sys.implementation.cache_tag is None then NotImplementedError is raised.

    """
    if sys.implementation.cache_tag is None:
        raise NotImplementedError('sys.implementation.cache_tag is None')
    path = _os.fspath(path)
    head, pycache_filename = _path_split(path)
    found_in_pycache_prefix = False
    if sys.pycache_prefix is not None:
        stripped_path = sys.pycache_prefix.rstrip(path_separators)
        if head.startswith(stripped_path + path_sep):
            head = head[len(stripped_path):]
            found_in_pycache_prefix = True
    if not found_in_pycache_prefix:
        head, pycache = _path_split(head)
        if pycache != _PYCACHE:
            raise ValueError(f'{_PYCACHE} not bottom-level directory in '
                             f'{path!r}')
    dot_count = pycache_filename.count('.')
    if dot_count not in {2, 3}:
        raise ValueError(f'expected only 2 or 3 dots in {pycache_filename!r}')
    elif dot_count == 3:
        optimization = pycache_filename.rsplit('.', 2)[-2]
        if not optimization.startswith(_OPT):
            raise ValueError("optimization portion of filename does not start "
                             f"with {_OPT!r}")
        opt_level = optimization[len(_OPT):]
        if not opt_level.isalnum():
            raise ValueError(f"optimization level {optimization!r} is not an "
                             "alphanumeric value")
    base_filename = pycache_filename.partition('.')[0]
    return _path_join(head, base_filename + SOURCE_SUFFIXES[0])


def _get_sourcefile(bytecode_path):
    """Convert a bytecode file path to a source path (if possible).

    This function exists purely for backwards-compatibility for
    PyImport_ExecCodeModuleWithFilenames() in the C API.

    """
    if len(bytecode_path) == 0:
        return None
    rest, _, extension = bytecode_path.rpartition('.')
    if not rest or extension.lower()[-3:-1] != 'py':
        return bytecode_path
    try:
        source_path = source_from_cache(bytecode_path)
    except (NotImplementedError, ValueError):
        source_path = bytecode_path[:-1]
    return source_path if _path_isfile(source_path) else bytecode_path


def _get_cached(filename):
    if filename.endswith(tuple(SOURCE_SUFFIXES)):
        try:
            return cache_from_source(filename)
        except NotImplementedError:
            pass
    elif filename.endswith(tuple(BYTECODE_SUFFIXES)):
        return filename
    else:
        return None


def _calc_mode(path):
    """Calculate the mode permissions for a bytecode file."""
    try:
        mode = _path_stat(path).st_mode
    except OSError:
        mode = 0o666
    # We always ensure write access so we can update cached files
    # later even when the source files are read-only on Windows (#6074)
    mode |= 0o200
    return mode


def _check_name(method):
    """Decorator to verify that the module being requested matches the one the
    loader can handle.

    The first argument (self) must define _name which the second argument is
    compared against. If the comparison fails then ImportError is raised.

    """
    def _check_name_wrapper(self, name=None, *args, **kwargs):
        if name is None:
            name = self.name
        elif self.name != name:
            raise ImportError('loader for %s cannot handle %s' %
                                (self.name, name), name=name)
        return method(self, name, *args, **kwargs)
    try:
        _wrap = _bootstrap._wrap
    except NameError:
        # XXX yuck
        def _wrap(new, old):
            for replace in ['__module__', '__name__', '__qualname__', '__doc__']:
                if hasattr(old, replace):
                    setattr(new, replace, getattr(old, replace))
            new.__dict__.update(old.__dict__)
    _wrap(_check_name_wrapper, method)
    return _check_name_wrapper


def _find_module_shim(self, fullname):
    """Try to find a loader for the specified module by delegating to
    self.find_loader().

    This method is deprecated in favor of finder.find_spec().

    """
    # Call find_loader(). If it returns a string (indicating this
    # is a namespace package portion), generate a warning and
    # return None.
    loader, portions = self.find_loader(fullname)
    if loader is None and len(portions):
        msg = 'Not importing directory {}: missing __init__'
        _warnings.warn(msg.format(portions[0]), ImportWarning)
    return loader


def _classify_pyc(data, name, exc_details):
    """Perform basic validity checking of a pyc header and return the flags field,
    which determines how the pyc should be further validated against the source.

    *data* is the contents of the pyc file. (Only the first 16 bytes are
    required, though.)

    *name* is the name of the module being imported. It is used for logging.

    *exc_details* is a dictionary passed to ImportError if it raised for
    improved debugging.

    ImportError is raised when the magic number is incorrect or when the flags
    field is invalid. EOFError is raised when the data is found to be truncated.

    """
    magic = data[:4]
    if magic != MAGIC_NUMBER:
        message = f'bad magic number in {name!r}: {magic!r}'
        _bootstrap._verbose_message('{}', message)
        raise ImportError(message, **exc_details)
    if len(data) < 16:
        message = f'reached EOF while reading pyc header of {name!r}'
        _bootstrap._verbose_message('{}', message)
        raise EOFError(message)
    flags = _unpack_uint32(data[4:8])
    # Only the first two flags are defined.
    if flags & ~0b11:
        message = f'invalid flags {flags!r} in {name!r}'
        raise ImportError(message, **exc_details)
    return flags


def _validate_timestamp_pyc(data, source_mtime, source_size, name,
                            exc_details):
    """Validate a pyc against the source last-modified time.

    *data* is the contents of the pyc file. (Only the first 16 bytes are
    required.)

    *source_mtime* is the last modified timestamp of the source file.

    *source_size* is None or the size of the source file in bytes.

    *name* is the name of the module being imported. It is used for logging.

    *exc_details* is a dictionary passed to ImportError if it raised for
    improved debugging.

    An ImportError is raised if the bytecode is stale.

    """
    if _unpack_uint32(data[8:12]) != (source_mtime & 0xFFFFFFFF):
        message = f'bytecode is stale for {name!r}'
        _bootstrap._verbose_message('{}', message)
        raise ImportError(message, **exc_details)
    if (source_size is not None and
        _unpack_uint32(data[12:16]) != (source_size & 0xFFFFFFFF)):
        raise ImportError(f'bytecode is stale for {name!r}', **exc_details)


def _validate_hash_pyc(data, source_hash, name, exc_details):
    """Validate a hash-based pyc by checking the real source hash against the one in
    the pyc header.

    *data* is the contents of the pyc file. (Only the first 16 bytes are
    required.)

    *source_hash* is the importlib.util.source_hash() of the source file.

    *name* is the name of the module being imported. It is used for logging.

    *exc_details* is a dictionary passed to ImportError if it raised for
    improved debugging.

    An ImportError is raised if the bytecode is stale.

    """
    if data[8:16] != source_hash:
        raise ImportError(
            f'hash in bytecode doesn\'t match hash of source {name!r}',
            **exc_details,
        )


def _compile_bytecode(data, name=None, bytecode_path=None, source_path=None):
    """Compile bytecode as found in a pyc."""
    code = marshal.loads(data)
    if isinstance(code, _code_type):
        _bootstrap._verbose_message('code object from {!r}', bytecode_path)
        if source_path is not None:
            _imp._fix_co_filename(code, source_path)
        return code
    else:
        raise ImportError('Non-code object in {!r}'.format(bytecode_path),
                          name=name, path=bytecode_path)


def _code_to_timestamp_pyc(code, mtime=0, source_size=0):
    "Produce the data for a timestamp-based pyc."
    data = bytearray(MAGIC_NUMBER)
    data.extend(_pack_uint32(0))
    data.extend(_pack_uint32(mtime))
    data.extend(_pack_uint32(source_size))
    data.extend(marshal.dumps(code))
    return data


def _code_to_hash_pyc(code, source_hash, checked=True):
    "Produce the data for a hash-based pyc."
    data = bytearray(MAGIC_NUMBER)
    flags = 0b1 | checked << 1
    data.extend(_pack_uint32(flags))
    assert len(source_hash) == 8
    data.extend(source_hash)
    data.extend(marshal.dumps(code))
    return data


def decode_source(source_bytes):
    """Decode bytes representing source code and return the string.

    Universal newline support is used in the decoding.
    """
    import tokenize  # To avoid bootstrap issues.
    source_bytes_readline = _io.BytesIO(source_bytes).readline
    encoding = tokenize.detect_encoding(source_bytes_readline)
    newline_decoder = _io.IncrementalNewlineDecoder(None, True)
    return newline_decoder.decode(source_bytes.decode(encoding[0]))


# Module specifications #######################################################

_POPULATE = object()


def spec_from_file_location(name, location=None, *, loader=None,
                            submodule_search_locations=_POPULATE):
    """Return a module spec based on a file location.

    To indicate that the module is a package, set
    submodule_search_locations to a list of directory paths.  An
    empty list is sufficient, though its not otherwise useful to the
    import system.

    The loader must take a spec as its only __init__() arg.

    """
    if location is None:
        # The caller may simply want a partially populated location-
        # oriented spec.  So we set the location to a bogus value and
        # fill in as much as we can.
        location = '<unknown>'
        if hasattr(loader, 'get_filename'):
            # ExecutionLoader
            try:
                location = loader.get_filename(name)
            except ImportError:
                pass
    else:
        location = _os.fspath(location)

    # If the location is on the filesystem, but doesn't actually exist,
    # we could return None here, indicating that the location is not
    # valid.  However, we don't have a good way of testing since an
    # indirect location (e.g. a zip file or URL) will look like a
    # non-existent file relative to the filesystem.

    spec = _bootstrap.ModuleSpec(name, loader, origin=location)
    spec._set_fileattr = True

    # Pick a loader if one wasn't provided.
    if loader is None:
        for loader_class, suffixes in _get_supported_file_loaders():
            if location.endswith(tuple(suffixes)):
                loader = loader_class(name, location)
                spec.loader = loader
                break
        else:
            return None

    # Set submodule_search_paths appropriately.
    if submodule_search_locations is _POPULATE:
        # Check the loader.
        if hasattr(loader, 'is_package'):
            try:
                is_package = loader.is_package(name)
            except ImportError:
                pass
            else:
                if is_package:
                    spec.submodule_search_locations = []
    else:
        spec.submodule_search_locations = submodule_search_locations
    if spec.submodule_search_locations == []:
        if location:
            dirname = _path_split(location)[0]
            spec.submodule_search_locations.append(dirname)

    return spec


# Loaders #####################################################################

class WindowsRegistryFinder:

    """Meta path finder for modules declared in the Windows registry."""

    REGISTRY_KEY = (
        'Software\\Python\\PythonCore\\{sys_version}'
        '\\Modules\\{fullname}')
    REGISTRY_KEY_DEBUG = (
        'Software\\Python\\PythonCore\\{sys_version}'
        '\\Modules\\{fullname}\\Debug')
    DEBUG_BUILD = False  # Changed in _setup()

    @classmethod
    def _open_registry(cls, key):
        try:
            return _winreg.OpenKey(_winreg.HKEY_CURRENT_USER, key)
        except OSError:
            return _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, key)

    @classmethod
    def _search_registry(cls, fullname):
        if cls.DEBUG_BUILD:
            registry_key = cls.REGISTRY_KEY_DEBUG
        else:
            registry_key = cls.REGISTRY_KEY
        key = registry_key.format(fullname=fullname,
                                  sys_version='%d.%d' % sys.version_info[:2])
        try:
            with cls._open_registry(key) as hkey:
                filepath = _winreg.QueryValue(hkey, '')
        except OSError:
            return None
        return filepath

    @classmethod
    def find_spec(cls, fullname, path=None, target=None):
        filepath = cls._search_registry(fullname)
        if filepath is None:
            return None
        try:
            _path_stat(filepath)
        except OSError:
            return None
        for loader, suffixes in _get_supported_file_loaders():
            if filepath.endswith(tuple(suffixes)):
                spec = _bootstrap.spec_from_loader(fullname,
                                                   loader(fullname, filepath),
                                                   origin=filepath)
                return spec

    @classmethod
    def find_module(cls, fullname, path=None):
        """Find module named in the registry.

        This method is deprecated.  Use exec_module() instead.

        """
        spec = cls.find_spec(fullname, path)
        if spec is not None:
            return spec.loader
        else:
            return None


class _LoaderBasics:

    """Base class of common code needed by both SourceLoader and
    SourcelessFileLoader."""

    def is_package(self, fullname):
        """Concrete implementation of InspectLoader.is_package by checking if
        the path returned by get_filename has a filename of '__init__.py'."""
        filename = _path_split(self.get_filename(fullname))[1]
        filename_base = filename.rsplit('.', 1)[0]
        tail_name = fullname.rpartition('.')[2]
        return filename_base == '__init__' and tail_name != '__init__'

    def create_module(self, spec):
        """Use default semantics for module creation."""

    def exec_module(self, module):
        """Execute the module."""
        code = self.get_code(module.__name__)
        if code is None:
            raise ImportError('cannot load module {!r} when get_code() '
                              'returns None'.format(module.__name__))
        _bootstrap._call_with_frames_removed(exec, code, module.__dict__)

    def load_module(self, fullname):
        """This module is deprecated."""
        return _bootstrap._load_module_shim(self, fullname)


class SourceLoader(_LoaderBasics):

    def path_mtime(self, path):
        """Optional method that returns the modification time (an int) for the
        specified path (a str).

        Raises OSError when the path cannot be handled.
        """
        raise OSError

    def path_stats(self, path):
        """Optional method returning a metadata dict for the specified
        path (a str).

        Possible keys:
        - 'mtime' (mandatory) is the numeric timestamp of last source
          code modification;
        - 'size' (optional) is the size in bytes of the source code.

        Implementing this method allows the loader to read bytecode files.
        Raises OSError when the path cannot be handled.
        """
        return {'mtime': self.path_mtime(path)}

    def _cache_bytecode(self, source_path, cache_path, data):
        """Optional method which writes data (bytes) to a file path (a str).

        Implementing this method allows for the writing of bytecode files.

        The source path is needed in order to correctly transfer permissions
        """
        # For backwards compatibility, we delegate to set_data()
        return self.set_data(cache_path, data)

    def set_data(self, path, data):
        """Optional method which writes data (bytes) to a file path (a str).

        Implementing this method allows for the writing of bytecode files.
        """


    def get_source(self, fullname):
        """Concrete implementation of InspectLoader.get_source."""
        path = self.get_filename(fullname)
        try:
            source_bytes = self.get_data(path)
        except OSError as exc:
            raise ImportError('source not available through get_data()',
                              name=fullname) from exc
        return decode_source(source_bytes)

    def source_to_code(self, data, path, *, _optimize=-1):
        """Return the code object compiled from source.

        The 'data' argument can be any object type that compile() supports.
        """
        return _bootstrap._call_with_frames_removed(compile, data, path, 'exec',
                                        dont_inherit=True, optimize=_optimize)

    def get_code(self, fullname):
        """Concrete implementation of InspectLoader.get_code.

        Reading of bytecode requires path_stats to be implemented. To write
        bytecode, set_data must also be implemented.

        """
        source_path = self.get_filename(fullname)
        source_mtime = None
        source_bytes = None
        source_hash = None
        hash_based = False
        check_source = True
        try:
            bytecode_path = cache_from_source(source_path)
        except NotImplementedError:
            bytecode_path = None
        else:
            try:
                st = self.path_stats(source_path)
            except OSError:
                pass
            else:
                source_mtime = int(st['mtime'])
                try:
                    data = self.get_data(bytecode_path)
                except OSError:
                    pass
                else:
                    exc_details = {
                        'name': fullname,
                        'path': bytecode_path,
                    }
                    try:
                        flags = _classify_pyc(data, fullname, exc_details)
                        bytes_data = memoryview(data)[16:]
                        hash_based = flags & 0b1 != 0
                        if hash_based:
                            check_source = flags & 0b10 != 0
                            if (_imp.check_hash_based_pycs != 'never' and
                                (check_source or
                                 _imp.check_hash_based_pycs == 'always')):
                                source_bytes = self.get_data(source_path)
                                source_hash = _imp.source_hash(
                                    _RAW_MAGIC_NUMBER,
                                    source_bytes,
                                )
                                _validate_hash_pyc(data, source_hash, fullname,
                                                   exc_details)
                        else:
                            _validate_timestamp_pyc(
                                data,
                                source_mtime,
                                st['size'],
                                fullname,
                                exc_details,
                            )
                    except (ImportError, EOFError):
                        pass
                    else:
                        _bootstrap._verbose_message('{} matches {}', bytecode_path,
                                                    source_path)
                        return _compile_bytecode(bytes_data, name=fullname,
                                                 bytecode_path=bytecode_path,
                                                 source_path=source_path)
        if source_bytes is None:
            source_bytes = self.get_data(source_path)
        code_object = self.source_to_code(source_bytes, source_path)
        _bootstrap._verbose_message('code object from {}', source_path)
        if (not sys.dont_write_bytecode and bytecode_path is not None and
                source_mtime is not None):
            if hash_based:
                if source_hash is None:
                    source_hash = _imp.source_hash(source_bytes)
                data = _code_to_hash_pyc(code_object, source_hash, check_source)
            else:
                data = _code_to_timestamp_pyc(code_object, source_mtime,
                                              len(source_bytes))
            try:
                self._cache_bytecode(source_path, bytecode_path, data)
            except NotImplementedError:
                pass
        return code_object


class FileLoader:

    """Base file loader class which implements the loader protocol methods that
    require file system usage."""

    def __init__(self, fullname, path):
        """Cache the module name and the path to the file found by the
        finder."""
        self.name = fullname
        self.path = path

    def __eq__(self, other):
        return (self.__class__ == other.__class__ and
                self.__dict__ == other.__dict__)

    def __hash__(self):
        return hash(self.name) ^ hash(self.path)

    @_check_name
    def load_module(self, fullname):
        """Load a module from a file.

        This method is deprecated.  Use exec_module() instead.

        """
        # The only reason for this method is for the name check.
        # Issue #14857: Avoid the zero-argument form of super so the implementation
        # of that form can be updated without breaking the frozen module
        return super(FileLoader, self).load_module(fullname)

    @_check_name
    def get_filename(self, fullname):
        """Return the path to the source file as found by the finder."""
        return self.path

    def get_data(self, path):
        """Return the data from path as raw bytes."""
        if isinstance(self, (SourceLoader, ExtensionFileLoader)):
            with _io.open_code(str(path)) as file:
                return file.read()
        else:
            with _io.FileIO(path, 'r') as file:
                return file.read()

    # ResourceReader ABC API.

    @_check_name
    def get_resource_reader(self, module):
        if self.is_package(module):
            return self
        return None

    def open_resource(self, resource):
        path = _path_join(_path_split(self.path)[0], resource)
        return _io.FileIO(path, 'r')

    def resource_path(self, resource):
        if not self.is_resource(resource):
            raise FileNotFoundError
        path = _path_join(_path_split(self.path)[0], resource)
        return path

    def is_resource(self, name):
        if path_sep in name:
            return False
        path = _path_join(_path_split(self.path)[0], name)
        return _path_isfile(path)

    def contents(self):
        return iter(_os.listdir(_path_split(self.path)[0]))


class SourceFileLoader(FileLoader, SourceLoader):

    """Concrete implementation of SourceLoader using the file system."""

    def path_stats(self, path):
        """Return the metadata for the path."""
        st = _path_stat(path)
        return {'mtime': st.st_mtime, 'size': st.st_size}

    def _cache_bytecode(self, source_path, bytecode_path, data):
        # Adapt between the two APIs
        mode = _calc_mode(source_path)
        return self.set_data(bytecode_path, data, _mode=mode)

    def set_data(self, path, data, *, _mode=0o666):
        """Write bytes data to a file."""
        parent, filename = _path_split(path)
        path_parts = []
        # Figure out what directories are missing.
        while parent and not _path_isdir(parent):
            parent, part = _path_split(parent)
            path_parts.append(part)
        # Create needed directories.
        for part in reversed(path_parts):
            parent = _path_join(parent, part)
            try:
                _os.mkdir(parent)
            except FileExistsError:
                # Probably another Python process already created the dir.
                continue
            except OSError as exc:
                # Could be a permission error, read-only filesystem: just forget
                # about writing the data.
                _bootstrap._verbose_message('could not create {!r}: {!r}',
                                            parent, exc)
                return
        try:
            _write_atomic(path, data, _mode)
            _bootstrap._verbose_message('created {!r}', path)
        except OSError as exc:
            # Same as above: just don't write the bytecode.
            _bootstrap._verbose_message('could not create {!r}: {!r}', path,
                                        exc)


class SourcelessFileLoader(FileLoader, _LoaderBasics):

    """Loader which handles sourceless file imports."""

    def get_code(self, fullname):
        path = self.get_filename(fullname)
        data = self.get_data(path)
        # Call _classify_pyc to do basic validation of the pyc but ignore the
        # result. There's no source to check against.
        exc_details = {
            'name': fullname,
            'path': path,
        }
        _classify_pyc(data, fullname, exc_details)
        return _compile_bytecode(
            memoryview(data)[16:],
            name=fullname,
            bytecode_path=path,
        )

    def get_source(self, fullname):
        """Return None as there is no source code."""
        return None


# Filled in by _setup().
EXTENSION_SUFFIXES = []


class ExtensionFileLoader(FileLoader, _LoaderBasics):

    """Loader for extension modules.

    The constructor is designed to work with FileFinder.

    """

    def __init__(self, name, path):
        self.name = name
        if not _path_isabs(path):
            try:
                path = _path_join(_os.getcwd(), path)
            except OSError:
                pass
        self.path = path

    def __eq__(self, other):
        return (self.__class__ == other.__class__ and
                self.__dict__ == other.__dict__)

    def __hash__(self):
        return hash(self.name) ^ hash(self.path)

    def create_module(self, spec):
        """Create an unitialized extension module"""
        module = _bootstrap._call_with_frames_removed(
            _imp.create_dynamic, spec)
        _bootstrap._verbose_message('extension module {!r} loaded from {!r}',
                         spec.name, self.path)
        return module

    def exec_module(self, module):
        """Initialize an extension module"""
        _bootstrap._call_with_frames_removed(_imp.exec_dynamic, module)
        _bootstrap._verbose_message('extension module {!r} executed from {!r}',
                         self.name, self.path)

    def is_package(self, fullname):
        """Return True if the extension module is a package."""
        file_name = _path_split(self.path)[1]
        return any(file_name == '__init__' + suffix
                   for suffix in EXTENSION_SUFFIXES)

    def get_code(self, fullname):
        """Return None as an extension module cannot create a code object."""
        return None

    def get_source(self, fullname):
        """Return None as extension modules have no source code."""
        return None

    @_check_name
    def get_filename(self, fullname):
        """Return the path to the source file as found by the finder."""
        return self.path


class _NamespacePath:
    """Represents a namespace package's path.  It uses the module name
    to find its parent module, and from there it looks up the parent's
    __path__.  When this changes, the module's own path is recomputed,
    using path_finder.  For top-level modules, the parent module's path
    is sys.path."""

    def __init__(self, name, path, path_finder):
        self._name = name
        self._path = path
        self._last_parent_path = tuple(self._get_parent_path())
        self._path_finder = path_finder

    def _find_parent_path_names(self):
        """Returns a tuple of (parent-module-name, parent-path-attr-name)"""
        parent, dot, me = self._name.rpartition('.')
        if dot == '':
            # This is a top-level module. sys.path contains the parent path.
            return 'sys', 'path'
        # Not a top-level module. parent-module.__path__ contains the
        #  parent path.
        return parent, '__path__'

    def _get_parent_path(self):
        parent_module_name, path_attr_name = self._find_parent_path_names()
        return getattr(sys.modules[parent_module_name], path_attr_name)

    def _recalculate(self):
        # If the parent's path has changed, recalculate _path
        parent_path = tuple(self._get_parent_path()) # Make a copy
        if parent_path != self._last_parent_path:
            spec = self._path_finder(self._name, parent_path)
            # Note that no changes are made if a loader is returned, but we
            #  do remember the new parent path
            if spec is not None and spec.loader is None:
                if spec.submodule_search_locations:
                    self._path = spec.submodule_search_locations
            self._last_parent_path = parent_path     # Save the copy
        return self._path

    def __iter__(self):
        return iter(self._recalculate())

    def __getitem__(self, index):
        return self._recalculate()[index]

    def __setitem__(self, index, path):
        self._path[index] = path

    def __len__(self):
        return len(self._recalculate())

    def __repr__(self):
        return '_NamespacePath({!r})'.format(self._path)

    def __contains__(self, item):
        return item in self._recalculate()

    def append(self, item):
        self._path.append(item)


# We use this exclusively in module_from_spec() for backward-compatibility.
class _NamespaceLoader:
    def __init__(self, name, path, path_finder):
        self._path = _NamespacePath(name, path, path_finder)

    @classmethod
    def module_repr(cls, module):
        """Return repr for the module.

        The method is deprecated.  The import machinery does the job itself.

        """
        return '<module {!r} (namespace)>'.format(module.__name__)

    def is_package(self, fullname):
        return True

    def get_source(self, fullname):
        return ''

    def get_code(self, fullname):
        return compile('', '<string>', 'exec', dont_inherit=True)

    def create_module(self, spec):
        """Use default semantics for module creation."""

    def exec_module(self, module):
        pass

    def load_module(self, fullname):
        """Load a namespace module.

        This method is deprecated.  Use exec_module() instead.

        """
        # The import system never calls this method.
        _bootstrap._verbose_message('namespace module loaded with path {!r}',
                                    self._path)
        return _bootstrap._load_module_shim(self, fullname)


# Finders #####################################################################

class PathFinder:

    """Meta path finder for sys.path and package __path__ attributes."""

    @classmethod
    def invalidate_caches(cls):
        """Call the invalidate_caches() method on all path entry finders
        stored in sys.path_importer_caches (where implemented)."""
        for name, finder in list(sys.path_importer_cache.items()):
            if finder is None:
                del sys.path_importer_cache[name]
            elif hasattr(finder, 'invalidate_caches'):
                finder.invalidate_caches()

    @classmethod
    def _path_hooks(cls, path):
        """Search sys.path_hooks for a finder for 'path'."""
        if sys.path_hooks is not None and not sys.path_hooks:
            _warnings.warn('sys.path_hooks is empty', ImportWarning)
        for hook in sys.path_hooks:
            try:
                return hook(path)
            except ImportError:
                continue
        else:
            return None

    @classmethod
    def _path_importer_cache(cls, path):
        """Get the finder for the path entry from sys.path_importer_cache.

        If the path entry is not in the cache, find the appropriate finder
        and cache it. If no finder is available, store None.

        """
        if path == '':
            try:
                path = _os.getcwd()
            except FileNotFoundError:
                # Don't cache the failure as the cwd can easily change to
                # a valid directory later on.
                return None
        try:
            finder = sys.path_importer_cache[path]
        except KeyError:
            finder = cls._path_hooks(path)
            sys.path_importer_cache[path] = finder
        return finder

    @classmethod
    def _legacy_get_spec(cls, fullname, finder):
        # This would be a good place for a DeprecationWarning if
        # we ended up going that route.
        if hasattr(finder, 'find_loader'):
            loader, portions = finder.find_loader(fullname)
        else:
            loader = finder.find_module(fullname)
            portions = []
        if loader is not None:
            return _bootstrap.spec_from_loader(fullname, loader)
        spec = _bootstrap.ModuleSpec(fullname, None)
        spec.submodule_search_locations = portions
        return spec

    @classmethod
    def _get_spec(cls, fullname, path, target=None):
        """Find the loader or namespace_path for this module/package name."""
        # If this ends up being a namespace package, namespace_path is
        #  the list of paths that will become its __path__
        namespace_path = []
        for entry in path:
            if not isinstance(entry, (str, bytes)):
                continue
            finder = cls._path_importer_cache(entry)
            if finder is not None:
                if hasattr(finder, 'find_spec'):
                    spec = finder.find_spec(fullname, target)
                else:
                    spec = cls._legacy_get_spec(fullname, finder)
                if spec is None:
                    continue
                if spec.loader is not None:
                    return spec
                portions = spec.submodule_search_locations
                if portions is None:
                    raise ImportError('spec missing loader')
                # This is possibly part of a namespace package.
                #  Remember these path entries (if any) for when we
                #  create a namespace package, and continue iterating
                #  on path.
                namespace_path.extend(portions)
        else:
            spec = _bootstrap.ModuleSpec(fullname, None)
            spec.submodule_search_locations = namespace_path
            return spec

    @classmethod
    def find_spec(cls, fullname, path=None, target=None):
        """Try to find a spec for 'fullname' on sys.path or 'path'.

        The search is based on sys.path_hooks and sys.path_importer_cache.
        """
        if path is None:
            path = sys.path
        spec = cls._get_spec(fullname, path, target)
        if spec is None:
            return None
        elif spec.loader is None:
            namespace_path = spec.submodule_search_locations
            if namespace_path:
                # We found at least one namespace path.  Return a spec which
                # can create the namespace package.
                spec.origin = None
                spec.submodule_search_locations = _NamespacePath(fullname, namespace_path, cls._get_spec)
                return spec
            else:
                return None
        else:
            return spec

    @classmethod
    def find_module(cls, fullname, path=None):
        """find the module on sys.path or 'path' based on sys.path_hooks and
        sys.path_importer_cache.

        This method is deprecated.  Use find_spec() instead.

        """
        spec = cls.find_spec(fullname, path)
        if spec is None:
            return None
        return spec.loader

    @classmethod
    def find_distributions(cls, *args, **kwargs):
        """
        Find distributions.

        Return an iterable of all Distribution instances capable of
        loading the metadata for packages matching ``context.name``
        (or all names if ``None`` indicated) along the paths in the list
        of directories ``context.path``.
        """
        from importlib.metadata import MetadataPathFinder
        return MetadataPathFinder.find_distributions(*args, **kwargs)


class FileFinder:

    """File-based finder.

    Interactions with the file system are cached for performance, being
    refreshed when the directory the finder is handling has been modified.

    """

    def __init__(self, path, *loader_details):
        """Initialize with the path to search on and a variable number of
        2-tuples containing the loader and the file suffixes the loader
        recognizes."""
        loaders = []
        for loader, suffixes in loader_details:
            loaders.extend((suffix, loader) for suffix in suffixes)
        self._loaders = loaders
        # Base (directory) path
        self.path = path or '.'
        if not _path_isabs(self.path):
            self.path = _path_join(_os.getcwd(), self.path)
        self._path_mtime = -1
        self._path_cache = set()
        self._relaxed_path_cache = set()

    def invalidate_caches(self):
        """Invalidate the directory mtime."""
        self._path_mtime = -1

    find_module = _find_module_shim

    def find_loader(self, fullname):
        """Try to find a loader for the specified module, or the namespace
        package portions. Returns (loader, list-of-portions).

        This method is deprecated.  Use find_spec() instead.

        """
        spec = self.find_spec(fullname)
        if spec is None:
            return None, []
        return spec.loader, spec.submodule_search_locations or []

    def _get_spec(self, loader_class, fullname, path, smsl, target):
        loader = loader_class(fullname, path)
        return spec_from_file_location(fullname, path, loader=loader,
                                       submodule_search_locations=smsl)

    def find_spec(self, fullname, target=None):
        """Try to find a spec for the specified module.

        Returns the matching spec, or None if not found.
        """
        is_namespace = False
        tail_module = fullname.rpartition('.')[2]
        try:
            mtime = _path_stat(self.path or _os.getcwd()).st_mtime
        except OSError:
            mtime = -1
        if mtime != self._path_mtime:
            self._fill_cache()
            self._path_mtime = mtime
        # tail_module keeps the original casing, for __file__ and friends
        if _relax_case():
            cache = self._relaxed_path_cache
            cache_module = tail_module.lower()
        else:
            cache = self._path_cache
            cache_module = tail_module
        # Check if the module is the name of a directory (and thus a package).
        if cache_module in cache:
            base_path = _path_join(self.path, tail_module)
            for suffix, loader_class in self._loaders:
                init_filename = '__init__' + suffix
                full_path = _path_join(base_path, init_filename)
                if _path_isfile(full_path):
                    return self._get_spec(loader_class, fullname, full_path, [base_path], target)
            else:
                # If a namespace package, return the path if we don't
                #  find a module in the next section.
                is_namespace = _path_isdir(base_path)
        # Check for a file w/ a proper suffix exists.
        for suffix, loader_class in self._loaders:
            try:
                full_path = _path_join(self.path, tail_module + suffix)
            except ValueError:
                return None
            _bootstrap._verbose_message('trying {}', full_path, verbosity=2)
            if cache_module + suffix in cache:
                if _path_isfile(full_path):
                    return self._get_spec(loader_class, fullname, full_path,
                                          None, target)
        if is_namespace:
            _bootstrap._verbose_message('possible namespace for {}', base_path)
            spec = _bootstrap.ModuleSpec(fullname, None)
            spec.submodule_search_locations = [base_path]
            return spec
        return None

    def _fill_cache(self):
        """Fill the cache of potential modules and packages for this directory."""
        path = self.path
        try:
            contents = _os.listdir(path or _os.getcwd())
        except (FileNotFoundError, PermissionError, NotADirectoryError):
            # Directory has either been removed, turned into a file, or made
            # unreadable.
            contents = []
        # We store two cached versions, to handle runtime changes of the
        # PYTHONCASEOK environment variable.
        if not sys.platform.startswith('win'):
            self._path_cache = set(contents)
        else:
            # Windows users can import modules with case-insensitive file
            # suffixes (for legacy reasons). Make the suffix lowercase here
            # so it's done once instead of for every import. This is safe as
            # the specified suffixes to check against are always specified in a
            # case-sensitive manner.
            lower_suffix_contents = set()
            for item in contents:
                name, dot, suffix = item.partition('.')
                if dot:
                    new_name = '{}.{}'.format(name, suffix.lower())
                else:
                    new_name = name
                lower_suffix_contents.add(new_name)
            self._path_cache = lower_suffix_contents
        if sys.platform.startswith(_CASE_INSENSITIVE_PLATFORMS):
            self._relaxed_path_cache = {fn.lower() for fn in contents}

    @classmethod
    def path_hook(cls, *loader_details):
        """A class method which returns a closure to use on sys.path_hook
        which will return an instance using the specified loaders and the path
        called on the closure.

        If the path called on the closure is not a directory, ImportError is
        raised.

        """
        def path_hook_for_FileFinder(path):
            """Path hook for importlib.machinery.FileFinder."""
            if not _path_isdir(path):
                raise ImportError('only directories are supported', path=path)
            return cls(path, *loader_details)

        return path_hook_for_FileFinder

    def __repr__(self):
        return 'FileFinder({!r})'.format(self.path)


# Import setup ###############################################################

def _fix_up_module(ns, name, pathname, cpathname=None):
    # This function is used by PyImport_ExecCodeModuleObject().
    loader = ns.get('__loader__')
    spec = ns.get('__spec__')
    if not loader:
        if spec:
            loader = spec.loader
        elif pathname == cpathname:
            loader = SourcelessFileLoader(name, pathname)
        else:
            loader = SourceFileLoader(name, pathname)
    if not spec:
        spec = spec_from_file_location(name, pathname, loader=loader)
    try:
        ns['__spec__'] = spec
        ns['__loader__'] = loader
        ns['__file__'] = pathname
        ns['__cached__'] = cpathname
    except Exception:
        # Not important enough to report.
        pass


def _get_supported_file_loaders():
    """Returns a list of file-based module loaders.

    Each item is a tuple (loader, suffixes).
    """
    extensions = ExtensionFileLoader, _alternative_architectures(_imp.extension_suffixes())
    source = SourceFileLoader, SOURCE_SUFFIXES
    bytecode = SourcelessFileLoader, BYTECODE_SUFFIXES
    return [extensions, source, bytecode]


def _setup(_bootstrap_module):
    """Setup the path-based importers for importlib by importing needed
    built-in modules and injecting them into the global namespace.

    Other components are extracted from the core bootstrap module.

    """
    global sys, _imp, _bootstrap
    _bootstrap = _bootstrap_module
    sys = _bootstrap.sys
    _imp = _bootstrap._imp

    # Directly load built-in modules needed during bootstrap.
    self_module = sys.modules[__name__]
    for builtin_name in ('_io', '_warnings', 'builtins', 'marshal'):
        if builtin_name not in sys.modules:
            builtin_module = _bootstrap._builtin_from_name(builtin_name)
        else:
            builtin_module = sys.modules[builtin_name]
        setattr(self_module, builtin_name, builtin_module)

    # Directly load the os module (needed during bootstrap).
    os_details = ('posix', ['/']), ('nt', ['\\', '/'])
    for builtin_os, path_separators in os_details:
        # Assumption made in _path_join()
        assert all(len(sep) == 1 for sep in path_separators)
        path_sep = path_separators[0]
        if builtin_os in sys.modules:
            os_module = sys.modules[builtin_os]
            break
        else:
            try:
                os_module = _bootstrap._builtin_from_name(builtin_os)
                break
            except ImportError:
                continue
    else:
        raise ImportError('importlib requires posix or nt')
    setattr(self_module, '_os', os_module)
    setattr(self_module, 'path_sep', path_sep)
    setattr(self_module, 'path_separators', ''.join(path_separators))
    setattr(self_module, '_pathseps_with_colon', {f':{s}' for s in path_separators})

    # Directly load the _thread module (needed during bootstrap).
    thread_module = _bootstrap._builtin_from_name('_thread')
    setattr(self_module, '_thread', thread_module)

    # Directly load the _weakref module (needed during bootstrap).
    weakref_module = _bootstrap._builtin_from_name('_weakref')
    setattr(self_module, '_weakref', weakref_module)

    # Directly load the winreg module (needed during bootstrap).
    if builtin_os == 'nt':
        winreg_module = _bootstrap._builtin_from_name('winreg')
        setattr(self_module, '_winreg', winreg_module)

    # Constants
    setattr(self_module, '_relax_case', _make_relax_case())
    EXTENSION_SUFFIXES.extend(_alternative_architectures(_imp.extension_suffixes()))
    if builtin_os == 'nt':
        SOURCE_SUFFIXES.append('.pyw')
        if '_d.pyd' in EXTENSION_SUFFIXES:
            WindowsRegistryFinder.DEBUG_BUILD = True


def _install(_bootstrap_module):
    """Install the path-based import components."""
    _setup(_bootstrap_module)
    supported_loaders = _get_supported_file_loaders()
    sys.path_hooks.extend([FileFinder.path_hook(*supported_loaders)])
    sys.meta_path.append(PathFinder)


_ARCH_MAP = {
    "-arm-linux-gnueabi.": "-arm-linux-gnueabihf.",
    "-armeb-linux-gnueabi.": "-armeb-linux-gnueabihf.",
    "-mips64-linux-gnu.": "-mips64-linux-gnuabi64.",
    "-mips64el-linux-gnu.": "-mips64el-linux-gnuabi64.",
    "-ppc-linux-gnu.": "-powerpc-linux-gnu.",
    "-ppc-linux-gnuspe.": "-powerpc-linux-gnuspe.",
    "-ppc64-linux-gnu.": "-powerpc64-linux-gnu.",
    "-ppc64le-linux-gnu.": "-powerpc64le-linux-gnu.",
    # The above, but the other way around:
    "-arm-linux-gnueabihf.": "-arm-linux-gnueabi.",
    "-armeb-linux-gnueabihf.": "-armeb-linux-gnueabi.",
    "-mips64-linux-gnuabi64.": "-mips64-linux-gnu.",
    "-mips64el-linux-gnuabi64.": "-mips64el-linux-gnu.",
    "-powerpc-linux-gnu.": "-ppc-linux-gnu.",
    "-powerpc-linux-gnuspe.": "-ppc-linux-gnuspe.",
    "-powerpc64-linux-gnu.": "-ppc64-linux-gnu.",
    "-powerpc64le-linux-gnu.": "-ppc64le-linux-gnu.",
}


def _alternative_architectures(suffixes):
    """Add a suffix with an alternative architecture name
    to the list of suffixes so an extension built with
    the default (upstream) setting is loadable with our Pythons
    """

    for suffix in suffixes:
        for original, alternative in _ARCH_MAP.items():
            if original in suffix:
                suffixes.append(suffix.replace(original, alternative))
                return suffixes

    return suffixes
__init__.py000064400000013655150327175300006672 0ustar00"""A pure Python implementation of import."""
__all__ = ['__import__', 'import_module', 'invalidate_caches', 'reload']

# Bootstrap help #####################################################

# Until bootstrapping is complete, DO NOT import any modules that attempt
# to import importlib._bootstrap (directly or indirectly). Since this
# partially initialised package would be present in sys.modules, those
# modules would get an uninitialised copy of the source version, instead
# of a fully initialised version (either the frozen one or the one
# initialised below if the frozen one is not available).
import _imp  # Just the builtin component, NOT the full Python module
import sys

try:
    import _frozen_importlib as _bootstrap
except ImportError:
    from . import _bootstrap
    _bootstrap._setup(sys, _imp)
else:
    # importlib._bootstrap is the built-in import, ensure we don't create
    # a second copy of the module.
    _bootstrap.__name__ = 'importlib._bootstrap'
    _bootstrap.__package__ = 'importlib'
    try:
        _bootstrap.__file__ = __file__.replace('__init__.py', '_bootstrap.py')
    except NameError:
        # __file__ is not guaranteed to be defined, e.g. if this code gets
        # frozen by a tool like cx_Freeze.
        pass
    sys.modules['importlib._bootstrap'] = _bootstrap

try:
    import _frozen_importlib_external as _bootstrap_external
except ImportError:
    from . import _bootstrap_external
    _bootstrap_external._setup(_bootstrap)
    _bootstrap._bootstrap_external = _bootstrap_external
else:
    _bootstrap_external.__name__ = 'importlib._bootstrap_external'
    _bootstrap_external.__package__ = 'importlib'
    try:
        _bootstrap_external.__file__ = __file__.replace('__init__.py', '_bootstrap_external.py')
    except NameError:
        # __file__ is not guaranteed to be defined, e.g. if this code gets
        # frozen by a tool like cx_Freeze.
        pass
    sys.modules['importlib._bootstrap_external'] = _bootstrap_external

# To simplify imports in test code
_pack_uint32 = _bootstrap_external._pack_uint32
_unpack_uint32 = _bootstrap_external._unpack_uint32

# Fully bootstrapped at this point, import whatever you like, circular
# dependencies and startup overhead minimisation permitting :)

import types
import warnings


# Public API #########################################################

from ._bootstrap import __import__


def invalidate_caches():
    """Call the invalidate_caches() method on all meta path finders stored in
    sys.meta_path (where implemented)."""
    for finder in sys.meta_path:
        if hasattr(finder, 'invalidate_caches'):
            finder.invalidate_caches()


def find_loader(name, path=None):
    """Return the loader for the specified module.

    This is a backward-compatible wrapper around find_spec().

    This function is deprecated in favor of importlib.util.find_spec().

    """
    warnings.warn('Deprecated since Python 3.4. '
                  'Use importlib.util.find_spec() instead.',
                  DeprecationWarning, stacklevel=2)
    try:
        loader = sys.modules[name].__loader__
        if loader is None:
            raise ValueError('{}.__loader__ is None'.format(name))
        else:
            return loader
    except KeyError:
        pass
    except AttributeError:
        raise ValueError('{}.__loader__ is not set'.format(name)) from None

    spec = _bootstrap._find_spec(name, path)
    # We won't worry about malformed specs (missing attributes).
    if spec is None:
        return None
    if spec.loader is None:
        if spec.submodule_search_locations is None:
            raise ImportError('spec for {} missing loader'.format(name),
                              name=name)
        raise ImportError('namespace packages do not have loaders',
                          name=name)
    return spec.loader


def import_module(name, package=None):
    """Import a module.

    The 'package' argument is required when performing a relative import. It
    specifies the package to use as the anchor point from which to resolve the
    relative import to an absolute import.

    """
    level = 0
    if name.startswith('.'):
        if not package:
            msg = ("the 'package' argument is required to perform a relative "
                   "import for {!r}")
            raise TypeError(msg.format(name))
        for character in name:
            if character != '.':
                break
            level += 1
    return _bootstrap._gcd_import(name[level:], package, level)


_RELOADING = {}


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

    The module must have been successfully imported before.

    """
    if not module or not isinstance(module, types.ModuleType):
        raise TypeError("reload() argument must be a module")
    try:
        name = module.__spec__.name
    except AttributeError:
        name = module.__name__

    if sys.modules.get(name) is not module:
        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:
            try:
                parent = sys.modules[parent_name]
            except KeyError:
                msg = "parent {!r} not in sys.modules"
                raise ImportError(msg.format(parent_name),
                                  name=parent_name) from None
            else:
                pkgpath = parent.__path__
        else:
            pkgpath = None
        target = module
        spec = module.__spec__ = _bootstrap._find_spec(name, pkgpath, target)
        if spec is None:
            raise ModuleNotFoundError(f"spec not found for the module {name!r}", name=name)
        _bootstrap._exec(spec, module)
        # The module may have replaced itself in sys.modules!
        return sys.modules[name]
    finally:
        try:
            del _RELOADING[name]
        except KeyError:
            pass
machinery.py000064400000001514150327175300007101 0ustar00"""The machinery of importlib: finders, loaders, hooks, etc."""

import _imp

from ._bootstrap import ModuleSpec
from ._bootstrap import BuiltinImporter
from ._bootstrap import FrozenImporter
from ._bootstrap_external import (SOURCE_SUFFIXES, DEBUG_BYTECODE_SUFFIXES,
                     OPTIMIZED_BYTECODE_SUFFIXES, BYTECODE_SUFFIXES,
                     EXTENSION_SUFFIXES)
from ._bootstrap_external import WindowsRegistryFinder
from ._bootstrap_external import PathFinder
from ._bootstrap_external import FileFinder
from ._bootstrap_external import SourceFileLoader
from ._bootstrap_external import SourcelessFileLoader
from ._bootstrap_external import ExtensionFileLoader


def all_suffixes():
    """Returns a list of all recognized module suffixes for this process"""
    return SOURCE_SUFFIXES + BYTECODE_SUFFIXES + EXTENSION_SUFFIXES
abc.py000064400000031111150327175300005643 0ustar00"""Abstract base classes related to import."""
from . import _bootstrap
from . import _bootstrap_external
from . import machinery
try:
    import _frozen_importlib
except ImportError as exc:
    if exc.name != '_frozen_importlib':
        raise
    _frozen_importlib = None
try:
    import _frozen_importlib_external
except ImportError as exc:
    _frozen_importlib_external = _bootstrap_external
import abc
import warnings


def _register(abstract_cls, *classes):
    for cls in classes:
        abstract_cls.register(cls)
        if _frozen_importlib is not None:
            try:
                frozen_cls = getattr(_frozen_importlib, cls.__name__)
            except AttributeError:
                frozen_cls = getattr(_frozen_importlib_external, cls.__name__)
            abstract_cls.register(frozen_cls)


class Finder(metaclass=abc.ABCMeta):

    """Legacy abstract base class for import finders.

    It may be subclassed for compatibility with legacy third party
    reimplementations of the import system.  Otherwise, finder
    implementations should derive from the more specific MetaPathFinder
    or PathEntryFinder ABCs.

    Deprecated since Python 3.3
    """

    @abc.abstractmethod
    def find_module(self, fullname, path=None):
        """An abstract method that should find a module.
        The fullname is a str and the optional path is a str or None.
        Returns a Loader object or None.
        """


class MetaPathFinder(Finder):

    """Abstract base class for import finders on sys.meta_path."""

    # We don't define find_spec() here since that would break
    # hasattr checks we do to support backward compatibility.

    def find_module(self, fullname, path):
        """Return a loader for the module.

        If no module is found, return None.  The fullname is a str and
        the path is a list of strings or None.

        This method is deprecated since Python 3.4 in favor of
        finder.find_spec(). If find_spec() exists then backwards-compatible
        functionality is provided for this method.

        """
        warnings.warn("MetaPathFinder.find_module() is deprecated since Python "
                      "3.4 in favor of MetaPathFinder.find_spec() "
                      "(available since 3.4)",
                      DeprecationWarning,
                      stacklevel=2)
        if not hasattr(self, 'find_spec'):
            return None
        found = self.find_spec(fullname, path)
        return found.loader if found is not None else None

    def invalidate_caches(self):
        """An optional method for clearing the finder's cache, if any.
        This method is used by importlib.invalidate_caches().
        """

_register(MetaPathFinder, machinery.BuiltinImporter, machinery.FrozenImporter,
          machinery.PathFinder, machinery.WindowsRegistryFinder)


class PathEntryFinder(Finder):

    """Abstract base class for path entry finders used by PathFinder."""

    # We don't define find_spec() here since that would break
    # hasattr checks we do to support backward compatibility.

    def find_loader(self, fullname):
        """Return (loader, namespace portion) for the path entry.

        The fullname is a str.  The namespace portion is a sequence of
        path entries contributing to part of a namespace package. The
        sequence may be empty.  If loader is not None, the portion will
        be ignored.

        The portion will be discarded if another path entry finder
        locates the module as a normal module or package.

        This method is deprecated since Python 3.4 in favor of
        finder.find_spec(). If find_spec() is provided than backwards-compatible
        functionality is provided.
        """
        warnings.warn("PathEntryFinder.find_loader() is deprecated since Python "
                      "3.4 in favor of PathEntryFinder.find_spec() "
                      "(available since 3.4)",
                      DeprecationWarning,
                      stacklevel=2)
        if not hasattr(self, 'find_spec'):
            return None, []
        found = self.find_spec(fullname)
        if found is not None:
            if not found.submodule_search_locations:
                portions = []
            else:
                portions = found.submodule_search_locations
            return found.loader, portions
        else:
            return None, []

    find_module = _bootstrap_external._find_module_shim

    def invalidate_caches(self):
        """An optional method for clearing the finder's cache, if any.
        This method is used by PathFinder.invalidate_caches().
        """

_register(PathEntryFinder, machinery.FileFinder)


class Loader(metaclass=abc.ABCMeta):

    """Abstract base class for import loaders."""

    def create_module(self, spec):
        """Return a module to initialize and into which to load.

        This method should raise ImportError if anything prevents it
        from creating a new module.  It may return None to indicate
        that the spec should create the new module.
        """
        # By default, defer to default semantics for the new module.
        return None

    # We don't define exec_module() here since that would break
    # hasattr checks we do to support backward compatibility.

    def load_module(self, fullname):
        """Return the loaded module.

        The module must be added to sys.modules and have import-related
        attributes set properly.  The fullname is a str.

        ImportError is raised on failure.

        This method is deprecated in favor of loader.exec_module(). If
        exec_module() exists then it is used to provide a backwards-compatible
        functionality for this method.

        """
        if not hasattr(self, 'exec_module'):
            raise ImportError
        return _bootstrap._load_module_shim(self, fullname)

    def module_repr(self, module):
        """Return a module's repr.

        Used by the module type when the method does not raise
        NotImplementedError.

        This method is deprecated.

        """
        # The exception will cause ModuleType.__repr__ to ignore this method.
        raise NotImplementedError


class ResourceLoader(Loader):

    """Abstract base class for loaders which can return data from their
    back-end storage.

    This ABC represents one of the optional protocols specified by PEP 302.

    """

    @abc.abstractmethod
    def get_data(self, path):
        """Abstract method which when implemented should return the bytes for
        the specified path.  The path must be a str."""
        raise OSError


class InspectLoader(Loader):

    """Abstract base class for loaders which support inspection about the
    modules they can load.

    This ABC represents one of the optional protocols specified by PEP 302.

    """

    def is_package(self, fullname):
        """Optional method which when implemented should return whether the
        module is a package.  The fullname is a str.  Returns a bool.

        Raises ImportError if the module cannot be found.
        """
        raise ImportError

    def get_code(self, fullname):
        """Method which returns the code object for the module.

        The fullname is a str.  Returns a types.CodeType if possible, else
        returns None if a code object does not make sense
        (e.g. built-in module). Raises ImportError if the module cannot be
        found.
        """
        source = self.get_source(fullname)
        if source is None:
            return None
        return self.source_to_code(source)

    @abc.abstractmethod
    def get_source(self, fullname):
        """Abstract method which should return the source code for the
        module.  The fullname is a str.  Returns a str.

        Raises ImportError if the module cannot be found.
        """
        raise ImportError

    @staticmethod
    def source_to_code(data, path='<string>'):
        """Compile 'data' into a code object.

        The 'data' argument can be anything that compile() can handle. The'path'
        argument should be where the data was retrieved (when applicable)."""
        return compile(data, path, 'exec', dont_inherit=True)

    exec_module = _bootstrap_external._LoaderBasics.exec_module
    load_module = _bootstrap_external._LoaderBasics.load_module

_register(InspectLoader, machinery.BuiltinImporter, machinery.FrozenImporter)


class ExecutionLoader(InspectLoader):

    """Abstract base class for loaders that wish to support the execution of
    modules as scripts.

    This ABC represents one of the optional protocols specified in PEP 302.

    """

    @abc.abstractmethod
    def get_filename(self, fullname):
        """Abstract method which should return the value that __file__ is to be
        set to.

        Raises ImportError if the module cannot be found.
        """
        raise ImportError

    def get_code(self, fullname):
        """Method to return the code object for fullname.

        Should return None if not applicable (e.g. built-in module).
        Raise ImportError if the module cannot be found.
        """
        source = self.get_source(fullname)
        if source is None:
            return None
        try:
            path = self.get_filename(fullname)
        except ImportError:
            return self.source_to_code(source)
        else:
            return self.source_to_code(source, path)

_register(ExecutionLoader, machinery.ExtensionFileLoader)


class FileLoader(_bootstrap_external.FileLoader, ResourceLoader, ExecutionLoader):

    """Abstract base class partially implementing the ResourceLoader and
    ExecutionLoader ABCs."""

_register(FileLoader, machinery.SourceFileLoader,
            machinery.SourcelessFileLoader)


class SourceLoader(_bootstrap_external.SourceLoader, ResourceLoader, ExecutionLoader):

    """Abstract base class for loading source code (and optionally any
    corresponding bytecode).

    To support loading from source code, the abstractmethods inherited from
    ResourceLoader and ExecutionLoader need to be implemented. To also support
    loading from bytecode, the optional methods specified directly by this ABC
    is required.

    Inherited abstractmethods not implemented in this ABC:

        * ResourceLoader.get_data
        * ExecutionLoader.get_filename

    """

    def path_mtime(self, path):
        """Return the (int) modification time for the path (str)."""
        if self.path_stats.__func__ is SourceLoader.path_stats:
            raise OSError
        return int(self.path_stats(path)['mtime'])

    def path_stats(self, path):
        """Return a metadata dict for the source pointed to by the path (str).
        Possible keys:
        - 'mtime' (mandatory) is the numeric timestamp of last source
          code modification;
        - 'size' (optional) is the size in bytes of the source code.
        """
        if self.path_mtime.__func__ is SourceLoader.path_mtime:
            raise OSError
        return {'mtime': self.path_mtime(path)}

    def set_data(self, path, data):
        """Write the bytes to the path (if possible).

        Accepts a str path and data as bytes.

        Any needed intermediary directories are to be created. If for some
        reason the file cannot be written because of permissions, fail
        silently.
        """

_register(SourceLoader, machinery.SourceFileLoader)


class ResourceReader(metaclass=abc.ABCMeta):

    """Abstract base class to provide resource-reading support.

    Loaders that support resource reading are expected to implement
    the ``get_resource_reader(fullname)`` method and have it either return None
    or an object compatible with this ABC.
    """

    @abc.abstractmethod
    def open_resource(self, resource):
        """Return an opened, file-like object for binary reading.

        The 'resource' argument is expected to represent only a file name
        and thus not contain any subdirectory components.

        If the resource cannot be found, FileNotFoundError is raised.
        """
        raise FileNotFoundError

    @abc.abstractmethod
    def resource_path(self, resource):
        """Return the file system path to the specified resource.

        The 'resource' argument is expected to represent only a file name
        and thus not contain any subdirectory components.

        If the resource does not exist on the file system, raise
        FileNotFoundError.
        """
        raise FileNotFoundError

    @abc.abstractmethod
    def is_resource(self, name):
        """Return True if the named 'name' is consider a resource."""
        raise FileNotFoundError

    @abc.abstractmethod
    def contents(self):
        """Return an iterable of strings over the contents of the package."""
        return []


_register(ResourceReader, machinery.SourceFileLoader)
util.py000064400000026067150327175300006111 0ustar00"""Utility code for constructing importers, etc."""
from . import abc
from ._bootstrap import module_from_spec
from ._bootstrap import _resolve_name
from ._bootstrap import spec_from_loader
from ._bootstrap import _find_spec
from ._bootstrap_external import MAGIC_NUMBER
from ._bootstrap_external import _RAW_MAGIC_NUMBER
from ._bootstrap_external import cache_from_source
from ._bootstrap_external import decode_source
from ._bootstrap_external import source_from_cache
from ._bootstrap_external import spec_from_file_location

from contextlib import contextmanager
import _imp
import functools
import sys
import types
import warnings


def source_hash(source_bytes):
    "Return the hash of *source_bytes* as used in hash-based pyc files."
    return _imp.source_hash(_RAW_MAGIC_NUMBER, source_bytes)


def resolve_name(name, package):
    """Resolve a relative module name to an absolute one."""
    if not name.startswith('.'):
        return name
    elif not package:
        raise ValueError(f'no package specified for {repr(name)} '
                         '(required for relative module names)')
    level = 0
    for character in name:
        if character != '.':
            break
        level += 1
    return _resolve_name(name[level:], package, level)


def _find_spec_from_path(name, path=None):
    """Return the spec for the specified module.

    First, sys.modules is checked to see if the module was already imported. If
    so, then sys.modules[name].__spec__ is returned. If that happens to be
    set to None, then ValueError is raised. If the module is not in
    sys.modules, then sys.meta_path is searched for a suitable spec with the
    value of 'path' given to the finders. None is returned if no spec could
    be found.

    Dotted names do not have their parent packages implicitly imported. You will
    most likely need to explicitly import all parent packages in the proper
    order for a submodule to get the correct spec.

    """
    if name not in sys.modules:
        return _find_spec(name, path)
    else:
        module = sys.modules[name]
        if module is None:
            return None
        try:
            spec = module.__spec__
        except AttributeError:
            raise ValueError('{}.__spec__ is not set'.format(name)) from None
        else:
            if spec is None:
                raise ValueError('{}.__spec__ is None'.format(name))
            return spec


def find_spec(name, package=None):
    """Return the spec for the specified module.

    First, sys.modules is checked to see if the module was already imported. If
    so, then sys.modules[name].__spec__ is returned. If that happens to be
    set to None, then ValueError is raised. If the module is not in
    sys.modules, then sys.meta_path is searched for a suitable spec with the
    value of 'path' given to the finders. None is returned if no spec could
    be found.

    If the name is for submodule (contains a dot), the parent module is
    automatically imported.

    The name and package arguments work the same as importlib.import_module().
    In other words, relative module names (with leading dots) work.

    """
    fullname = resolve_name(name, package) if name.startswith('.') else name
    if fullname not in sys.modules:
        parent_name = fullname.rpartition('.')[0]
        if parent_name:
            parent = __import__(parent_name, fromlist=['__path__'])
            try:
                parent_path = parent.__path__
            except AttributeError as e:
                raise ModuleNotFoundError(
                    f"__path__ attribute not found on {parent_name!r} "
                    f"while trying to find {fullname!r}", name=fullname) from e
        else:
            parent_path = None
        return _find_spec(fullname, parent_path)
    else:
        module = sys.modules[fullname]
        if module is None:
            return None
        try:
            spec = module.__spec__
        except AttributeError:
            raise ValueError('{}.__spec__ is not set'.format(name)) from None
        else:
            if spec is None:
                raise ValueError('{}.__spec__ is None'.format(name))
            return spec


@contextmanager
def _module_to_load(name):
    is_reload = name in sys.modules

    module = sys.modules.get(name)
    if not is_reload:
        # This must be done before open() is called as the 'io' module
        # implicitly imports 'locale' and would otherwise trigger an
        # infinite loop.
        module = type(sys)(name)
        # This must be done before putting the module in sys.modules
        # (otherwise an optimization shortcut in import.c becomes wrong)
        module.__initializing__ = True
        sys.modules[name] = module
    try:
        yield module
    except Exception:
        if not is_reload:
            try:
                del sys.modules[name]
            except KeyError:
                pass
    finally:
        module.__initializing__ = False


def set_package(fxn):
    """Set __package__ on the returned module.

    This function is deprecated.

    """
    @functools.wraps(fxn)
    def set_package_wrapper(*args, **kwargs):
        warnings.warn('The import system now takes care of this automatically.',
                      DeprecationWarning, stacklevel=2)
        module = fxn(*args, **kwargs)
        if getattr(module, '__package__', None) is None:
            module.__package__ = module.__name__
            if not hasattr(module, '__path__'):
                module.__package__ = module.__package__.rpartition('.')[0]
        return module
    return set_package_wrapper


def set_loader(fxn):
    """Set __loader__ on the returned module.

    This function is deprecated.

    """
    @functools.wraps(fxn)
    def set_loader_wrapper(self, *args, **kwargs):
        warnings.warn('The import system now takes care of this automatically.',
                      DeprecationWarning, stacklevel=2)
        module = fxn(self, *args, **kwargs)
        if getattr(module, '__loader__', None) is None:
            module.__loader__ = self
        return module
    return set_loader_wrapper


def module_for_loader(fxn):
    """Decorator to handle selecting the proper module for loaders.

    The decorated function is passed the module to use instead of the module
    name. The module passed in to the function is either from sys.modules if
    it already exists or is a new module. If the module is new, then __name__
    is set the first argument to the method, __loader__ is set to self, and
    __package__ is set accordingly (if self.is_package() is defined) will be set
    before it is passed to the decorated function (if self.is_package() does
    not work for the module it will be set post-load).

    If an exception is raised and the decorator created the module it is
    subsequently removed from sys.modules.

    The decorator assumes that the decorated function takes the module name as
    the second argument.

    """
    warnings.warn('The import system now takes care of this automatically.',
                  DeprecationWarning, stacklevel=2)
    @functools.wraps(fxn)
    def module_for_loader_wrapper(self, fullname, *args, **kwargs):
        with _module_to_load(fullname) as module:
            module.__loader__ = self
            try:
                is_package = self.is_package(fullname)
            except (ImportError, AttributeError):
                pass
            else:
                if is_package:
                    module.__package__ = fullname
                else:
                    module.__package__ = fullname.rpartition('.')[0]
            # If __package__ was not set above, __import__() will do it later.
            return fxn(self, module, *args, **kwargs)

    return module_for_loader_wrapper


class _LazyModule(types.ModuleType):

    """A subclass of the module type which triggers loading upon attribute access."""

    def __getattribute__(self, attr):
        """Trigger the load of the module and return the attribute."""
        # All module metadata must be garnered from __spec__ in order to avoid
        # using mutated values.
        # Stop triggering this method.
        self.__class__ = types.ModuleType
        # Get the original name to make sure no object substitution occurred
        # in sys.modules.
        original_name = self.__spec__.name
        # Figure out exactly what attributes were mutated between the creation
        # of the module and now.
        attrs_then = self.__spec__.loader_state['__dict__']
        original_type = self.__spec__.loader_state['__class__']
        attrs_now = self.__dict__
        attrs_updated = {}
        for key, value in attrs_now.items():
            # Code that set the attribute may have kept a reference to the
            # assigned object, making identity more important than equality.
            if key not in attrs_then:
                attrs_updated[key] = value
            elif id(attrs_now[key]) != id(attrs_then[key]):
                attrs_updated[key] = value
        self.__spec__.loader.exec_module(self)
        # If exec_module() was used directly there is no guarantee the module
        # object was put into sys.modules.
        if original_name in sys.modules:
            if id(self) != id(sys.modules[original_name]):
                raise ValueError(f"module object for {original_name!r} "
                                  "substituted in sys.modules during a lazy "
                                  "load")
        # Update after loading since that's what would happen in an eager
        # loading situation.
        self.__dict__.update(attrs_updated)
        return getattr(self, attr)

    def __delattr__(self, attr):
        """Trigger the load and then perform the deletion."""
        # To trigger the load and raise an exception if the attribute
        # doesn't exist.
        self.__getattribute__(attr)
        delattr(self, attr)


class LazyLoader(abc.Loader):

    """A loader that creates a module which defers loading until attribute access."""

    @staticmethod
    def __check_eager_loader(loader):
        if not hasattr(loader, 'exec_module'):
            raise TypeError('loader must define exec_module()')

    @classmethod
    def factory(cls, loader):
        """Construct a callable which returns the eager loader made lazy."""
        cls.__check_eager_loader(loader)
        return lambda *args, **kwargs: cls(loader(*args, **kwargs))

    def __init__(self, loader):
        self.__check_eager_loader(loader)
        self.loader = loader

    def create_module(self, spec):
        return self.loader.create_module(spec)

    def exec_module(self, module):
        """Make the module load lazily."""
        module.__spec__.loader = self.loader
        module.__loader__ = self.loader
        # Don't need to worry about deep-copying as trying to set an attribute
        # on an object would have triggered the load,
        # e.g. ``module.__spec__.loader = None`` would trigger a load from
        # trying to access module.__spec__.
        loader_state = {}
        loader_state['__dict__'] = module.__dict__.copy()
        loader_state['__class__'] = module.__class__
        module.__spec__.loader_state = loader_state
        module.__class__ = _LazyModule
__pycache__/abc.cpython-36.pyc000064400000026037150327175300012142 0ustar003


 \*�"@s�dZddlmZddlmZddlmZyddlZWn2ek
rfZzejdkrR�dZWYddZ[XnXyddl	Z	Wn&ek
r�Zz
eZ	WYddZ[XnXddl
Z
dd	�ZGd
d�de
jd�Z
Gd
d�de
�Zeeejejejej�Gdd�de
�Zeeej�Gdd�de
jd�ZGdd�de�ZGdd�de�Zeeejej�Gdd�de�Zeeej�Gdd�dejee�Zeeejej�Gdd�dejee�Zeeej�dS)z(Abstract base classes related to import.�)�
_bootstrap)�_bootstrap_external)�	machinery�N�_frozen_importlibcGs`xZ|D]R}|j|�tdk	rytt|j�}Wn tk
rLtt|j�}YnX|j|�qWdS)N)�registerr�getattr�__name__�AttributeError�_frozen_importlib_external)�abstract_cls�classes�cls�
frozen_cls�r�%/usr/lib64/python3.6/importlib/abc.py�	_registers

rc@s eZdZdZejddd��ZdS)�FinderaLegacy abstract base class for import finders.

    It may be subclassed for compatibility with legacy third party
    reimplementations of the import system.  Otherwise, finder
    implementations should derive from the more specific MetaPathFinder
    or PathEntryFinder ABCs.
    NcCsdS)z�An abstract method that should find a module.
        The fullname is a str and the optional path is a str or None.
        Returns a Loader object or None.
        Nr)�self�fullname�pathrrr�find_module'szFinder.find_module)N)r	�
__module__�__qualname__�__doc__�abc�abstractmethodrrrrrrsr)�	metaclassc@s eZdZdZdd�Zdd�ZdS)�MetaPathFinderz8Abstract base class for import finders on sys.meta_path.cCs,t|d�sdS|j||�}|dk	r(|jSdS)aNReturn a loader for the module.

        If no module is found, return None.  The fullname is a str and
        the path is a list of strings or None.

        This method is deprecated in favor of finder.find_spec(). If find_spec()
        exists then backwards-compatible functionality is provided for this
        method.

        �	find_specN)�hasattrr�loader)rrr�foundrrrr6s
zMetaPathFinder.find_modulecCsdS)z�An optional method for clearing the finder's cache, if any.
        This method is used by importlib.invalidate_caches().
        Nr)rrrr�invalidate_cachesFsz MetaPathFinder.invalidate_cachesN)r	rrrrr#rrrrr/src@s&eZdZdZdd�ZejZdd�ZdS)�PathEntryFinderz>Abstract base class for path entry finders used by PathFinder.cCsLt|d�sdgfS|j|�}|dk	r@|js0g}n|j}|j|fSdgfSdS)aCReturn (loader, namespace portion) for the path entry.

        The fullname is a str.  The namespace portion is a sequence of
        path entries contributing to part of a namespace package. The
        sequence may be empty.  If loader is not None, the portion will
        be ignored.

        The portion will be discarded if another path entry finder
        locates the module as a normal module or package.

        This method is deprecated in favor of finder.find_spec(). If find_spec()
        is provided than backwards-compatible functionality is provided.

        rN)r r�submodule_search_locationsr!)rrr"�portionsrrr�find_loaderVs


zPathEntryFinder.find_loadercCsdS)z�An optional method for clearing the finder's cache, if any.
        This method is used by PathFinder.invalidate_caches().
        Nr)rrrrr#ssz!PathEntryFinder.invalidate_cachesN)	r	rrrr'r�_find_module_shimrr#rrrrr$Osr$c@s(eZdZdZdd�Zdd�Zdd�ZdS)	�Loaderz'Abstract base class for import loaders.cCsdS)z�Return a module to initialize and into which to load.

        This method should raise ImportError if anything prevents it
        from creating a new module.  It may return None to indicate
        that the spec should create the new module.
        Nr)r�specrrr�
create_moduleszLoader.create_modulecCst|d�st�tj||�S)a�Return the loaded module.

        The module must be added to sys.modules and have import-related
        attributes set properly.  The fullname is a str.

        ImportError is raised on failure.

        This method is deprecated in favor of loader.exec_module(). If
        exec_module() exists then it is used to provide a backwards-compatible
        functionality for this method.

        �exec_module)r �ImportErrorr�_load_module_shim)rrrrr�load_module�s
zLoader.load_modulecCst�dS)z�Return a module's repr.

        Used by the module type when the method does not raise
        NotImplementedError.

        This method is deprecated.

        N)�NotImplementedError)r�modulerrr�module_repr�s
zLoader.module_reprN)r	rrrr+r/r2rrrrr){s
r)c@seZdZdZejdd��ZdS)�ResourceLoaderz�Abstract base class for loaders which can return data from their
    back-end storage.

    This ABC represents one of the optional protocols specified by PEP 302.

    cCst�dS)zwAbstract method which when implemented should return the bytes for
        the specified path.  The path must be a str.N)�IOError)rrrrr�get_data�szResourceLoader.get_dataN)r	rrrrrr5rrrrr3�sr3c@sLeZdZdZdd�Zdd�Zejdd��Ze	dd	d
��Z
ejj
Z
ejjZdS)
�
InspectLoaderz�Abstract base class for loaders which support inspection about the
    modules they can load.

    This ABC represents one of the optional protocols specified by PEP 302.

    cCst�dS)z�Optional method which when implemented should return whether the
        module is a package.  The fullname is a str.  Returns a bool.

        Raises ImportError if the module cannot be found.
        N)r-)rrrrr�
is_package�szInspectLoader.is_packagecCs |j|�}|dkrdS|j|�S)aMethod which returns the code object for the module.

        The fullname is a str.  Returns a types.CodeType if possible, else
        returns None if a code object does not make sense
        (e.g. built-in module). Raises ImportError if the module cannot be
        found.
        N)�
get_source�source_to_code)rr�sourcerrr�get_code�s
zInspectLoader.get_codecCst�dS)z�Abstract method which should return the source code for the
        module.  The fullname is a str.  Returns a str.

        Raises ImportError if the module cannot be found.
        N)r-)rrrrrr8�szInspectLoader.get_source�<string>cCst||ddd�S)z�Compile 'data' into a code object.

        The 'data' argument can be anything that compile() can handle. The'path'
        argument should be where the data was retrieved (when applicable).�execT)�dont_inherit)�compile)�datarrrrr9�szInspectLoader.source_to_codeN)r<)r	rrrr7r;rrr8�staticmethodr9r�
_LoaderBasicsr,r/rrrrr6�s
	r6c@s&eZdZdZejdd��Zdd�ZdS)�ExecutionLoaderz�Abstract base class for loaders that wish to support the execution of
    modules as scripts.

    This ABC represents one of the optional protocols specified in PEP 302.

    cCst�dS)z�Abstract method which should return the value that __file__ is to be
        set to.

        Raises ImportError if the module cannot be found.
        N)r-)rrrrr�get_filename�szExecutionLoader.get_filenamecCsP|j|�}|dkrdSy|j|�}Wntk
r>|j|�SX|j||�SdS)z�Method to return the code object for fullname.

        Should return None if not applicable (e.g. built-in module).
        Raise ImportError if the module cannot be found.
        N)r8rDr-r9)rrr:rrrrr;s
zExecutionLoader.get_codeN)r	rrrrrrDr;rrrrrC�s	rCc@seZdZdZdS)�
FileLoaderz[Abstract base class partially implementing the ResourceLoader and
    ExecutionLoader ABCs.N)r	rrrrrrrrEsrEc@s(eZdZdZdd�Zdd�Zdd�ZdS)	�SourceLoadera�Abstract base class for loading source code (and optionally any
    corresponding bytecode).

    To support loading from source code, the abstractmethods inherited from
    ResourceLoader and ExecutionLoader need to be implemented. To also support
    loading from bytecode, the optional methods specified directly by this ABC
    is required.

    Inherited abstractmethods not implemented in this ABC:

        * ResourceLoader.get_data
        * ExecutionLoader.get_filename

    cCs$|jjtjkrt�t|j|�d�S)z6Return the (int) modification time for the path (str).�mtime)�
path_stats�__func__rFr4�int)rrrrr�
path_mtime.szSourceLoader.path_mtimecCs |jjtjkrt�d|j|�iS)aReturn a metadata dict for the source pointed to by the path (str).
        Possible keys:
        - 'mtime' (mandatory) is the numeric timestamp of last source
          code modification;
        - 'size' (optional) is the size in bytes of the source code.
        rG)rKrIrFr4)rrrrrrH4szSourceLoader.path_statscCsdS)aWrite the bytes to the path (if possible).

        Accepts a str path and data as bytes.

        Any needed intermediary directories are to be created. If for some
        reason the file cannot be written because of permissions, fail
        silently.
        Nr)rrr@rrr�set_data?szSourceLoader.set_dataN)r	rrrrKrHrLrrrrrFsrF)r�rrrrr-�exc�namerrr�ABCMetarr�BuiltinImporter�FrozenImporter�
PathFinder�WindowsRegistryFinderr$�
FileFinderr)r3r6rC�ExtensionFileLoaderrE�SourceFileLoader�SourcelessFileLoaderrFrrrr�<module>s@
)/2",__pycache__/__init__.cpython-36.opt-2.pyc000064400000005553150327175300014114 0ustar003


 \��#@sfddddgZddlZddlZyddlZWn,ek
rTddlmZejee�Yn@Xde_d	e_	ye
jd
d�e_
Wnek
r�YnXeej
d<yddlZWn0ek
r�ddlmZeje�ee_YnBXd
e_d	e_	ye
jd
d�e_
Wnek
�rYnXeej
d
<ejZejZddlZddlZddlmZdd�Zddd�Zddd�ZiZdd�ZdS)�
__import__�
import_module�invalidate_caches�reload�N�)�
_bootstrapzimportlib._bootstrap�	importlibz__init__.pyz
_bootstrap.py)�_bootstrap_externalzimportlib._bootstrap_externalz_bootstrap_external.py)rcCs&x tjD]}t|d�r|j�qWdS)Nr)�sys�	meta_path�hasattrr)�finder�r�*/usr/lib64/python3.6/importlib/__init__.pyrBs
cCs�tjdtdd�y,tj|j}|dkr6tdj|���n|SWn6tk
rPYn$t	k
rrtdj|��d�YnXt
j||�}|dkr�dS|jdkr�|j
dkr�tdj|�|d��td|d��|jS)	Nz'Use importlib.util.find_spec() instead.�)�
stacklevelz{}.__loader__ is Nonez{}.__loader__ is not setzspec for {} missing loader)�namez&namespace packages do not have loaders)�warnings�warn�DeprecationWarningr
�modules�
__loader__�
ValueError�format�KeyError�AttributeErrorr�
_find_spec�loader�submodule_search_locations�ImportError)r�pathr�specrrr�find_loaderJs*



r"cCsZd}|jd�rD|s$d}t|j|���x|D]}|dkr8P|d7}q*Wtj||d�||�S)Nr�.zHthe 'package' argument is required to perform a relative import for {!r}r)�
startswith�	TypeErrorrr�_gcd_import)r�package�level�msg�	characterrrrrls

c"Cs4|st|tj�rtd��y|jj}Wntk
rB|j}YnXtj	j
|�|k	rjd}t|j|�|d��|t
krzt
|S|t
|<z�|jd�d}|r�ytj	|}Wn,tk
r�d}t|j|�|d�d�Yq�X|j}nd}|}tj|||�}|_tj||�tj	|Sy
t
|=Wntk
�r,YnXXdS)Nz"reload() argument must be a modulezmodule {} not in sys.modules)rr#rzparent {!r} not in sys.modules)�
isinstance�types�
ModuleTyper%�__spec__rr�__name__r
r�getrr�
_RELOADING�
rpartitionr�__path__rr�_exec)�modulerr)�parent_name�parent�pkgpath�targetr!rrrr�s>


)N)N)�__all__�_impr
�_frozen_importlibrr��_setupr/�__package__�__file__�replace�	NameErrorr�_frozen_importlib_externalr	�_w_long�_r_longr,rrrr"rr1rrrrr�<module>sJ




"
__pycache__/machinery.cpython-36.opt-2.pyc000064400000001454150327175300014330 0ustar003


 \L�@s�ddlZddlmZddlmZddlmZddlmZmZmZm	Z	m
Z
ddlmZddlmZdd	lm
Z
dd
lmZddlmZddlmZd
d�ZdS)�N�)�
ModuleSpec)�BuiltinImporter)�FrozenImporter)�SOURCE_SUFFIXES�DEBUG_BYTECODE_SUFFIXES�OPTIMIZED_BYTECODE_SUFFIXES�BYTECODE_SUFFIXES�EXTENSION_SUFFIXES)�WindowsRegistryFinder)�
PathFinder)�
FileFinder)�SourceFileLoader)�SourcelessFileLoader)�ExtensionFileLoadercCstttS)N)rr	r
�rr�+/usr/lib64/python3.6/importlib/machinery.py�all_suffixessr)�_imp�
_bootstraprrr�_bootstrap_externalrrrr	r
rrr
rrrrrrrr�<module>s__pycache__/_bootstrap.cpython-36.pyc000064400000070674150327175300013577 0ustar003


 \���@s�dZdadd�Zdd�ZiZiZGdd�de�ZGdd	�d	�ZGd
d�d�Z	Gdd
�d
�Z
dd�Zdd�Zdd�Z
dd�dd�Zdd�Zdd�Zdd�Zdd�ZGd d!�d!�ZGd"d#�d#�Zddd$�d%d&�Zd]d'd(�Zd)d*�d+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Zd7d8�ZGd9d:�d:�ZGd;d<�d<�ZGd=d>�d>�Z d?d@�Z!dAdB�Z"d^dCdD�Z#dEdF�Z$dGZ%e%dHZ&dIdJ�Z'e(�Z)dKdL�Z*d_dNdO�Z+d)dP�dQdR�Z,dSdT�Z-ddfdMfdUdV�Z.dWdX�Z/dYdZ�Z0d[d\�Z1dS)`aSCore implementation of import.

This module is NOT meant to be directly imported! It has been designed such
that it can be bootstrapped into Python as the implementation of import. As
such it requires the injection of specific modules and attributes in order to
work. One should use importlib as the public-facing version of this module.

NcCs<x(dD] }t||�rt||t||��qW|jj|j�dS)z/Simple substitute for functools.update_wrapper.�
__module__�__name__�__qualname__�__doc__N)rrrr)�hasattr�setattr�getattr�__dict__�update)�new�old�replace�r
�,/usr/lib64/python3.6/importlib/_bootstrap.py�_wraps

rcCstt�|�S)N)�type�sys)�namer
r
r�_new_module#src@seZdZdS)�_DeadlockErrorN)rrrr
r
r
rr0src@s8eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
�_ModuleLockz�A recursive lock implementation which is able to detect deadlocks
    (e.g. thread 1 trying to take locks A then B, and thread 2 trying to
    take locks B then A).
    cCs0tj�|_tj�|_||_d|_d|_d|_dS)N�)�_thread�
allocate_lock�lock�wakeupr�owner�count�waiters)�selfrr
r
r�__init__:s

z_ModuleLock.__init__cCs@tj�}|j}x,tj|�}|dkr&dS|j}||krdSqWdS)NFT)r�	get_identr�_blocking_on�get)r�me�tidrr
r
r�has_deadlockBs
z_ModuleLock.has_deadlockcCs�tj�}|t|<z�x�|j�`|jdks0|j|krH||_|jd7_dS|j�r\td|��|jj	d�rv|j
d7_
WdQRX|jj	�|jj�qWWdt|=XdS)z�
        Acquire the module lock.  If a potential deadlock is detected,
        a _DeadlockError is raised.
        Otherwise, the lock is always acquired and True is returned.
        r�Tzdeadlock detected by %rFN)rr r!rrrr%rr�acquirer�release)rr$r
r
rr'Ns 
z_ModuleLock.acquirec
Csztj�}|j�b|j|kr"td��|jdks0t�|jd8_|jdkrld|_|jrl|jd8_|jj	�WdQRXdS)Nzcannot release un-acquired lockrr&)
rr rr�RuntimeErrorr�AssertionErrorrrr()rr$r
r
rr(gs

z_ModuleLock.releasecCsdj|jt|��S)Nz_ModuleLock({!r}) at {})�formatr�id)rr
r
r�__repr__tsz_ModuleLock.__repr__N)	rrrrrr%r'r(r-r
r
r
rr4s
rc@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�_DummyModuleLockzVA simple _ModuleLock equivalent for Python builds without
    multi-threading support.cCs||_d|_dS)Nr)rr)rrr
r
rr|sz_DummyModuleLock.__init__cCs|jd7_dS)Nr&T)r)rr
r
rr'�sz_DummyModuleLock.acquirecCs$|jdkrtd��|jd8_dS)Nrzcannot release un-acquired lockr&)rr))rr
r
rr(�s
z_DummyModuleLock.releasecCsdj|jt|��S)Nz_DummyModuleLock({!r}) at {})r+rr,)rr
r
rr-�sz_DummyModuleLock.__repr__N)rrrrrr'r(r-r
r
r
rr.xs
r.c@s$eZdZdd�Zdd�Zdd�ZdS)�_ModuleLockManagercCs||_d|_dS)N)�_name�_lock)rrr
r
rr�sz_ModuleLockManager.__init__cCst|j�|_|jj�dS)N)�_get_module_lockr0r1r')rr
r
r�	__enter__�sz_ModuleLockManager.__enter__cOs|jj�dS)N)r1r()r�args�kwargsr
r
r�__exit__�sz_ModuleLockManager.__exit__N)rrrrr3r6r
r
r
rr/�sr/cCs�tj�zjyt|�}Wntk
r0d}YnX|dkrptdkrLt|�}nt|�}|fdd�}tj||�t|<Wdtj	�X|S)z�Get or create the module lock for a given module name.

    Acquire/release internally the global import lock to protect
    _module_locks.Nc
Ss0tj�ztj|�|krt|=Wdtj�XdS)N)�_imp�acquire_lock�
_module_locksr"�release_lock)�refrr
r
r�cb�s

z_get_module_lock.<locals>.cb)
r7r8r9�KeyErrorrr.r�_weakrefr;r:)rrr<r
r
rr2�s


r2cCs6t|�}y|j�Wntk
r(Yn
X|j�dS)z�Acquires then releases the module lock for a given module name.

    This is used to ensure a module is completely initialized, in the
    event it is being imported by another thread.
    N)r2r'rr()rrr
r
r�_lock_unlock_module�sr?cOs
|||�S)a.remove_importlib_frames in import.c will always remove sequences
    of importlib frames that end with a call to this function

    Use it instead of a normal call in places where including the importlib
    frames introduces unwanted noise into the traceback (e.g. when executing
    module code)
    r
)�fr4�kwdsr
r
r�_call_with_frames_removed�srBr&)�	verbositycGs6tjj|kr2|jd�sd|}t|j|�tjd�dS)z=Print the message to stderr if -v/PYTHONVERBOSE is turned on.�#�import z# )�fileN)rDrE)r�flags�verbose�
startswith�printr+�stderr)�messagerCr4r
r
r�_verbose_message�s
rMcs�fdd�}t|��|S)z1Decorator to verify the named module is built-in.cs&|tjkrtdj|�|d���||�S)Nz{!r} is not a built-in module)r)r�builtin_module_names�ImportErrorr+)r�fullname)�fxnr
r�_requires_builtin_wrapper�s

z4_requires_builtin.<locals>._requires_builtin_wrapper)r)rQrRr
)rQr�_requires_builtin�s
rScs�fdd�}t|��|S)z/Decorator to verify the named module is frozen.cs&tj|�stdj|�|d���||�S)Nz{!r} is not a frozen module)r)r7�	is_frozenrOr+)rrP)rQr
r�_requires_frozen_wrapper�s

z2_requires_frozen.<locals>._requires_frozen_wrapper)r)rQrUr
)rQr�_requires_frozen�s
rVcCs>t||�}|tjkr2tj|}t||�tj|St|�SdS)z�Load the specified module into sys.modules and return it.

    This method is deprecated.  Use loader.exec_module instead.

    N)�spec_from_loaderr�modules�_exec�_load)rrP�spec�moduler
r
r�_load_module_shim�s




r]c#Cs�t|dd�}t|d�r6y
|j|�Stk
r4YnXy
|j}Wntk
rTYnX|dk	rft|�Sy
|j}Wntk
r�d}YnXy
|j}Wn2tk
r�|dkr�dj	|�Sdj	||�SYnXdj	||�SdS)N�
__loader__�module_repr�?z
<module {!r}>z<module {!r} ({!r})>z<module {!r} from {!r}>)
rrr_�	Exception�__spec__�AttributeError�_module_repr_from_specr�__file__r+)r\�loaderr[r�filenamer
r
r�_module_repr
s.






rhc@s$eZdZdd�Zdd�Zdd�ZdS)�_installed_safelycCs||_|j|_dS)N)�_modulerb�_spec)rr\r
r
rr3sz_installed_safely.__init__cCsd|j_|jtj|jj<dS)NT)rk�
_initializingrjrrXr)rr
r
rr37sz_installed_safely.__enter__cGsbzR|j}tdd�|D��r@ytj|j=WqPtk
r<YqPXntd|j|j�Wdd|j_XdS)Ncss|]}|dk	VqdS)Nr
)�.0�argr
r
r�	<genexpr>Asz-_installed_safely.__exit__.<locals>.<genexpr>zimport {!r} # {!r}F)	rk�anyrrXrr=rMrfrl)rr4r[r
r
rr6>sz_installed_safely.__exit__N)rrrrr3r6r
r
r
rri1sric@sreZdZdZdddd�dd�Zdd�Zdd	�Zed
d��Zej	dd��Zed
d��Z
edd��Zej	dd��ZdS)�
ModuleSpeca�The specification for a module, used for loading.

    A module's spec is the source for information about the module.  For
    data associated with the module, including source, use the spec's
    loader.

    `name` is the absolute name of the module.  `loader` is the loader
    to use when loading the module.  `parent` is the name of the
    package the module is in.  The parent is derived from the name.

    `is_package` determines if the module is considered a package or
    not.  On modules this is reflected by the `__path__` attribute.

    `origin` is the specific location used by the loader from which to
    load the module, if that information is available.  When filename is
    set, origin will match.

    `has_location` indicates that a spec's "origin" reflects a location.
    When this is True, `__file__` attribute of the module is set.

    `cached` is the location of the cached bytecode file, if any.  It
    corresponds to the `__cached__` attribute.

    `submodule_search_locations` is the sequence of path entries to
    search when importing submodules.  If set, is_package should be
    True--and False otherwise.

    Packages are simply modules that (may) have submodules.  If a spec
    has a non-None value in `submodule_search_locations`, the import
    system will consider modules loaded from the spec as packages.

    Only finders (see importlib.abc.MetaPathFinder and
    importlib.abc.PathEntryFinder) should modify ModuleSpec instances.

    N)�origin�loader_state�
is_packagecCs6||_||_||_||_|r gnd|_d|_d|_dS)NF)rrfrrrs�submodule_search_locations�
_set_fileattr�_cached)rrrfrrrsrtr
r
rrqszModuleSpec.__init__cCsfdj|j�dj|j�g}|jdk	r4|jdj|j��|jdk	rP|jdj|j��dj|jjdj|��S)Nz	name={!r}zloader={!r}zorigin={!r}zsubmodule_search_locations={}z{}({})z, )	r+rrfrr�appendru�	__class__r�join)rr4r
r
rr-}s



zModuleSpec.__repr__cCsf|j}yF|j|jkoL|j|jkoL|j|jkoL||jkoL|j|jkoL|j|jkStk
r`dSXdS)NF)rurrfrr�cached�has_locationrc)r�other�smslr
r
r�__eq__�s
zModuleSpec.__eq__cCs:|jdkr4|jdk	r4|jr4tdkr&t�tj|j�|_|jS)N)rwrrrv�_bootstrap_external�NotImplementedError�_get_cached)rr
r
rr{�s
zModuleSpec.cachedcCs
||_dS)N)rw)rr{r
r
rr{�scCs$|jdkr|jjd�dS|jSdS)z The name of the module's parent.N�.r)rur�
rpartition)rr
r
r�parent�s
zModuleSpec.parentcCs|jS)N)rv)rr
r
rr|�szModuleSpec.has_locationcCst|�|_dS)N)�boolrv)r�valuer
r
rr|�s)rrrrrr-r�propertyr{�setterr�r|r
r
r
rrqLs#
	rq)rrrtcCs�t|d�rJtdkrt�tj}|dkr0|||d�S|r8gnd}||||d�S|dkr�t|d�r�y|j|�}Wq�tk
r�d}Yq�Xnd}t||||d�S)z5Return a module spec based on various loader methods.�get_filenameN)rf)rfrurtF)rrrt)rr�r��spec_from_file_locationrtrOrq)rrfrrrtr��searchr
r
rrW�s"

rWc5Cs8y
|j}Wntk
rYnX|dk	r,|S|j}|dkrZy
|j}Wntk
rXYnXy
|j}Wntk
r|d}YnX|dkr�|dkr�y
|j}Wq�tk
r�d}Yq�Xn|}y
|j}Wntk
r�d}YnXyt|j�}Wntk
�rd}YnXt	|||d�}|dk�r"dnd|_
||_||_|S)N)rrFT)
rbrcrr^re�_ORIGIN�
__cached__�list�__path__rqrvr{ru)r\rfrrr[r�locationr{rur
r
r�_spec_from_module�sH







r�F)�overridec;Cs�|st|dd�dkr6y|j|_Wntk
r4YnX|sJt|dd�dkr�|j}|dkr�|jdk	r�tdkrnt�tj}|j	|�}|j|_
y
||_Wntk
r�YnX|s�t|dd�dkr�y|j|_
Wntk
r�YnXy
||_Wntk
r�YnX|�st|dd�dk�rD|jdk	�rDy|j|_Wntk
�rBYnX|j�r�|�sdt|dd�dk�r�y|j|_Wntk
�r�YnX|�s�t|dd�dk�r�|jdk	�r�y|j|_Wntk
�r�YnX|S)Nrr^�__package__r�rer�)rrrrcrfrur�r��_NamespaceLoader�__new__�_pathr^r�r�rbr�r|rrrer{r�)r[r\r�rfr�r
r
r�_init_module_attrs�s\



r�cCsRd}t|jd�r|jj|�}nt|jd�r2td��|dkrDt|j�}t||�|S)z+Create a module based on the provided spec.N�
create_module�exec_modulezBloaders that define exec_module() must also define create_module())rrfr�rOrrr�)r[r\r
r
r�module_from_spec4s

r�cCsj|jdkrdn|j}|jdkrB|jdkr2dj|�Sdj||j�Sn$|jrVdj||j�Sdj|j|j�SdS)z&Return the repr to use for the module.Nr`z
<module {!r}>z<module {!r} ({!r})>z<module {!r} from {!r}>z<module {!r} ({})>)rrrrfr+r|)r[rr
r
rrdEs


rdcCs�|j}t|���tjj|�|k	r6dj|�}t||d��|jdkrj|jdkrXtd|jd��t	||dd�|St	||dd�t
|jd�s�|jj|�n|jj|�WdQRXtj|S)zFExecute the spec's specified module in an existing module's namespace.zmodule {!r} not in sys.modules)rNzmissing loaderT)r�r�)
rr/rrXr"r+rOrfrur�r�load_moduler�)r[r\r�msgr
r
rrYVs



rYcCs�|jj|j�tj|j}t|dd�dkrLy|j|_Wntk
rJYnXt|dd�dkr�y(|j|_	t
|d�s�|jjd�d|_	Wntk
r�YnXt|dd�dkr�y
||_Wntk
r�YnX|S)Nr^r�r�r�rrb)
rfr�rrrXrr^rcrr�rr�rb)r[r\r
r
r�_load_backward_compatiblens(

r�cCsv|jdk	rt|jd�st|�St|�}t|��6|jdkrT|jdkr`td|jd��n|jj|�WdQRXt	j
|jS)Nr�zmissing loader)r)rfrr�r�rirurOrr�rrX)r[r\r
r
r�_load_unlocked�s



r�c	Cst|j��
t|�SQRXdS)z�Return a new module object, loaded by the spec's loader.

    The module is not added to its parent.

    If a module is already in sys.modules, that existing module gets
    clobbered.

    N)r/rr�)r[r
r
rrZ�s	rZc@s�eZdZdZedd��Zeddd��Zeddd��Zed	d
��Z	edd��Z
eed
d���Zeedd���Z
eedd���Zee�ZdS)�BuiltinImporterz�Meta path import for built-in modules.

    All methods are either class or static methods to avoid the need to
    instantiate the class.

    cCsdj|j�S)zsReturn repr for the module.

        The method is deprecated.  The import machinery does the job itself.

        z<module {!r} (built-in)>)r+r)r\r
r
rr_�szBuiltinImporter.module_reprNcCs,|dk	rdStj|�r$t||dd�SdSdS)Nzbuilt-in)rr)r7�
is_builtinrW)�clsrP�path�targetr
r
r�	find_spec�s

zBuiltinImporter.find_speccCs|j||�}|dk	r|jSdS)z�Find the built-in module.

        If 'path' is ever specified then the search is considered a failure.

        This method is deprecated.  Use find_spec() instead.

        N)r�rf)r�rPr�r[r
r
r�find_module�s	zBuiltinImporter.find_modulecCs.|jtjkr"tdj|j�|jd��ttj|�S)zCreate a built-in modulez{!r} is not a built-in module)r)rrrNrOr+rBr7�create_builtin)rr[r
r
rr��s
zBuiltinImporter.create_modulecCsttj|�dS)zExec a built-in moduleN)rBr7�exec_builtin)rr\r
r
rr��szBuiltinImporter.exec_modulecCsdS)z9Return None as built-in modules do not have code objects.Nr
)r�rPr
r
r�get_code�szBuiltinImporter.get_codecCsdS)z8Return None as built-in modules do not have source code.Nr
)r�rPr
r
r�
get_source�szBuiltinImporter.get_sourcecCsdS)z4Return False as built-in modules are never packages.Fr
)r�rPr
r
rrt�szBuiltinImporter.is_package)NN)N)rrrr�staticmethodr_�classmethodr�r�r�r�rSr�r�rtr]r�r
r
r
rr��s	r�c@s�eZdZdZedd��Zeddd��Zeddd��Zed	d
��Z	edd��Z
ed
d��Zeedd���Z
eedd���Zeedd���ZdS)�FrozenImporterz�Meta path import for frozen modules.

    All methods are either class or static methods to avoid the need to
    instantiate the class.

    cCsdj|j�S)zsReturn repr for the module.

        The method is deprecated.  The import machinery does the job itself.

        z<module {!r} (frozen)>)r+r)�mr
r
rr_szFrozenImporter.module_reprNcCs tj|�rt||dd�SdSdS)N�frozen)rr)r7rTrW)r�rPr�r�r
r
rr�s
zFrozenImporter.find_speccCstj|�r|SdS)z]Find a frozen module.

        This method is deprecated.  Use find_spec() instead.

        N)r7rT)r�rPr�r
r
rr�szFrozenImporter.find_modulecCsdS)z*Use default semantics for module creation.Nr
)r�r[r
r
rr�szFrozenImporter.create_modulecCs@|jj}tj|�s$tdj|�|d��ttj|�}t||j	�dS)Nz{!r} is not a frozen module)r)
rbrr7rTrOr+rB�get_frozen_object�execr)r\r�coder
r
rr� s

zFrozenImporter.exec_modulecCs
t||�S)z_Load a frozen module.

        This method is deprecated.  Use exec_module() instead.

        )r])r�rPr
r
rr�)szFrozenImporter.load_modulecCs
tj|�S)z-Return the code object for the frozen module.)r7r�)r�rPr
r
rr�2szFrozenImporter.get_codecCsdS)z6Return None as frozen modules do not have source code.Nr
)r�rPr
r
rr�8szFrozenImporter.get_sourcecCs
tj|�S)z.Return True if the frozen module is a package.)r7�is_frozen_package)r�rPr
r
rrt>szFrozenImporter.is_package)NN)N)rrrrr�r_r�r�r�r�r�r�rVr�r�rtr
r
r
rr��s			r�c@s eZdZdZdd�Zdd�ZdS)�_ImportLockContextz$Context manager for the import lock.cCstj�dS)zAcquire the import lock.N)r7r8)rr
r
rr3Ksz_ImportLockContext.__enter__cCstj�dS)z<Release the import lock regardless of any raised exceptions.N)r7r:)r�exc_type�	exc_value�
exc_tracebackr
r
rr6Osz_ImportLockContext.__exit__N)rrrrr3r6r
r
r
rr�Gsr�cCs@|jd|d�}t|�|kr$td��|d}|r<dj||�S|S)z2Resolve a relative module name to an absolute one.r�r&z2attempted relative import beyond top-level packagerz{}.{})�rsplit�len�
ValueErrorr+)r�package�level�bits�baser
r
r�
_resolve_nameTs
r�cCs"|j||�}|dkrdSt||�S)N)r�rW)�finderrr�rfr
r
r�_find_spec_legacy]sr�c
Cs�tj}|dkrtd��|s&tjdt�|tjk}x�|D]�}t��Hy
|j}Wn*t	k
rvt
|||�}|dkrrw6YnX||||�}WdQRX|dk	r6|r�|tjkr�tj|}y
|j}	Wnt	k
r�|SX|	dkr�|S|	Sq6|Sq6WdSdS)zFind a module's spec.Nz5sys.meta_path is None, Python is likely shutting downzsys.meta_path is empty)r�	meta_pathrO�	_warnings�warn�
ImportWarningrXr�r�rcr�rb)
rr�r�r��	is_reloadr�r�r[r\rbr
r
r�
_find_specfs6




r�cCsnt|t�stdjt|����|dkr,td��|dkrTt|t�sHtd��n|sTtd��|rj|dkrjtd��dS)zVerify arguments are "sane".zmodule name must be str, not {}rzlevel must be >= 0z__package__ not set to a stringz6attempted relative import with no known parent packagezEmpty module nameN)�
isinstance�str�	TypeErrorr+rr�rO)rr�r�r
r
r�
_sanity_check�s


r�zNo module named z{!r}cCs�d}|jd�d}|r�|tjkr*t||�|tjkr>tj|Stj|}y
|j}Wn2tk
r�tdj||�}t||d�d�YnXt	||�}|dkr�ttj|�|d��nt
|�}|r�tj|}t||jd�d|�|S)Nr�rz; {!r} is not a package)r�)r�rrXrBr�rc�_ERR_MSGr+�ModuleNotFoundErrorr�r�r)r�import_r�r��
parent_moduler�r[r\r
r
r�_find_and_load_unlocked�s*







r�cCs^t|��&tjj|t�}|tkr*t||�SWdQRX|dkrRdj|�}t||d��t|�|S)zFind and load the module.Nz(import of {} halted; None in sys.modules)r)	r/rrXr"�_NEEDS_LOADINGr�r+r�r?)rr�r\rLr
r
r�_find_and_load�s
r�rcCs*t|||�|dkr t|||�}t|t�S)a2Import and return the module based on its name, the package the call is
    being made from, and the level adjustment.

    This function represents the greatest common denominator of functionality
    between import_module and __import__. This includes setting __package__ if
    the loader did not.

    r)r�r�r��_gcd_import)rr�r�r
r
rr��s	r�)�	recursivecCs�t|d�r�x�|D]�}t|t�sN|r.|jd}nd}td|�dt|�j����q|dkrz|r�t|d�r�t||j|dd	�qt||�sd
j|j|�}yt	||�Wqt
k
r�}z&|j|kr�tj
j|t�dk	r�w�WYdd}~XqXqW|S)z�Figure out what __import__ should return.

    The import_ parameter is a callable which takes the name of module to
    import. It is required to decouple the function from assuming importlib's
    import implementation is desired.

    r�z.__all__z
``from list''zItem in z must be str, not �*�__all__T)r�z{}.{}N)rr�r�rr�r�_handle_fromlistr�r+rBr�rrrXr"r�)r\�fromlistr�r��x�where�	from_name�excr
r
rr��s*







r�cCs�|jd�}|jd�}|dk	rR|dk	rN||jkrNtjd|�d|j�d�tdd�|S|dk	r`|jStjd	tdd�|d
}d|kr�|jd�d
}|S)z�Calculate what __package__ should be.

    __package__ is not guaranteed to be defined or could be set to None
    to represent that its proper value is unknown.

    r�rbNz __package__ != __spec__.parent (z != �)�)�
stacklevelzYcan't resolve package from __spec__ or __package__, falling back on __name__ and __path__rr�r�r)r"r�r�r�r�r�)�globalsr�r[r
r
r�_calc___package__s



r�c	Cs�|dkrt|�}n$|dk	r|ni}t|�}t|||�}|s�|dkrTt|jd�d�S|s\|St|�t|jd�d�}tj|jdt|j�|�Snt||t�SdS)a�Import a module.

    The 'globals' argument is used to infer where the import is occurring from
    to handle relative imports. The 'locals' argument is ignored. The
    'fromlist' argument specifies what should exist as attributes on the module
    being imported (e.g. ``from module import <fromlist>``).  The 'level'
    argument represents the package location to import from in a relative
    import (e.g. ``from ..pkg import mod`` would have a 'level' of 2).

    rNr�)r�r��	partitionr�rrXrr�)	rr��localsr�r�r\�globals_r��cut_offr
r
r�
__import__&s
 r�cCs&tj|�}|dkrtd|��t|�S)Nzno built-in module named )r�r�rOr�)rr[r
r
r�_builtin_from_nameIs
r�cCs�|a|att�}xVtjj�D]H\}}t||�r|tjkr>t}ntj|�rt	}nqt
||�}t||�qWtjt}x6dD].}|tjkr�t
|�}	n
tj|}	t|||	�qxWyt
d�}
Wntk
r�d}
YnXt|d|
�t
d�}t|d|�dS)z�Setup importlib by importing needed built-in modules and injecting them
    into the global namespace.

    As sys is needed for sys.modules access and _imp is needed to load built-in
    modules, those two modules must be explicitly passed in.

    r�rNr>)r�)r7rrrX�itemsr�rNr�rTr�r�r�rr�rrO)�
sys_module�_imp_module�module_typerr\rfr[�self_module�builtin_name�builtin_module�
thread_module�weakref_moduler
r
r�_setupPs2	









r�cCsBt||�tjjt�tjjt�ddl}|a|jtj	t
�dS)z2Install importlib as the implementation of import.rN)r�rr�rxr�r��_frozen_importlib_externalr��_installrXr)r�r�r�r
r
rr�s
r�)NN)N)Nr)2rr�rrr9r!r)rrr.r/r2r?rBrMrSrVr]rhrirqrWr�r�r�rdrYr�r�rZr�r�r�r�r�r�r��_ERR_MSG_PREFIXr�r��objectr�r�r�r�r�r�r�r�r�r
r
r
r�<module>s^D%$e
-<IM
		
/
&#/__pycache__/_bootstrap_external.cpython-36.opt-2.pyc000064400000072712150327175300016434 0ustar003

�\dhm��@s"dmZdnZeeZdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Zdd�Z	dd�Z
dd�Zdodd�Ze
ej�Zdjdd�dZejed�ZdZdZdgZdgZeZZdpd d!�d"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Z d.d/�Z!dqd0d1�Z"drd2d3�Z#dsd5d6�Z$d7d8�Z%e&�Z'dtd e'd9�d:d;�Z(Gd<d=�d=�Z)Gd>d?�d?�Z*Gd@dA�dAe*�Z+GdBdC�dC�Z,GdDdE�dEe,e+�Z-GdFdG�dGe,e*�Z.gZ/GdHdI�dIe,e*�Z0GdJdK�dK�Z1GdLdM�dM�Z2GdNdO�dO�Z3GdPdQ�dQ�Z4dudRdS�Z5dTdU�Z6dVdW�Z7dXdY�Z8dZd[d\d]d^d_d`dadbdcdddedfdgdhdidj�Z9dkdl�Z:d S)v�win�cygwin�darwincs<tjjt�r0tjjt�rd�nd��fdd�}ndd�}|S)N�PYTHONCASEOKsPYTHONCASEOKcs
�tjkS)N)�_os�environ�)�keyr�5/usr/lib64/python3.6/importlib/_bootstrap_external.py�_relax_case%sz%_make_relax_case.<locals>._relax_casecSsdS)NFrrrrr	r
)s)�sys�platform�
startswith�_CASE_INSENSITIVE_PLATFORMS�#_CASE_INSENSITIVE_PLATFORMS_STR_KEY)r
r)rr	�_make_relax_casesrcCst|�d@jdd�S)Nl����little)�int�to_bytes)�xrrr	�_w_long/srcCstj|d�S)Nr)r�
from_bytes)�	int_bytesrrr	�_r_long4srcGstjdd�|D��S)NcSsg|]}|r|jt��qSr)�rstrip�path_separators)�.0�partrrr	�
<listcomp>;sz_path_join.<locals>.<listcomp>)�path_sep�join)�
path_partsrrr	�
_path_join9s
r"cCs`tt�dkr$|jt�\}}}||fSx2t|�D]&}|tkr.|j|dd�\}}||fSq.Wd|fS)N�)�maxsplit�)�lenr�
rpartitionr�reversed�rsplit)�path�front�_�tailrrrr	�_path_split?sr.cCs
tj|�S)N)r�stat)r*rrr	�
_path_statKsr0cCs0yt|�}Wntk
r dSX|jd@|kS)NFi�)r0�OSError�st_mode)r*�mode�	stat_inforrr	�_path_is_mode_typeUs
r5cCs
t|d�S)Ni�)r5)r*rrr	�_path_isfile^sr6cCs|stj�}t|d�S)Ni@)r�getcwdr5)r*rrr	�_path_isdircsr8�cCs�dj|t|��}tj|tjtjBtjB|d@�}y2tj|d��}|j	|�WdQRXtj
||�Wn:tk
r�ytj|�Wntk
r�YnX�YnXdS)Nz{}.{}i��wb)
�format�idr�open�O_EXCL�O_CREAT�O_WRONLY�_io�FileIO�write�replacer1�unlink)r*�datar3�path_tmp�fd�filerrr	�
_write_atomicjsrJi3
�rs
�__pycache__zopt-z.pyz.pycN)�optimizationcCs�|dk	r4tjdt�|dk	r(d}t|��|r0dnd}tj|�}t|�\}}|jd�\}}}tj	j
}	|	dkrrtd��dj|r~|n|||	g�}
|dkr�tj
jdkr�d}ntj
j}t|�}|dkr�|j�s�tdj|���d	j|
t|�}
t|t|
td�S)
NzFthe debug_override parameter is deprecated; use 'optimization' insteadz2debug_override or optimization must be set to Noner%r#�.z$sys.implementation.cache_tag is None�z{!r} is not alphanumericz{}.{}{})�	_warnings�warn�DeprecationWarning�	TypeErrorr�fspathr.r'r�implementation�	cache_tag�NotImplementedErrorr �flags�optimize�str�isalnum�
ValueErrorr;�_OPTr"�_PYCACHE�BYTECODE_SUFFIXES)r*�debug_overriderM�message�headr-�base�sep�rest�tag�almost_filenamerrr	�cache_from_sources0
rhcCs�tjjdkrtd��tj|�}t|�\}}t|�\}}|tkrNtdj	t|���|j
d�}|d
krptdj	|���nV|dkr�|jdd�d}|jt
�s�tdj	t
���|tt
�d�}|j�s�tdj	|���|jd�d	}t||td	�S)Nz$sys.implementation.cache_tag is Nonez%{} not bottom-level directory in {!r}rNrK�z!expected only 2 or 3 dots in {!r}z9optimization portion of filename does not start with {!r}z4optimization level {!r} is not an alphanumeric valuerO>rKri���)rrUrVrWrrTr.r^r\r;�countr)r
r]r&r[�	partitionr"�SOURCE_SUFFIXES)r*rb�pycache_filename�pycache�	dot_countrM�	opt_level�
base_filenamerrr	�source_from_cache4s.	




rscCs�t|�dkrdS|jd�\}}}|s:|j�dd�dkr>|Syt|�}Wn$ttfk
rn|dd�}YnXt|�r||S|S)	NrOrNrir#�py������rv)r&r'�lowerrsrWr\r6)�
bytecode_pathrer,�	extension�source_pathrrr	�_get_sourcefileVsr{cCsH|jtt��r.yt|�Stk
r*YqDXn|jtt��r@|SdSdS)N)�endswith�tuplermrhrWr_)�filenamerrr	�_get_cachedisrcCs4yt|�j}Wntk
r&d}YnX|dO}|S)Ni��)r0r2r1)r*r3rrr	�
_calc_modeus
r�csDd�fdd�	}y
tj}Wntk
r4dd�}YnX||��|S)NcsB|dkr|j}n |j|kr0td|j|f|d���||f|�|�S)Nzloader for %s cannot handle %s)�name)r��ImportError)�selfr��args�kwargs)�methodrr	�_check_name_wrapper�s
z(_check_name.<locals>._check_name_wrappercSs<x(dD] }t||�rt||t||��qW|jj|j�dS)N�
__module__�__name__�__qualname__�__doc__)r�r�r�r�)�hasattr�setattr�getattr�__dict__�update)�new�oldrDrrr	�_wrap�s

z_check_name.<locals>._wrap)N)�
_bootstrapr��	NameError)r�r�r�r)r�r	�_check_name�s

r�cCs<|j|�\}}|dkr8t|�r8d}tj|j|d�t�|S)Nz,Not importing directory {}: missing __init__rO)�find_loaderr&rPrQr;�
ImportWarning)r��fullname�loader�portions�msgrrr	�_find_module_shim�s

r�cCs�i}|dk	r||d<nd}|dk	r*||d<|dd�}|dd�}|dd�}|tkr|dj||�}tjd|�t|f|��nVt|�dkr�d	j|�}tjd|�t|��n*t|�dkr�d
j|�}tjd|�t|��|dk	�r|yt|d�}	Wntk
�rYn2Xt	|�|	k�r4dj|�}tjd|�t|f|��y|d
d@}
Wntk
�rZYn"Xt	|�|
k�r|tdj|�f|��|dd�S)Nr�z
<bytecode>r*r��zbad magic number in {!r}: {!r}z{}z+reached EOF while reading timestamp in {!r}z0reached EOF while reading size of source in {!r}�mtimezbytecode is stale for {!r}�sizel��)
�MAGIC_NUMBERr;r��_verbose_messager�r&�EOFErrorr�KeyErrorr)rF�source_statsr�r*�exc_details�magic�
raw_timestamp�raw_sizera�source_mtime�source_sizerrr	�_validate_bytecode_header�sL





r�cCsPtj|�}t|t�r8tjd|�|dk	r4tj||�|Stdj	|�||d��dS)Nzcode object from {!r}zNon-code object in {!r})r�r*)
�marshal�loads�
isinstance�
_code_typer�r��_imp�_fix_co_filenamer�r;)rFr�rxrz�coderrr	�_compile_bytecode�s


r�rOcCs8tt�}|jt|��|jt|��|jtj|��|S)N)�	bytearrayr��extendrr��dumps)r�r�r�rFrrr	�_code_to_bytecode�s
r�cCs>ddl}tj|�j}|j|�}tjdd�}|j|j|d��S)NrOT)�tokenizerA�BytesIO�readline�detect_encoding�IncrementalNewlineDecoder�decode)�source_bytesr��source_bytes_readline�encoding�newline_decoderrrr	�
decode_source�s

r�)r��submodule_search_locationsc	Cs|dkr<d}t|d�rFy|j|�}WqFtk
r8YqFXn
tj|�}tj|||d�}d|_|dkr�x6t�D](\}}|j	t
|��rl|||�}||_PqlWdS|tkr�t|d�r�y|j
|�}Wntk
r�Yq�X|r�g|_n||_|jgk�r|�rt|�d}|jj|�|S)Nz	<unknown>�get_filename)�originT�
is_packagerO)r�r�r�rrTr��
ModuleSpec�
_set_fileattr�_get_supported_file_loadersr|r}r��	_POPULATEr�r�r.�append)	r��locationr�r��spec�loader_class�suffixesr��dirnamerrr	�spec_from_file_locations>



r�c@sLeZdZdZdZdZedd��Zedd��Zed
d	d
��Z	eddd��Z
dS)�WindowsRegistryFinderz;Software\Python\PythonCore\{sys_version}\Modules\{fullname}zASoftware\Python\PythonCore\{sys_version}\Modules\{fullname}\DebugFcCs2ytjtj|�Stk
r,tjtj|�SXdS)N)�_winreg�OpenKey�HKEY_CURRENT_USERr1�HKEY_LOCAL_MACHINE)�clsrrrr	�_open_registry\sz$WindowsRegistryFinder._open_registrycCsp|jr|j}n|j}|j|dtjdd�d�}y&|j|��}tj|d�}WdQRXWnt	k
rjdSX|S)Nz%d.%drK)r��sys_versionr%)
�DEBUG_BUILD�REGISTRY_KEY_DEBUG�REGISTRY_KEYr;r�version_infor�r��
QueryValuer1)r�r��registry_keyr�hkey�filepathrrr	�_search_registrycsz&WindowsRegistryFinder._search_registryNcCsx|j|�}|dkrdSyt|�Wntk
r6dSXx:t�D]0\}}|jt|��r@tj||||�|d�}|Sq@WdS)N)r�)r�r0r1r�r|r}r��spec_from_loader)r�r�r*�targetr�r�r�r�rrr	�	find_specrs
zWindowsRegistryFinder.find_speccCs"|j||�}|dk	r|jSdSdS)N)r�r�)r�r�r*r�rrr	�find_module�sz!WindowsRegistryFinder.find_module)NN)N)r�r�r�r�r�r��classmethodr�r�r�r�rrrr	r�Psr�c@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�
_LoaderBasicscCs@t|j|��d}|jdd�d}|jd�d}|dko>|dkS)Nr#rNrOrK�__init__)r.r�r)r')r�r�r~�
filename_base�	tail_namerrr	r��sz_LoaderBasics.is_packagecCsdS)Nr)r�r�rrr	�
create_module�sz_LoaderBasics.create_modulecCs8|j|j�}|dkr$tdj|j���tjt||j�dS)Nz4cannot load module {!r} when get_code() returns None)�get_coder�r�r;r��_call_with_frames_removed�execr�)r��moduler�rrr	�exec_module�s

z_LoaderBasics.exec_modulecCstj||�S)N)r��_load_module_shim)r�r�rrr	�load_module�sz_LoaderBasics.load_moduleN)r�r�r�r�r�r�r�rrrr	r��sr�c@sJeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�d
d�Zdd�Z	dS)�SourceLoadercCst�dS)N)�IOError)r�r*rrr	�
path_mtime�szSourceLoader.path_mtimecCsd|j|�iS)Nr�)r�)r�r*rrr	�
path_stats�szSourceLoader.path_statscCs|j||�S)N)�set_data)r�rz�
cache_pathrFrrr	�_cache_bytecode�szSourceLoader._cache_bytecodecCsdS)Nr)r�r*rFrrr	r��szSourceLoader.set_datacCsR|j|�}y|j|�}Wn0tk
rH}ztd|d�|�WYdd}~XnXt|�S)Nz'source not available through get_data())r�)r��get_datar1r�r�)r�r�r*r��excrrr	�
get_source�s
zSourceLoader.get_sourcer#)�	_optimizecCstjt||dd|d�S)Nr�T)�dont_inheritrY)r�r��compile)r�rFr*rrrr	�source_to_code�szSourceLoader.source_to_codec
+Cs^|j|�}d}yt|�}Wntk
r2d}Yn�Xy|j|�}Wntk
rVYn~Xt|d�}y|j|�}Wntk
r�YnNXyt||||d�}Wnt	t
fk
r�Yn Xtjd||�t
||||d�S|j|�}|j||�}	tjd|�tj�rZ|dk	�rZ|dk	�rZt|	|t|��}y|j|||�tjd|�Wntk
�rXYnX|	S)Nr�)r�r�r*z
{} matches {})r�rxrzzcode object from {}z
wrote {!r})r�rhrWr�r�rr�r1r�r�r�r�r�r�rr�dont_write_bytecoder�r&r�)
r�r�rzr�rx�strF�
bytes_datar��code_objectrrr	r��sN




zSourceLoader.get_codeNrv)
r�r�r�r�r�r�r�rrr�rrrr	r��s


r�csLeZdZdd�Zdd�Zdd�Ze�fdd��Zed	d
��Zdd�Z	�Z
S)
�
FileLoadercCs||_||_dS)N)r�r*)r�r�r*rrr	r� szFileLoader.__init__cCs|j|jko|j|jkS)N)�	__class__r�)r��otherrrr	�__eq__&szFileLoader.__eq__cCst|j�t|j�AS)N)�hashr�r*)r�rrr	�__hash__*szFileLoader.__hash__cstt|�j|�S)N)�superr	r�)r�r�)r
rr	r�-s
zFileLoader.load_modulecCs|jS)N)r*)r�r�rrr	r�9szFileLoader.get_filenamec	Cs tj|d��
}|j�SQRXdS)N�r)rArB�read)r�r*rIrrr	r�>szFileLoader.get_data)r�r�r�r�rrr�r�r�r��
__classcell__rr)r
r	r	sr	c@s*eZdZdd�Zdd�Zdd�dd�Zd	S)
�SourceFileLoadercCst|�}|j|jd�S)N)r�r�)r0�st_mtime�st_size)r�r*rrrr	r�HszSourceFileLoader.path_statscCst|�}|j|||d�S)N)�_mode)r�r�)r�rzrxrFr3rrr	r�Msz SourceFileLoader._cache_bytecodei�)rc	Cs�t|�\}}g}x(|r8t|�r8t|�\}}|j|�qWxlt|�D]`}t||�}ytj|�WqDtk
rvwDYqDtk
r�}zt	j
d||�dSd}~XqDXqDWyt|||�t	j
d|�Wn0tk
r�}zt	j
d||�WYdd}~XnXdS)Nzcould not create {!r}: {!r}zcreated {!r})r.r8r�r(r"r�mkdir�FileExistsErrorr1r�r�rJ)	r�r*rFr�parentr~r!rr�rrr	r�Rs*
zSourceFileLoader.set_dataN)r�r�r�r�r�r�rrrr	rDsrc@seZdZdd�Zdd�ZdS)�SourcelessFileLoadercCs0|j|�}|j|�}t|||d�}t|||d�S)N)r�r*)r�rx)r�r�r�r�)r�r�r*rFrrrr	r�us

zSourcelessFileLoader.get_codecCsdS)Nr)r�r�rrr	r{szSourcelessFileLoader.get_sourceN)r�r�r�r�rrrrr	rqsrc@sXeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
edd��ZdS)�ExtensionFileLoadercCs||_||_dS)N)r�r*)r�r�r*rrr	r��szExtensionFileLoader.__init__cCs|j|jko|j|jkS)N)r
r�)r�rrrr	r�szExtensionFileLoader.__eq__cCst|j�t|j�AS)N)r
r�r*)r�rrr	r�szExtensionFileLoader.__hash__cCs$tjtj|�}tjd|j|j�|S)Nz&extension module {!r} loaded from {!r})r�r�r��create_dynamicr�r�r*)r�r�r�rrr	r��s

z!ExtensionFileLoader.create_modulecCs$tjtj|�tjd|j|j�dS)Nz(extension module {!r} executed from {!r})r�r�r��exec_dynamicr�r�r*)r�r�rrr	r��szExtensionFileLoader.exec_modulecs$t|j�d�t�fdd�tD��S)Nr#c3s|]}�d|kVqdS)r�Nr)r�suffix)�	file_namerr	�	<genexpr>�sz1ExtensionFileLoader.is_package.<locals>.<genexpr>)r.r*�any�EXTENSION_SUFFIXES)r�r�r)rr	r��szExtensionFileLoader.is_packagecCsdS)Nr)r�r�rrr	r��szExtensionFileLoader.get_codecCsdS)Nr)r�r�rrr	r�szExtensionFileLoader.get_sourcecCs|jS)N)r*)r�r�rrr	r��sz ExtensionFileLoader.get_filenameN)
r�r�r�r�rrr�r�r�r�rr�r�rrrr	r�src@s\eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�ZdS)�_NamespacePathcCs$||_||_t|j��|_||_dS)N)�_name�_pathr}�_get_parent_path�_last_parent_path�_path_finder)r�r�r*�path_finderrrr	r��sz_NamespacePath.__init__cCs&|jjd�\}}}|dkrdS|dfS)NrNr%rr*�__path__)rr*)r$r')r�r�dot�merrr	�_find_parent_path_names�sz&_NamespacePath._find_parent_path_namescCs|j�\}}ttj||�S)N)r-r�r�modules)r��parent_module_name�path_attr_namerrr	r&�sz_NamespacePath._get_parent_pathcCsPt|j��}||jkrJ|j|j|�}|dk	rD|jdkrD|jrD|j|_||_|jS)N)r}r&r'r(r$r�r�r%)r��parent_pathr�rrr	�_recalculate�s
z_NamespacePath._recalculatecCst|j��S)N)�iterr2)r�rrr	�__iter__�sz_NamespacePath.__iter__cCs||j|<dS)N)r%)r��indexr*rrr	�__setitem__�sz_NamespacePath.__setitem__cCst|j��S)N)r&r2)r�rrr	�__len__�sz_NamespacePath.__len__cCsdj|j�S)Nz_NamespacePath({!r}))r;r%)r�rrr	�__repr__�sz_NamespacePath.__repr__cCs||j�kS)N)r2)r��itemrrr	�__contains__�sz_NamespacePath.__contains__cCs|jj|�dS)N)r%r�)r�r9rrr	r��sz_NamespacePath.appendN)
r�r�r�r�r-r&r2r4r6r7r8r:r�rrrr	r#�s

r#c@sPeZdZdd�Zedd��Zdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�ZdS)�_NamespaceLoadercCst|||�|_dS)N)r#r%)r�r�r*r)rrr	r��sz_NamespaceLoader.__init__cCsdj|j�S)Nz<module {!r} (namespace)>)r;r�)r�r�rrr	�module_repr�sz_NamespaceLoader.module_reprcCsdS)NTr)r�r�rrr	r�sz_NamespaceLoader.is_packagecCsdS)Nr%r)r�r�rrr	rsz_NamespaceLoader.get_sourcecCstddddd�S)Nr%z<string>r�T)r)r)r�r�rrr	r�sz_NamespaceLoader.get_codecCsdS)Nr)r�r�rrr	r�sz_NamespaceLoader.create_modulecCsdS)Nr)r�r�rrr	r�sz_NamespaceLoader.exec_modulecCstjd|j�tj||�S)Nz&namespace module loaded with path {!r})r�r�r%r�)r�r�rrr	r�sz_NamespaceLoader.load_moduleN)r�r�r�r�r�r<r�rr�r�r�r�rrrr	r;�s	r;c@sfeZdZedd��Zedd��Zedd��Zedd��Zedd
d��Zeddd
��Z	eddd��Z
d	S)�
PathFindercCs*x$tjj�D]}t|d�r|j�qWdS)N�invalidate_caches)r�path_importer_cache�valuesr�r>)r��finderrrr	r>#s
zPathFinder.invalidate_cachescCsVtjdk	rtjrtjdt�x2tjD]$}y||�Stk
rHw&Yq&Xq&WdSdS)Nzsys.path_hooks is empty)r�
path_hooksrPrQr�r�)r�r*�hookrrr	�_path_hooks+szPathFinder._path_hookscCsf|dkr*ytj�}Wntk
r(dSXytj|}Wn(tk
r`|j|�}|tj|<YnX|S)Nr%)rr7�FileNotFoundErrorrr?r�rD)r�r*rArrr	�_path_importer_cache8s
zPathFinder._path_importer_cachecCsRt|d�r|j|�\}}n|j|�}g}|dk	r<tj||�Stj|d�}||_|S)Nr�)r�r�r�r�r�r�r�)r�r�rAr�r�r�rrr	�_legacy_get_specNs

zPathFinder._legacy_get_specNc	Cs�g}x�|D]�}t|ttf�sq
|j|�}|dk	r
t|d�rH|j||�}n|j||�}|dkr^q
|jdk	rl|S|j}|dkr�t	d��|j
|�q
Wtj|d�}||_|SdS)Nr�zspec missing loader)
r�rZ�bytesrFr�r�rGr�r�r�r�r�r�)	r�r�r*r��namespace_path�entryrAr�r�rrr	�	_get_spec]s(



zPathFinder._get_speccCsd|dkrtj}|j|||�}|dkr(dS|jdkr\|j}|rVd|_t|||j�|_|SdSn|SdS)N�	namespace)rr*rKr�r�r�r#)r�r�r*r�r�rIrrr	r�}s
zPathFinder.find_speccCs|j||�}|dkrdS|jS)N)r�r�)r�r�r*r�rrr	r��szPathFinder.find_module)N)NN)N)r�r�r�r�r>rDrFrGrKr�r�rrrr	r=s
r=c@sVeZdZdd�Zdd�ZeZdd�Zdd�Zdd
d�Z	dd
�Z
edd��Zdd�Z
d	S)�
FileFindercsXg}x(|D] \�}|j�fdd�|D��q
W||_|p:d|_d|_t�|_t�|_dS)Nc3s|]}|�fVqdS)Nr)rr)r�rr	r �sz&FileFinder.__init__.<locals>.<genexpr>rNr#rv)r��_loadersr*�_path_mtime�set�_path_cache�_relaxed_path_cache)r�r*�loader_details�loadersr�r)r�r	r��s
zFileFinder.__init__cCs
d|_dS)Nr#rv)rO)r�rrr	r>�szFileFinder.invalidate_cachescCs*|j|�}|dkrdgfS|j|jp&gfS)N)r�r�r�)r�r�r�rrr	r��s
zFileFinder.find_loadercCs|||�}t||||d�S)N)r�r�)r�)r�r�r�r*�smslr�r�rrr	rK�s
zFileFinder._get_specNcCsbd}|jd�d}yt|jp"tj��j}Wntk
rBd	}YnX||jkr\|j�||_t	�rr|j
}|j�}n
|j}|}||kr�t
|j|�}xH|jD]6\}	}
d|	}t
||�}t|�r�|j|
|||g|�Sq�Wt|�}xX|jD]N\}	}
t
|j||	�}tjd|dd�||	|kr�t|�r�|j|
||d|�Sq�W|�r^tjd|�tj|d�}
|g|
_|
SdS)
NFrNrKr#r�z	trying {})�	verbosityzpossible namespace for {}rv)r'r0r*rr7rr1rO�_fill_cacher
rRrwrQr"rNr6rKr8r�r�r�r�)r�r�r��is_namespace�tail_moduler��cache�cache_module�	base_pathrr��
init_filename�	full_pathr�rrr	r��sF




zFileFinder.find_specc	
Cs�|j}ytj|ptj��}Wntttfk
r:g}YnXtjj	d�sTt
|�|_nNt
�}x@|D]8}|jd�\}}}|r�dj
||j��}n|}|j|�q`W||_tjj	t�r�dd�|D�|_dS)NrrNz{}.{}cSsh|]}|j��qSr)rw)r�fnrrr	�	<setcomp>sz)FileFinder._fill_cache.<locals>.<setcomp>)r*r�listdirr7rE�PermissionError�NotADirectoryErrorrrr
rPrQrlr;rw�addrrR)	r�r*�contents�lower_suffix_contentsr9r�r+r�new_namerrr	rWs"

zFileFinder._fill_cachecs��fdd�}|S)Ncs"t|�std|d���|f���S)Nzonly directories are supported)r*)r8r�)r*)r�rSrr	�path_hook_for_FileFinder*sz6FileFinder.path_hook.<locals>.path_hook_for_FileFinderr)r�rSrhr)r�rSr	�	path_hook s
zFileFinder.path_hookcCsdj|j�S)NzFileFinder({!r}))r;r*)r�rrr	r82szFileFinder.__repr__)N)r�r�r�r�r>r�r�r�rKr�rWr�rir8rrrr	rM�s	
0rMcCs�|jd�}|jd�}|sB|r$|j}n||kr8t||�}n
t||�}|sTt|||d�}y$||d<||d<||d<||d<Wntk
r�YnXdS)N�
__loader__�__spec__)r��__file__�
__cached__)�getr�rrr��	Exception)�nsr��pathname�	cpathnamer�r�rrr	�_fix_up_module8s"


rscCs*tttj��f}ttf}ttf}|||gS)N)r�_alternative_architecturesr��extension_suffixesrrmrr_)�
extensions�source�bytecoderrr	r�Osr�cCs�|atjatjatjt}x8dD]0}|tjkr:tj|�}n
tj|}t|||�q Wddgfdddgff}x`|D]P\}}|d	}|tjkr�tj|}Pqpytj|�}PWqptk
r�wpYqpXqpWtd
��t|d|�t|d|�t|d
dj|��ytjd�}	Wntk
�rd}	YnXt|d|	�tjd�}
t|d|
�|dk�rbtjd�}t|d|�t|dt	��t
jttj
���|dk�r�tjd�dt
k�r�dt_dS)NrArP�builtinsr��posix�/�nt�\rOzimportlib requires posix or ntrrrr%�_thread�_weakref�winregr�r
z.pywz_d.pydT)rArPryr�)r�rr�r.r��_builtin_from_namer�r�r rr"r�rtrurmr�r�r�)�_bootstrap_module�self_module�builtin_name�builtin_module�
os_details�
builtin_osrr�	os_module�
thread_module�weakref_module�
winreg_modulerrr	�_setupZsP













r�cCs2t|�t�}tjjtj|�g�tjjt	�dS)N)
r�r�rrBr�rMri�	meta_pathr�r=)r��supported_loadersrrr	�_install�sr�z-arm-linux-gnueabihf.z-armeb-linux-gnueabihf.z-mips64-linux-gnuabi64.z-mips64el-linux-gnuabi64.z-powerpc-linux-gnu.z-powerpc-linux-gnuspe.z-powerpc64-linux-gnu.z-powerpc64le-linux-gnu.z-arm-linux-gnueabi.z-armeb-linux-gnueabi.z-mips64-linux-gnu.z-mips64el-linux-gnu.z-ppc-linux-gnu.z-ppc-linux-gnuspe.z-ppc64-linux-gnu.z-ppc64le-linux-gnu.)z-arm-linux-gnueabi.z-armeb-linux-gnueabi.z-mips64-linux-gnu.z-mips64el-linux-gnu.z-ppc-linux-gnu.z-ppc-linux-gnuspe.z-ppc64-linux-gnu.z-ppc64le-linux-gnu.z-arm-linux-gnueabihf.z-armeb-linux-gnueabihf.z-mips64-linux-gnuabi64.z-mips64el-linux-gnuabi64.z-powerpc-linux-gnu.z-powerpc-linux-gnuspe.z-powerpc64-linux-gnu.z-powerpc64le-linux-gnu.cCsFx@|D]8}x2tj�D]&\}}||kr|j|j||��|SqWqW|S)N)�	_ARCH_MAP�itemsr�rD)r�r�original�alternativerrr	rt�s
rt)r)rr)r9)N)NNN)NNN)rOrO)N)N);r�%_CASE_INSENSITIVE_PLATFORMS_BYTES_KEYrrrrr"r.r0r5r6r8rJ�type�__code__r�rr�rr�_RAW_MAGIC_NUMBERr^r]rmr_�DEBUG_BYTECODE_SUFFIXES�OPTIMIZED_BYTECODE_SUFFIXESrhrsr{rr�r�r�r�r�r�r��objectr�r�r�r�r�r	rrr"rr#r;r=rMrsr�r�r�r�rtrrrr	�<module>s�
	

{-"
7


C@n)-5<*
D	__pycache__/abc.cpython-36.opt-1.pyc000064400000026037150327175300013101 0ustar003


 \*�"@s�dZddlmZddlmZddlmZyddlZWn2ek
rfZzejdkrR�dZWYddZ[XnXyddl	Z	Wn&ek
r�Zz
eZ	WYddZ[XnXddl
Z
dd	�ZGd
d�de
jd�Z
Gd
d�de
�Zeeejejejej�Gdd�de
�Zeeej�Gdd�de
jd�ZGdd�de�ZGdd�de�Zeeejej�Gdd�de�Zeeej�Gdd�dejee�Zeeejej�Gdd�dejee�Zeeej�dS)z(Abstract base classes related to import.�)�
_bootstrap)�_bootstrap_external)�	machinery�N�_frozen_importlibcGs`xZ|D]R}|j|�tdk	rytt|j�}Wn tk
rLtt|j�}YnX|j|�qWdS)N)�registerr�getattr�__name__�AttributeError�_frozen_importlib_external)�abstract_cls�classes�cls�
frozen_cls�r�%/usr/lib64/python3.6/importlib/abc.py�	_registers

rc@s eZdZdZejddd��ZdS)�FinderaLegacy abstract base class for import finders.

    It may be subclassed for compatibility with legacy third party
    reimplementations of the import system.  Otherwise, finder
    implementations should derive from the more specific MetaPathFinder
    or PathEntryFinder ABCs.
    NcCsdS)z�An abstract method that should find a module.
        The fullname is a str and the optional path is a str or None.
        Returns a Loader object or None.
        Nr)�self�fullname�pathrrr�find_module'szFinder.find_module)N)r	�
__module__�__qualname__�__doc__�abc�abstractmethodrrrrrrsr)�	metaclassc@s eZdZdZdd�Zdd�ZdS)�MetaPathFinderz8Abstract base class for import finders on sys.meta_path.cCs,t|d�sdS|j||�}|dk	r(|jSdS)aNReturn a loader for the module.

        If no module is found, return None.  The fullname is a str and
        the path is a list of strings or None.

        This method is deprecated in favor of finder.find_spec(). If find_spec()
        exists then backwards-compatible functionality is provided for this
        method.

        �	find_specN)�hasattrr�loader)rrr�foundrrrr6s
zMetaPathFinder.find_modulecCsdS)z�An optional method for clearing the finder's cache, if any.
        This method is used by importlib.invalidate_caches().
        Nr)rrrr�invalidate_cachesFsz MetaPathFinder.invalidate_cachesN)r	rrrrr#rrrrr/src@s&eZdZdZdd�ZejZdd�ZdS)�PathEntryFinderz>Abstract base class for path entry finders used by PathFinder.cCsLt|d�sdgfS|j|�}|dk	r@|js0g}n|j}|j|fSdgfSdS)aCReturn (loader, namespace portion) for the path entry.

        The fullname is a str.  The namespace portion is a sequence of
        path entries contributing to part of a namespace package. The
        sequence may be empty.  If loader is not None, the portion will
        be ignored.

        The portion will be discarded if another path entry finder
        locates the module as a normal module or package.

        This method is deprecated in favor of finder.find_spec(). If find_spec()
        is provided than backwards-compatible functionality is provided.

        rN)r r�submodule_search_locationsr!)rrr"�portionsrrr�find_loaderVs


zPathEntryFinder.find_loadercCsdS)z�An optional method for clearing the finder's cache, if any.
        This method is used by PathFinder.invalidate_caches().
        Nr)rrrrr#ssz!PathEntryFinder.invalidate_cachesN)	r	rrrr'r�_find_module_shimrr#rrrrr$Osr$c@s(eZdZdZdd�Zdd�Zdd�ZdS)	�Loaderz'Abstract base class for import loaders.cCsdS)z�Return a module to initialize and into which to load.

        This method should raise ImportError if anything prevents it
        from creating a new module.  It may return None to indicate
        that the spec should create the new module.
        Nr)r�specrrr�
create_moduleszLoader.create_modulecCst|d�st�tj||�S)a�Return the loaded module.

        The module must be added to sys.modules and have import-related
        attributes set properly.  The fullname is a str.

        ImportError is raised on failure.

        This method is deprecated in favor of loader.exec_module(). If
        exec_module() exists then it is used to provide a backwards-compatible
        functionality for this method.

        �exec_module)r �ImportErrorr�_load_module_shim)rrrrr�load_module�s
zLoader.load_modulecCst�dS)z�Return a module's repr.

        Used by the module type when the method does not raise
        NotImplementedError.

        This method is deprecated.

        N)�NotImplementedError)r�modulerrr�module_repr�s
zLoader.module_reprN)r	rrrr+r/r2rrrrr){s
r)c@seZdZdZejdd��ZdS)�ResourceLoaderz�Abstract base class for loaders which can return data from their
    back-end storage.

    This ABC represents one of the optional protocols specified by PEP 302.

    cCst�dS)zwAbstract method which when implemented should return the bytes for
        the specified path.  The path must be a str.N)�IOError)rrrrr�get_data�szResourceLoader.get_dataN)r	rrrrrr5rrrrr3�sr3c@sLeZdZdZdd�Zdd�Zejdd��Ze	dd	d
��Z
ejj
Z
ejjZdS)
�
InspectLoaderz�Abstract base class for loaders which support inspection about the
    modules they can load.

    This ABC represents one of the optional protocols specified by PEP 302.

    cCst�dS)z�Optional method which when implemented should return whether the
        module is a package.  The fullname is a str.  Returns a bool.

        Raises ImportError if the module cannot be found.
        N)r-)rrrrr�
is_package�szInspectLoader.is_packagecCs |j|�}|dkrdS|j|�S)aMethod which returns the code object for the module.

        The fullname is a str.  Returns a types.CodeType if possible, else
        returns None if a code object does not make sense
        (e.g. built-in module). Raises ImportError if the module cannot be
        found.
        N)�
get_source�source_to_code)rr�sourcerrr�get_code�s
zInspectLoader.get_codecCst�dS)z�Abstract method which should return the source code for the
        module.  The fullname is a str.  Returns a str.

        Raises ImportError if the module cannot be found.
        N)r-)rrrrrr8�szInspectLoader.get_source�<string>cCst||ddd�S)z�Compile 'data' into a code object.

        The 'data' argument can be anything that compile() can handle. The'path'
        argument should be where the data was retrieved (when applicable).�execT)�dont_inherit)�compile)�datarrrrr9�szInspectLoader.source_to_codeN)r<)r	rrrr7r;rrr8�staticmethodr9r�
_LoaderBasicsr,r/rrrrr6�s
	r6c@s&eZdZdZejdd��Zdd�ZdS)�ExecutionLoaderz�Abstract base class for loaders that wish to support the execution of
    modules as scripts.

    This ABC represents one of the optional protocols specified in PEP 302.

    cCst�dS)z�Abstract method which should return the value that __file__ is to be
        set to.

        Raises ImportError if the module cannot be found.
        N)r-)rrrrr�get_filename�szExecutionLoader.get_filenamecCsP|j|�}|dkrdSy|j|�}Wntk
r>|j|�SX|j||�SdS)z�Method to return the code object for fullname.

        Should return None if not applicable (e.g. built-in module).
        Raise ImportError if the module cannot be found.
        N)r8rDr-r9)rrr:rrrrr;s
zExecutionLoader.get_codeN)r	rrrrrrDr;rrrrrC�s	rCc@seZdZdZdS)�
FileLoaderz[Abstract base class partially implementing the ResourceLoader and
    ExecutionLoader ABCs.N)r	rrrrrrrrEsrEc@s(eZdZdZdd�Zdd�Zdd�ZdS)	�SourceLoadera�Abstract base class for loading source code (and optionally any
    corresponding bytecode).

    To support loading from source code, the abstractmethods inherited from
    ResourceLoader and ExecutionLoader need to be implemented. To also support
    loading from bytecode, the optional methods specified directly by this ABC
    is required.

    Inherited abstractmethods not implemented in this ABC:

        * ResourceLoader.get_data
        * ExecutionLoader.get_filename

    cCs$|jjtjkrt�t|j|�d�S)z6Return the (int) modification time for the path (str).�mtime)�
path_stats�__func__rFr4�int)rrrrr�
path_mtime.szSourceLoader.path_mtimecCs |jjtjkrt�d|j|�iS)aReturn a metadata dict for the source pointed to by the path (str).
        Possible keys:
        - 'mtime' (mandatory) is the numeric timestamp of last source
          code modification;
        - 'size' (optional) is the size in bytes of the source code.
        rG)rKrIrFr4)rrrrrrH4szSourceLoader.path_statscCsdS)aWrite the bytes to the path (if possible).

        Accepts a str path and data as bytes.

        Any needed intermediary directories are to be created. If for some
        reason the file cannot be written because of permissions, fail
        silently.
        Nr)rrr@rrr�set_data?szSourceLoader.set_dataN)r	rrrrKrHrLrrrrrFsrF)r�rrrrr-�exc�namerrr�ABCMetarr�BuiltinImporter�FrozenImporter�
PathFinder�WindowsRegistryFinderr$�
FileFinderr)r3r6rC�ExtensionFileLoaderrE�SourceFileLoader�SourcelessFileLoaderrFrrrr�<module>s@
)/2",__pycache__/util.cpython-36.opt-1.pyc000064400000021306150327175300013323 0ustar003


 \�*�@sdZddlmZddlmZddlmZddlmZddlmZddlm	Z	ddlm
Z
dd	lmZdd
lmZddlm
Z
dd
lmZddlZddlZddlZddlZdd�Zd!dd�Zd"dd�Zedd��Zdd�Zdd�Zdd�ZGdd�dej�ZGdd �d ej�ZdS)#z-Utility code for constructing importers, etc.�)�abc)�module_from_spec)�
_resolve_name)�spec_from_loader)�
_find_spec)�MAGIC_NUMBER)�cache_from_source)�
decode_source)�source_from_cache)�spec_from_file_location�)�contextmanagerNcCs^|jd�s|S|s&tdt|��d���d}x|D]}|dkr>P|d7}q0Wt||d�||�S)z2Resolve a relative module name to an absolute one.�.zno package specified for z% (required for relative module names)rrN)�
startswith�
ValueError�reprr)�name�package�level�	character�r�&/usr/lib64/python3.6/importlib/util.py�resolve_names

rcCsx|tjkrt||�Stj|}|dkr*dSy
|j}Wn$tk
rXtdj|��d�YnX|dkrptdj|���|SdS)a�Return the spec for the specified module.

    First, sys.modules is checked to see if the module was already imported. If
    so, then sys.modules[name].__spec__ is returned. If that happens to be
    set to None, then ValueError is raised. If the module is not in
    sys.modules, then sys.meta_path is searched for a suitable spec with the
    value of 'path' given to the finders. None is returned if no spec could
    be found.

    Dotted names do not have their parent packages implicitly imported. You will
    most likely need to explicitly import all parent packages in the proper
    order for a submodule to get the correct spec.

    Nz{}.__spec__ is not setz{}.__spec__ is None)�sys�modulesr�__spec__�AttributeErrorr�format)r�path�module�specrrr�_find_spec_from_path#s



r!cCs�|jd�rt||�n|}|tjkrZ|jd�d}|rNt|dgd�}t||j�St|d�Sn`tj|}|dkrpdSy
|j}Wn$t	k
r�t
dj|��d�YnX|dkr�t
dj|���|SdS)a�Return the spec for the specified module.

    First, sys.modules is checked to see if the module was already imported. If
    so, then sys.modules[name].__spec__ is returned. If that happens to be
    set to None, then ValueError is raised. If the module is not in
    sys.modules, then sys.meta_path is searched for a suitable spec with the
    value of 'path' given to the finders. None is returned if no spec could
    be found.

    If the name is for submodule (contains a dot), the parent module is
    automatically imported.

    The name and package arguments work the same as importlib.import_module().
    In other words, relative module names (with leading dots) work.

    rr�__path__)�fromlistNz{}.__spec__ is not setz{}.__spec__ is None)rrrr�
rpartition�
__import__rr"rrrr)rr�fullname�parent_name�parentrr rrr�	find_specBs"


r)ccs�|tjk}tjj|�}|s6tt�|�}d|_|tj|<zJy
|VWn:tk
r||sxytj|=Wntk
rvYnXYnXWdd|_XdS)NTF)rr�get�type�__initializing__�	Exception�KeyError)r�	is_reloadrrrr�_module_to_loadjs


r0cstj���fdd��}|S)zOSet __package__ on the returned module.

    This function is deprecated.

    csRtjdtdd��||�}t|dd�dkrN|j|_t|d�sN|jjd�d|_|S)Nz7The import system now takes care of this automatically.�)�
stacklevel�__package__r"rr)�warnings�warn�DeprecationWarning�getattr�__name__r3�hasattrr$)�args�kwargsr)�fxnrr�set_package_wrapper�s


z(set_package.<locals>.set_package_wrapper)�	functools�wraps)r<r=r)r<r�set_package�s
r@cstj���fdd��}|S)zNSet __loader__ on the returned module.

    This function is deprecated.

    cs:tjdtdd��|f|�|�}t|dd�dkr6||_|S)Nz7The import system now takes care of this automatically.r1)r2�
__loader__)r4r5r6r7rA)�selfr:r;r)r<rr�set_loader_wrapper�s
z&set_loader.<locals>.set_loader_wrapper)r>r?)r<rCr)r<r�
set_loader�srDcs*tjdtdd�tj���fdd��}|S)a*Decorator to handle selecting the proper module for loaders.

    The decorated function is passed the module to use instead of the module
    name. The module passed in to the function is either from sys.modules if
    it already exists or is a new module. If the module is new, then __name__
    is set the first argument to the method, __loader__ is set to self, and
    __package__ is set accordingly (if self.is_package() is defined) will be set
    before it is passed to the decorated function (if self.is_package() does
    not work for the module it will be set post-load).

    If an exception is raised and the decorator created the module it is
    subsequently removed from sys.modules.

    The decorator assumes that the decorated function takes the module name as
    the second argument.

    z7The import system now takes care of this automatically.r1)r2cspt|��^}||_y|j|�}Wnttfk
r6YnX|rD||_n|jd�d|_�||f|�|�SQRXdS)Nrr)r0rA�
is_package�ImportErrorrr3r$)rBr&r:r;rrE)r<rr�module_for_loader_wrapper�s
z4module_for_loader.<locals>.module_for_loader_wrapper)r4r5r6r>r?)r<rGr)r<r�module_for_loader�s
rHc@s eZdZdZdd�Zdd�ZdS)�_LazyModulezKA subclass of the module type which triggers loading upon attribute access.c	Cs�tj|_|jj}|jjd}|jjd}|j}i}xF|j�D]:\}}||krV|||<q<t||�t||�kr<|||<q<W|jj	j
|�|tjkr�t|�ttj|�kr�t
d|�d���|jj|�t||�S)z8Trigger the load of the module and return the attribute.�__dict__�	__class__zmodule object for z. substituted in sys.modules during a lazy load)�types�
ModuleTyperKrr�loader_staterJ�items�id�loader�exec_modulerrr�updater7)	rB�attr�
original_name�
attrs_then�
original_type�	attrs_now�
attrs_updated�key�valuerrr�__getattribute__�s"

z_LazyModule.__getattribute__cCs|j|�t||�dS)z/Trigger the load and then perform the deletion.N)r\�delattr)rBrTrrr�__delattr__�s
z_LazyModule.__delattr__N)r8�
__module__�__qualname__�__doc__r\r^rrrrrI�s#rIc@s@eZdZdZedd��Zedd��Zdd�Zdd	�Z	d
d�Z
dS)
�
LazyLoaderzKA loader that creates a module which defers loading until attribute access.cCst|d�std��dS)NrRz loader must define exec_module())r9�	TypeError)rQrrr�__check_eager_loaders
zLazyLoader.__check_eager_loadercs�j����fdd�S)z>Construct a callable which returns the eager loader made lazy.cs��||��S)Nr)r:r;)�clsrQrr�<lambda>sz$LazyLoader.factory.<locals>.<lambda>)�_LazyLoader__check_eager_loader)rerQr)rerQr�factorys
zLazyLoader.factorycCs|j|�||_dS)N)rgrQ)rBrQrrr�__init__
s
zLazyLoader.__init__cCs|jj|�S)N)rQ�
create_module)rBr rrrrjszLazyLoader.create_modulecCs@|j|j_|j|_i}|jj�|d<|j|d<||j_t|_dS)zMake the module load lazily.rJrKN)rQrrArJ�copyrKrNrI)rBrrNrrrrRs

zLazyLoader.exec_moduleN)r8r_r`ra�staticmethodrg�classmethodrhrirjrRrrrrrb�srb)N)N)ra�r�
_bootstraprrrr�_bootstrap_externalrrr	r
r�
contextlibr
r>rrLr4rr!r)r0r@rDrHrMrI�Loaderrbrrrr�<module>s0

('/__pycache__/abc.cpython-36.opt-2.pyc000064400000012552150327175300013077 0ustar003


 \*�"@s�ddlmZddlmZddlmZyddlZWn2ek
rbZzejdkrN�dZWYddZ[XnXyddlZWn&ek
r�Zz
eZWYddZ[XnXddl	Z	dd�Z
Gd	d
�d
e	jd�ZGdd
�d
e�Z
e
e
ejejejej�Gdd�de�Ze
eej�Gdd�de	jd�ZGdd�de�ZGdd�de�Ze
eejej�Gdd�de�Ze
eej�Gdd�dejee�Ze
eejej�Gdd�dejee�Ze
eej�dS)�)�
_bootstrap)�_bootstrap_external)�	machinery�N�_frozen_importlibcGs`xZ|D]R}|j|�tdk	rytt|j�}Wn tk
rLtt|j�}YnX|j|�qWdS)N)�registerr�getattr�__name__�AttributeError�_frozen_importlib_external)�abstract_cls�classes�cls�
frozen_cls�r�%/usr/lib64/python3.6/importlib/abc.py�	_registers

rc@seZdZejddd��ZdS)�FinderNcCsdS)Nr)�self�fullname�pathrrr�find_module'szFinder.find_module)N)r	�
__module__�__qualname__�abc�abstractmethodrrrrrrs
r)�	metaclassc@seZdZdd�Zdd�ZdS)�MetaPathFindercCs,t|d�sdS|j||�}|dk	r(|jSdS)N�	find_spec)�hasattrr�loader)rrr�foundrrrr6s
zMetaPathFinder.find_modulecCsdS)Nr)rrrr�invalidate_cachesFsz MetaPathFinder.invalidate_cachesN)r	rrrr"rrrrr/src@s"eZdZdd�ZejZdd�ZdS)�PathEntryFindercCsLt|d�sdgfS|j|�}|dk	r@|js0g}n|j}|j|fSdgfSdS)Nr)rr�submodule_search_locationsr )rrr!�portionsrrr�find_loaderVs


zPathEntryFinder.find_loadercCsdS)Nr)rrrrr"ssz!PathEntryFinder.invalidate_cachesN)r	rrr&r�_find_module_shimrr"rrrrr#Osr#c@s$eZdZdd�Zdd�Zdd�ZdS)�LoadercCsdS)Nr)r�specrrr�
create_moduleszLoader.create_modulecCst|d�st�tj||�S)N�exec_module)r�ImportErrorr�_load_module_shim)rrrrr�load_module�s
zLoader.load_modulecCst�dS)N)�NotImplementedError)r�modulerrr�module_repr�s
zLoader.module_reprN)r	rrr*r.r1rrrrr({s
r(c@seZdZejdd��ZdS)�ResourceLoadercCst�dS)N)�IOError)rrrrr�get_data�szResourceLoader.get_dataN)r	rrrrr4rrrrr2�s	r2c@sHeZdZdd�Zdd�Zejdd��Zeddd	��Z	e
jjZe
jj
Z
d
S)�
InspectLoadercCst�dS)N)r,)rrrrr�
is_package�szInspectLoader.is_packagecCs |j|�}|dkrdS|j|�S)N)�
get_source�source_to_code)rr�sourcerrr�get_code�s
zInspectLoader.get_codecCst�dS)N)r,)rrrrrr7�szInspectLoader.get_source�<string>cCst||ddd�S)N�execT)�dont_inherit)�compile)�datarrrrr8�szInspectLoader.source_to_codeN)r;)r	rrr6r:rrr7�staticmethodr8r�
_LoaderBasicsr+r.rrrrr5�s	
	r5c@s"eZdZejdd��Zdd�ZdS)�ExecutionLoadercCst�dS)N)r,)rrrrr�get_filename�szExecutionLoader.get_filenamecCsP|j|�}|dkrdSy|j|�}Wntk
r>|j|�SX|j||�SdS)N)r7rCr,r8)rrr9rrrrr:s
zExecutionLoader.get_codeN)r	rrrrrCr:rrrrrB�s		rBc@seZdZdS)�
FileLoaderN)r	rrrrrrrDsrDc@s$eZdZdd�Zdd�Zdd�ZdS)�SourceLoadercCs$|jjtjkrt�t|j|�d�S)N�mtime)�
path_stats�__func__rEr3�int)rrrrr�
path_mtime.szSourceLoader.path_mtimecCs |jjtjkrt�d|j|�iS)NrF)rJrHrEr3)rrrrrrG4szSourceLoader.path_statscCsdS)Nr)rrr?rrr�set_data?szSourceLoader.set_dataN)r	rrrJrGrKrrrrrEsrE)�rrrrr,�exc�namerrr�ABCMetarr�BuiltinImporter�FrozenImporter�
PathFinder�WindowsRegistryFinderr#�
FileFinderr(r2r5rB�ExtensionFileLoaderrD�SourceFileLoader�SourcelessFileLoaderrErrrr�<module>s>
)/2",__pycache__/_bootstrap_external.cpython-36.pyc000064400000116305150327175300015471 0ustar003

�\dhm��@s&dZdnZdoZeeZdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdpdd�Z
ee
j�Zdjdd�dZejed�ZdZdZdgZd gZeZZdqd!d"�d#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Z d-d.�Z!d/d0�Z"drd1d2�Z#dsd3d4�Z$dtd6d7�Z%d8d9�Z&e'�Z(dud!e(d:�d;d<�Z)Gd=d>�d>�Z*Gd?d@�d@�Z+GdAdB�dBe+�Z,GdCdD�dD�Z-GdEdF�dFe-e,�Z.GdGdH�dHe-e+�Z/gZ0GdIdJ�dJe-e+�Z1GdKdL�dL�Z2GdMdN�dN�Z3GdOdP�dP�Z4GdQdR�dR�Z5dvdSdT�Z6dUdV�Z7dWdX�Z8dYdZ�Z9d[d\d]d^d_d`dadbdcdddedfdgdhdidjdk�Z:dldm�Z;d!S)wa^Core implementation of path-based import.

This module is NOT meant to be directly imported! It has been designed such
that it can be bootstrapped into Python as the implementation of import. As
such it requires the injection of specific modules and attributes in order to
work. One should use importlib as the public-facing version of this module.

�win�cygwin�darwincs<tjjt�r0tjjt�rd�nd��fdd�}ndd�}|S)N�PYTHONCASEOKsPYTHONCASEOKcs
�tjkS)z5True if filenames must be checked case-insensitively.)�_os�environ�)�keyr�5/usr/lib64/python3.6/importlib/_bootstrap_external.py�_relax_case%sz%_make_relax_case.<locals>._relax_casecSsdS)z5True if filenames must be checked case-insensitively.Frrrrr	r
)s)�sys�platform�
startswith�_CASE_INSENSITIVE_PLATFORMS�#_CASE_INSENSITIVE_PLATFORMS_STR_KEY)r
r)rr	�_make_relax_casesrcCst|�d@jdd�S)z*Convert a 32-bit integer to little-endian.l����little)�int�to_bytes)�xrrr	�_w_long/srcCstj|d�S)z/Convert 4 bytes in little-endian to an integer.r)r�
from_bytes)�	int_bytesrrr	�_r_long4srcGstjdd�|D��S)zReplacement for os.path.join().cSsg|]}|r|jt��qSr)�rstrip�path_separators)�.0�partrrr	�
<listcomp>;sz_path_join.<locals>.<listcomp>)�path_sep�join)�
path_partsrrr	�
_path_join9s
r"cCs`tt�dkr$|jt�\}}}||fSx2t|�D]&}|tkr.|j|dd�\}}||fSq.Wd|fS)z Replacement for os.path.split().�)�maxsplit�)�lenr�
rpartitionr�reversed�rsplit)�path�front�_�tailrrrr	�_path_split?sr.cCs
tj|�S)z~Stat the path.

    Made a separate function to make it easier to override in experiments
    (e.g. cache stat results).

    )r�stat)r*rrr	�
_path_statKsr0cCs0yt|�}Wntk
r dSX|jd@|kS)z1Test whether the path is the specified mode type.Fi�)r0�OSError�st_mode)r*�mode�	stat_inforrr	�_path_is_mode_typeUs
r5cCs
t|d�S)zReplacement for os.path.isfile.i�)r5)r*rrr	�_path_isfile^sr6cCs|stj�}t|d�S)zReplacement for os.path.isdir.i@)r�getcwdr5)r*rrr	�_path_isdircsr8�cCs�dj|t|��}tj|tjtjBtjB|d@�}y2tj|d��}|j	|�WdQRXtj
||�Wn:tk
r�ytj|�Wntk
r�YnX�YnXdS)z�Best-effort function to write data to a path atomically.
    Be prepared to handle a FileExistsError if concurrent writing of the
    temporary file is attempted.z{}.{}i��wbN)
�format�idr�open�O_EXCL�O_CREAT�O_WRONLY�_io�FileIO�write�replacer1�unlink)r*�datar3�path_tmp�fd�filerrr	�
_write_atomicjsrJi3
�rs
�__pycache__zopt-z.pyz.pycN)�optimizationcCs�|dk	r4tjdt�|dk	r(d}t|��|r0dnd}tj|�}t|�\}}|jd�\}}}tj	j
}	|	dkrrtd��dj|r~|n|||	g�}
|dkr�tj
jdkr�d}ntj
j}t|�}|dkr�|j�s�td	j|���d
j|
t|�}
t|t|
td�S)a�Given the path to a .py file, return the path to its .pyc file.

    The .py file does not need to exist; this simply returns the path to the
    .pyc file calculated as if the .py file were imported.

    The 'optimization' parameter controls the presumed optimization level of
    the bytecode file. If 'optimization' is not None, the string representation
    of the argument is taken and verified to be alphanumeric (else ValueError
    is raised).

    The debug_override parameter is deprecated. If debug_override is not None,
    a True value is the same as setting 'optimization' to the empty string
    while a False value is equivalent to setting 'optimization' to '1'.

    If sys.implementation.cache_tag is None then NotImplementedError is raised.

    NzFthe debug_override parameter is deprecated; use 'optimization' insteadz2debug_override or optimization must be set to Noner%r#�.z$sys.implementation.cache_tag is None�z{!r} is not alphanumericz{}.{}{})�	_warnings�warn�DeprecationWarning�	TypeErrorr�fspathr.r'r�implementation�	cache_tag�NotImplementedErrorr �flags�optimize�str�isalnum�
ValueErrorr;�_OPTr"�_PYCACHE�BYTECODE_SUFFIXES)r*�debug_overriderM�message�headr-�base�sep�rest�tag�almost_filenamerrr	�cache_from_sources0
rhcCs�tjjdkrtd��tj|�}t|�\}}t|�\}}|tkrNtdj	t|���|j
d�}|dkrptdj	|���nV|dkr�|jdd�d}|jt
�s�tdj	t
���|tt
�d�}|j�s�td	j	|���|jd�d
}t||td
�S)
anGiven the path to a .pyc. file, return the path to its .py file.

    The .pyc file does not need to exist; this simply returns the path to
    the .py file calculated to correspond to the .pyc file.  If path does
    not conform to PEP 3147/488 format, ValueError will be raised. If
    sys.implementation.cache_tag is None then NotImplementedError is raised.

    Nz$sys.implementation.cache_tag is Nonez%{} not bottom-level directory in {!r}rNrK�z!expected only 2 or 3 dots in {!r}z9optimization portion of filename does not start with {!r}z4optimization level {!r} is not an alphanumeric valuerO>rKri���)rrUrVrWrrTr.r^r\r;�countr)r
r]r&r[�	partitionr"�SOURCE_SUFFIXES)r*rb�pycache_filename�pycache�	dot_countrM�	opt_level�
base_filenamerrr	�source_from_cache4s.	




rscCs�t|�dkrdS|jd�\}}}|s:|j�dd�dkr>|Syt|�}Wn$ttfk
rn|dd	�}YnXt|�r||S|S)
z�Convert a bytecode file path to a source path (if possible).

    This function exists purely for backwards-compatibility for
    PyImport_ExecCodeModuleWithFilenames() in the C API.

    rONrNrir#�py������rv)r&r'�lowerrsrWr\r6)�
bytecode_pathrer,�	extension�source_pathrrr	�_get_sourcefileVsr{cCsH|jtt��r.yt|�Stk
r*YqDXn|jtt��r@|SdSdS)N)�endswith�tuplermrhrWr_)�filenamerrr	�_get_cachedisrcCs4yt|�j}Wntk
r&d}YnX|dO}|S)z3Calculate the mode permissions for a bytecode file.i��)r0r2r1)r*r3rrr	�
_calc_modeus
r�csDd�fdd�	}y
tj}Wntk
r4dd�}YnX||��|S)z�Decorator to verify that the module being requested matches the one the
    loader can handle.

    The first argument (self) must define _name which the second argument is
    compared against. If the comparison fails then ImportError is raised.

    NcsB|dkr|j}n |j|kr0td|j|f|d���||f|�|�S)Nzloader for %s cannot handle %s)�name)r��ImportError)�selfr��args�kwargs)�methodrr	�_check_name_wrapper�s
z(_check_name.<locals>._check_name_wrappercSs<x(dD] }t||�rt||t||��qW|jj|j�dS)N�
__module__�__name__�__qualname__�__doc__)r�r�r�r�)�hasattr�setattr�getattr�__dict__�update)�new�oldrDrrr	�_wrap�s

z_check_name.<locals>._wrap)N)�
_bootstrapr��	NameError)r�r�r�r)r�r	�_check_name�s

r�cCs<|j|�\}}|dkr8t|�r8d}tj|j|d�t�|S)z�Try to find a loader for the specified module by delegating to
    self.find_loader().

    This method is deprecated in favor of finder.find_spec().

    Nz,Not importing directory {}: missing __init__rO)�find_loaderr&rPrQr;�
ImportWarning)r��fullname�loader�portions�msgrrr	�_find_module_shim�s

r�cCs�i}|dk	r||d<nd}|dk	r*||d<|dd�}|dd�}|dd�}|tkr|dj||�}tjd	|�t|f|��nVt|�dkr�d
j|�}tjd	|�t|��n*t|�dkr�dj|�}tjd	|�t|��|dk	�r|yt|d�}	Wntk
�rYn2Xt	|�|	k�r4d
j|�}tjd	|�t|f|��y|dd@}
Wntk
�rZYn"Xt	|�|
k�r|td
j|�f|��|dd�S)azValidate the header of the passed-in bytecode against source_stats (if
    given) and returning the bytecode that can be compiled by compile().

    All other arguments are used to enhance error reporting.

    ImportError is raised when the magic number is incorrect or the bytecode is
    found to be stale. EOFError is raised when the data is found to be
    truncated.

    Nr�z
<bytecode>r*r��zbad magic number in {!r}: {!r}z{}z+reached EOF while reading timestamp in {!r}z0reached EOF while reading size of source in {!r}�mtimezbytecode is stale for {!r}�sizel��)
�MAGIC_NUMBERr;r��_verbose_messager�r&�EOFErrorr�KeyErrorr)rF�source_statsr�r*�exc_details�magic�
raw_timestamp�raw_sizera�source_mtime�source_sizerrr	�_validate_bytecode_header�sL





r�cCsPtj|�}t|t�r8tjd|�|dk	r4tj||�|Stdj	|�||d��dS)z<Compile bytecode as returned by _validate_bytecode_header().zcode object from {!r}NzNon-code object in {!r})r�r*)
�marshal�loads�
isinstance�
_code_typer�r��_imp�_fix_co_filenamer�r;)rFr�rxrz�coderrr	�_compile_bytecode�s


r�rOcCs8tt�}|jt|��|jt|��|jtj|��|S)zPCompile a code object into bytecode for writing out to a byte-compiled
    file.)�	bytearrayr��extendrr��dumps)r�r�r�rFrrr	�_code_to_bytecode�s
r�cCs>ddl}tj|�j}|j|�}tjdd�}|j|j|d��S)zyDecode bytes representing source code and return the string.

    Universal newline support is used in the decoding.
    rONT)�tokenizerA�BytesIO�readline�detect_encoding�IncrementalNewlineDecoder�decode)�source_bytesr��source_bytes_readline�encoding�newline_decoderrrr	�
decode_source�s

r�)r��submodule_search_locationsc	Cs|dkr<d}t|d�rFy|j|�}WqFtk
r8YqFXn
tj|�}tj|||d�}d|_|dkr�x6t�D](\}}|j	t
|��rl|||�}||_PqlWdS|tkr�t|d�r�y|j
|�}Wntk
r�Yq�X|r�g|_n||_|jgk�r|�rt|�d}|jj|�|S)a=Return a module spec based on a file location.

    To indicate that the module is a package, set
    submodule_search_locations to a list of directory paths.  An
    empty list is sufficient, though its not otherwise useful to the
    import system.

    The loader must take a spec as its only __init__() arg.

    Nz	<unknown>�get_filename)�originT�
is_packagerO)r�r�r�rrTr��
ModuleSpec�
_set_fileattr�_get_supported_file_loadersr|r}r��	_POPULATEr�r�r.�append)	r��locationr�r��spec�loader_class�suffixesr��dirnamerrr	�spec_from_file_locations>



r�c@sPeZdZdZdZdZdZedd��Zedd��Z	edd
d��Z
eddd
��Zd	S)�WindowsRegistryFinderz>Meta path finder for modules declared in the Windows registry.z;Software\Python\PythonCore\{sys_version}\Modules\{fullname}zASoftware\Python\PythonCore\{sys_version}\Modules\{fullname}\DebugFcCs2ytjtj|�Stk
r,tjtj|�SXdS)N)�_winreg�OpenKey�HKEY_CURRENT_USERr1�HKEY_LOCAL_MACHINE)�clsrrrr	�_open_registry\sz$WindowsRegistryFinder._open_registrycCsp|jr|j}n|j}|j|dtjdd�d�}y&|j|��}tj|d�}WdQRXWnt	k
rjdSX|S)Nz%d.%drK)r��sys_versionr%)
�DEBUG_BUILD�REGISTRY_KEY_DEBUG�REGISTRY_KEYr;r�version_infor�r��
QueryValuer1)r�r��registry_keyr�hkey�filepathrrr	�_search_registrycsz&WindowsRegistryFinder._search_registryNcCsx|j|�}|dkrdSyt|�Wntk
r6dSXx:t�D]0\}}|jt|��r@tj||||�|d�}|Sq@WdS)N)r�)r�r0r1r�r|r}r��spec_from_loader)r�r�r*�targetr�r�r�r�rrr	�	find_specrs
zWindowsRegistryFinder.find_speccCs"|j||�}|dk	r|jSdSdS)zlFind module named in the registry.

        This method is deprecated.  Use exec_module() instead.

        N)r�r�)r�r�r*r�rrr	�find_module�sz!WindowsRegistryFinder.find_module)NN)N)r�r�r�r�r�r�r��classmethodr�r�r�r�rrrr	r�Psr�c@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�
_LoaderBasicszSBase class of common code needed by both SourceLoader and
    SourcelessFileLoader.cCs@t|j|��d}|jdd�d}|jd�d}|dko>|dkS)z�Concrete implementation of InspectLoader.is_package by checking if
        the path returned by get_filename has a filename of '__init__.py'.r#rNrOrK�__init__)r.r�r)r')r�r�r~�
filename_base�	tail_namerrr	r��sz_LoaderBasics.is_packagecCsdS)z*Use default semantics for module creation.Nr)r�r�rrr	�
create_module�sz_LoaderBasics.create_modulecCs8|j|j�}|dkr$tdj|j���tjt||j�dS)zExecute the module.Nz4cannot load module {!r} when get_code() returns None)�get_coder�r�r;r��_call_with_frames_removed�execr�)r��moduler�rrr	�exec_module�s

z_LoaderBasics.exec_modulecCstj||�S)zThis module is deprecated.)r��_load_module_shim)r�r�rrr	�load_module�sz_LoaderBasics.load_moduleN)r�r�r�r�r�r�r�r�rrrr	r��s
r�c@sJeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�d
d�Zdd�Z	dS)�SourceLoadercCst�dS)z�Optional method that returns the modification time (an int) for the
        specified path, where path is a str.

        Raises IOError when the path cannot be handled.
        N)�IOError)r�r*rrr	�
path_mtime�szSourceLoader.path_mtimecCsd|j|�iS)a�Optional method returning a metadata dict for the specified path
        to by the path (str).
        Possible keys:
        - 'mtime' (mandatory) is the numeric timestamp of last source
          code modification;
        - 'size' (optional) is the size in bytes of the source code.

        Implementing this method allows the loader to read bytecode files.
        Raises IOError when the path cannot be handled.
        r�)r�)r�r*rrr	�
path_stats�szSourceLoader.path_statscCs|j||�S)z�Optional method which writes data (bytes) to a file path (a str).

        Implementing this method allows for the writing of bytecode files.

        The source path is needed in order to correctly transfer permissions
        )�set_data)r�rz�
cache_pathrFrrr	�_cache_bytecode�szSourceLoader._cache_bytecodecCsdS)z�Optional method which writes data (bytes) to a file path (a str).

        Implementing this method allows for the writing of bytecode files.
        Nr)r�r*rFrrr	r��szSourceLoader.set_datacCsR|j|�}y|j|�}Wn0tk
rH}ztd|d�|�WYdd}~XnXt|�S)z4Concrete implementation of InspectLoader.get_source.z'source not available through get_data())r�N)r��get_datar1r�r�)r�r�r*r��excrrr	�
get_source�s
zSourceLoader.get_sourcer#)�	_optimizecCstjt||dd|d�S)z�Return the code object compiled from source.

        The 'data' argument can be any object type that compile() supports.
        r�T)�dont_inheritrY)r�r��compile)r�rFr*rrrr	�source_to_code�szSourceLoader.source_to_codec
+Cs^|j|�}d}yt|�}Wntk
r2d}Yn�Xy|j|�}Wntk
rVYn~Xt|d�}y|j|�}Wntk
r�YnNXyt||||d�}Wnt	t
fk
r�Yn Xtjd||�t
||||d�S|j|�}|j||�}	tjd|�tj�rZ|dk	�rZ|dk	�rZt|	|t|��}y|j|||�tjd|�Wntk
�rXYnX|	S)z�Concrete implementation of InspectLoader.get_code.

        Reading of bytecode requires path_stats to be implemented. To write
        bytecode, set_data must also be implemented.

        Nr�)r�r�r*z
{} matches {})r�rxrzzcode object from {}z
wrote {!r})r�rhrWr�r�rr�r1r�r�r�r�r�r�rr�dont_write_bytecoder�r&r�)
r�r�rzr�rx�strF�
bytes_datar��code_objectrrr	r��sN




zSourceLoader.get_codeNrv)
r�r�r�r�r�r�r�rrr�rrrr	r��s


r�csPeZdZdZdd�Zdd�Zdd�Ze�fdd	��Zed
d��Z	dd
�Z
�ZS)�
FileLoaderzgBase file loader class which implements the loader protocol methods that
    require file system usage.cCs||_||_dS)zKCache the module name and the path to the file found by the
        finder.N)r�r*)r�r�r*rrr	r� szFileLoader.__init__cCs|j|jko|j|jkS)N)�	__class__r�)r��otherrrr	�__eq__&szFileLoader.__eq__cCst|j�t|j�AS)N)�hashr�r*)r�rrr	�__hash__*szFileLoader.__hash__cstt|�j|�S)zdLoad a module from a file.

        This method is deprecated.  Use exec_module() instead.

        )�superr	r�)r�r�)r
rr	r�-s
zFileLoader.load_modulecCs|jS)z:Return the path to the source file as found by the finder.)r*)r�r�rrr	r�9szFileLoader.get_filenamec	Cs tj|d��
}|j�SQRXdS)z'Return the data from path as raw bytes.�rN)rArB�read)r�r*rIrrr	r�>szFileLoader.get_data)r�r�r�r�r�rrr�r�r�r��
__classcell__rr)r
r	r	sr	c@s.eZdZdZdd�Zdd�Zdd�dd	�Zd
S)�SourceFileLoaderz>Concrete implementation of SourceLoader using the file system.cCst|�}|j|jd�S)z!Return the metadata for the path.)r�r�)r0�st_mtime�st_size)r�r*rrrr	r�HszSourceFileLoader.path_statscCst|�}|j|||d�S)N)�_mode)r�r�)r�rzrxrFr3rrr	r�Msz SourceFileLoader._cache_bytecodei�)rc	Cs�t|�\}}g}x(|r8t|�r8t|�\}}|j|�qWxlt|�D]`}t||�}ytj|�WqDtk
rvwDYqDtk
r�}zt	j
d||�dSd}~XqDXqDWyt|||�t	j
d|�Wn0tk
r�}zt	j
d||�WYdd}~XnXdS)zWrite bytes data to a file.zcould not create {!r}: {!r}Nzcreated {!r})r.r8r�r(r"r�mkdir�FileExistsErrorr1r�r�rJ)	r�r*rFr�parentr~r!rr�rrr	r�Rs*
zSourceFileLoader.set_dataN)r�r�r�r�r�r�r�rrrr	rDsrc@s eZdZdZdd�Zdd�ZdS)�SourcelessFileLoaderz-Loader which handles sourceless file imports.cCs0|j|�}|j|�}t|||d�}t|||d�S)N)r�r*)r�rx)r�r�r�r�)r�r�r*rFrrrr	r�us

zSourcelessFileLoader.get_codecCsdS)z'Return None as there is no source code.Nr)r�r�rrr	r{szSourcelessFileLoader.get_sourceN)r�r�r�r�r�rrrrr	rqsrc@s\eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zedd��Z
dS)�ExtensionFileLoaderz]Loader for extension modules.

    The constructor is designed to work with FileFinder.

    cCs||_||_dS)N)r�r*)r�r�r*rrr	r��szExtensionFileLoader.__init__cCs|j|jko|j|jkS)N)r
r�)r�rrrr	r�szExtensionFileLoader.__eq__cCst|j�t|j�AS)N)r
r�r*)r�rrr	r�szExtensionFileLoader.__hash__cCs$tjtj|�}tjd|j|j�|S)z&Create an unitialized extension modulez&extension module {!r} loaded from {!r})r�r�r��create_dynamicr�r�r*)r�r�r�rrr	r��s

z!ExtensionFileLoader.create_modulecCs$tjtj|�tjd|j|j�dS)zInitialize an extension modulez(extension module {!r} executed from {!r}N)r�r�r��exec_dynamicr�r�r*)r�r�rrr	r��szExtensionFileLoader.exec_modulecs$t|j�d�t�fdd�tD��S)z1Return True if the extension module is a package.r#c3s|]}�d|kVqdS)r�Nr)r�suffix)�	file_namerr	�	<genexpr>�sz1ExtensionFileLoader.is_package.<locals>.<genexpr>)r.r*�any�EXTENSION_SUFFIXES)r�r�r)rr	r��szExtensionFileLoader.is_packagecCsdS)z?Return None as an extension module cannot create a code object.Nr)r�r�rrr	r��szExtensionFileLoader.get_codecCsdS)z5Return None as extension modules have no source code.Nr)r�r�rrr	r�szExtensionFileLoader.get_sourcecCs|jS)z:Return the path to the source file as found by the finder.)r*)r�r�rrr	r��sz ExtensionFileLoader.get_filenameN)r�r�r�r�r�rrr�r�r�r�rr�r�rrrr	r�src@s`eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dS)�_NamespacePatha&Represents a namespace package's path.  It uses the module name
    to find its parent module, and from there it looks up the parent's
    __path__.  When this changes, the module's own path is recomputed,
    using path_finder.  For top-level modules, the parent module's path
    is sys.path.cCs$||_||_t|j��|_||_dS)N)�_name�_pathr}�_get_parent_path�_last_parent_path�_path_finder)r�r�r*�path_finderrrr	r��sz_NamespacePath.__init__cCs&|jjd�\}}}|dkrdS|dfS)z>Returns a tuple of (parent-module-name, parent-path-attr-name)rNr%rr*�__path__)rr*)r$r')r�r�dot�merrr	�_find_parent_path_names�sz&_NamespacePath._find_parent_path_namescCs|j�\}}ttj||�S)N)r-r�r�modules)r��parent_module_name�path_attr_namerrr	r&�sz_NamespacePath._get_parent_pathcCsPt|j��}||jkrJ|j|j|�}|dk	rD|jdkrD|jrD|j|_||_|jS)N)r}r&r'r(r$r�r�r%)r��parent_pathr�rrr	�_recalculate�s
z_NamespacePath._recalculatecCst|j��S)N)�iterr2)r�rrr	�__iter__�sz_NamespacePath.__iter__cCs||j|<dS)N)r%)r��indexr*rrr	�__setitem__�sz_NamespacePath.__setitem__cCst|j��S)N)r&r2)r�rrr	�__len__�sz_NamespacePath.__len__cCsdj|j�S)Nz_NamespacePath({!r}))r;r%)r�rrr	�__repr__�sz_NamespacePath.__repr__cCs||j�kS)N)r2)r��itemrrr	�__contains__�sz_NamespacePath.__contains__cCs|jj|�dS)N)r%r�)r�r9rrr	r��sz_NamespacePath.appendN)r�r�r�r�r�r-r&r2r4r6r7r8r:r�rrrr	r#�s

r#c@sPeZdZdd�Zedd��Zdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�ZdS)�_NamespaceLoadercCst|||�|_dS)N)r#r%)r�r�r*r)rrr	r��sz_NamespaceLoader.__init__cCsdj|j�S)zsReturn repr for the module.

        The method is deprecated.  The import machinery does the job itself.

        z<module {!r} (namespace)>)r;r�)r�r�rrr	�module_repr�sz_NamespaceLoader.module_reprcCsdS)NTr)r�r�rrr	r�sz_NamespaceLoader.is_packagecCsdS)Nr%r)r�r�rrr	rsz_NamespaceLoader.get_sourcecCstddddd�S)Nr%z<string>r�T)r)r)r�r�rrr	r�sz_NamespaceLoader.get_codecCsdS)z*Use default semantics for module creation.Nr)r�r�rrr	r�sz_NamespaceLoader.create_modulecCsdS)Nr)r�r�rrr	r�sz_NamespaceLoader.exec_modulecCstjd|j�tj||�S)zbLoad a namespace module.

        This method is deprecated.  Use exec_module() instead.

        z&namespace module loaded with path {!r})r�r�r%r�)r�r�rrr	r�sz_NamespaceLoader.load_moduleN)r�r�r�r�r�r<r�rr�r�r�r�rrrr	r;�s	r;c@sjeZdZdZedd��Zedd��Zedd��Zedd	��Zeddd��Z	edd
d��Z
eddd��Zd
S)�
PathFinderz>Meta path finder for sys.path and package __path__ attributes.cCs*x$tjj�D]}t|d�r|j�qWdS)z}Call the invalidate_caches() method on all path entry finders
        stored in sys.path_importer_caches (where implemented).�invalidate_cachesN)r�path_importer_cache�valuesr�r>)r��finderrrr	r>#s
zPathFinder.invalidate_cachescCsVtjdk	rtjrtjdt�x2tjD]$}y||�Stk
rHw&Yq&Xq&WdSdS)z.Search sys.path_hooks for a finder for 'path'.Nzsys.path_hooks is empty)r�
path_hooksrPrQr�r�)r�r*�hookrrr	�_path_hooks+szPathFinder._path_hookscCsf|dkr*ytj�}Wntk
r(dSXytj|}Wn(tk
r`|j|�}|tj|<YnX|S)z�Get the finder for the path entry from sys.path_importer_cache.

        If the path entry is not in the cache, find the appropriate finder
        and cache it. If no finder is available, store None.

        r%N)rr7�FileNotFoundErrorrr?r�rD)r�r*rArrr	�_path_importer_cache8s
zPathFinder._path_importer_cachecCsRt|d�r|j|�\}}n|j|�}g}|dk	r<tj||�Stj|d�}||_|S)Nr�)r�r�r�r�r�r�r�)r�r�rAr�r�r�rrr	�_legacy_get_specNs

zPathFinder._legacy_get_specNc	Cs�g}x�|D]�}t|ttf�sq
|j|�}|dk	r
t|d�rH|j||�}n|j||�}|dkr^q
|jdk	rl|S|j}|dkr�t	d��|j
|�q
Wtj|d�}||_|SdS)z?Find the loader or namespace_path for this module/package name.Nr�zspec missing loader)
r�rZ�bytesrFr�r�rGr�r�r�r�r�r�)	r�r�r*r��namespace_path�entryrAr�r�rrr	�	_get_spec]s(



zPathFinder._get_speccCsd|dkrtj}|j|||�}|dkr(dS|jdkr\|j}|rVd|_t|||j�|_|SdSn|SdS)z�Try to find a spec for 'fullname' on sys.path or 'path'.

        The search is based on sys.path_hooks and sys.path_importer_cache.
        N�	namespace)rr*rKr�r�r�r#)r�r�r*r�r�rIrrr	r�}s
zPathFinder.find_speccCs|j||�}|dkrdS|jS)z�find the module on sys.path or 'path' based on sys.path_hooks and
        sys.path_importer_cache.

        This method is deprecated.  Use find_spec() instead.

        N)r�r�)r�r�r*r�rrr	r��szPathFinder.find_module)N)NN)N)r�r�r�r�r�r>rDrFrGrKr�r�rrrr	r=s
r=c@sZeZdZdZdd�Zdd�ZeZdd�Zdd	�Z	ddd�Z
d
d�Zedd��Z
dd�Zd
S)�
FileFinderz�File-based finder.

    Interactions with the file system are cached for performance, being
    refreshed when the directory the finder is handling has been modified.

    csXg}x(|D] \�}|j�fdd�|D��q
W||_|p:d|_d|_t�|_t�|_dS)z�Initialize with the path to search on and a variable number of
        2-tuples containing the loader and the file suffixes the loader
        recognizes.c3s|]}|�fVqdS)Nr)rr)r�rr	r �sz&FileFinder.__init__.<locals>.<genexpr>rNr#Nrv)r��_loadersr*�_path_mtime�set�_path_cache�_relaxed_path_cache)r�r*�loader_details�loadersr�r)r�r	r��s
zFileFinder.__init__cCs
d|_dS)zInvalidate the directory mtime.r#Nrv)rO)r�rrr	r>�szFileFinder.invalidate_cachescCs*|j|�}|dkrdgfS|j|jp&gfS)z�Try to find a loader for the specified module, or the namespace
        package portions. Returns (loader, list-of-portions).

        This method is deprecated.  Use find_spec() instead.

        N)r�r�r�)r�r�r�rrr	r��s
zFileFinder.find_loadercCs|||�}t||||d�S)N)r�r�)r�)r�r�r�r*�smslr�r�rrr	rK�s
zFileFinder._get_specNcCsbd}|jd�d}yt|jp"tj��j}Wntk
rBd
}YnX||jkr\|j�||_t	�rr|j
}|j�}n
|j}|}||kr�t
|j|�}xH|jD]6\}	}
d|	}t
||�}t|�r�|j|
|||g|�Sq�Wt|�}xX|jD]N\}	}
t
|j||	�}tjd|dd�||	|kr�t|�r�|j|
||d|�Sq�W|�r^tjd	|�tj|d�}
|g|
_|
SdS)zoTry to find a spec for the specified module.

        Returns the matching spec, or None if not found.
        FrNrKr#r�z	trying {})�	verbosityNzpossible namespace for {}rv)r'r0r*rr7rr1rO�_fill_cacher
rRrwrQr"rNr6rKr8r�r�r�r�)r�r�r��is_namespace�tail_moduler��cache�cache_module�	base_pathrr��
init_filename�	full_pathr�rrr	r��sF




zFileFinder.find_specc	
Cs�|j}ytj|ptj��}Wntttfk
r:g}YnXtjj	d�sTt
|�|_nNt
�}x@|D]8}|jd�\}}}|r�dj
||j��}n|}|j|�q`W||_tjj	t�r�dd�|D�|_dS)zDFill the cache of potential modules and packages for this directory.rrNz{}.{}cSsh|]}|j��qSr)rw)r�fnrrr	�	<setcomp>sz)FileFinder._fill_cache.<locals>.<setcomp>N)r*r�listdirr7rE�PermissionError�NotADirectoryErrorrrr
rPrQrlr;rw�addrrR)	r�r*�contents�lower_suffix_contentsr9r�r+r�new_namerrr	rWs"

zFileFinder._fill_cachecs��fdd�}|S)aA class method which returns a closure to use on sys.path_hook
        which will return an instance using the specified loaders and the path
        called on the closure.

        If the path called on the closure is not a directory, ImportError is
        raised.

        cs"t|�std|d���|f���S)z-Path hook for importlib.machinery.FileFinder.zonly directories are supported)r*)r8r�)r*)r�rSrr	�path_hook_for_FileFinder*sz6FileFinder.path_hook.<locals>.path_hook_for_FileFinderr)r�rSrhr)r�rSr	�	path_hook s
zFileFinder.path_hookcCsdj|j�S)NzFileFinder({!r}))r;r*)r�rrr	r82szFileFinder.__repr__)N)r�r�r�r�r�r>r�r�r�rKr�rWr�rir8rrrr	rM�s
0rMcCs�|jd�}|jd�}|sB|r$|j}n||kr8t||�}n
t||�}|sTt|||d�}y$||d<||d<||d<||d<Wntk
r�YnXdS)N�
__loader__�__spec__)r��__file__�
__cached__)�getr�rrr��	Exception)�nsr��pathname�	cpathnamer�r�rrr	�_fix_up_module8s"


rscCs*tttj��f}ttf}ttf}|||gS)z_Returns a list of file-based module loaders.

    Each item is a tuple (loader, suffixes).
    )r�_alternative_architecturesr��extension_suffixesrrmrr_)�
extensions�source�bytecoderrr	r�Osr�cCs�|atjatjatjt}x8dD]0}|tjkr:tj|�}n
tj|}t|||�q Wddgfdddgff}xv|D]f\}}td	d
�|D��s�t�|d}|tjkr�tj|}Pqpytj|�}PWqpt	k
r�wpYqpXqpWt	d��t|d
|�t|d|�t|ddj
|��ytjd�}	Wnt	k
�r4d}	YnXt|d|	�tjd�}
t|d|
�|dk�rxtjd�}t|d|�t|dt��tj
ttj���|dk�r�tjd�dtk�r�dt_dS)z�Setup the path-based importers for importlib by importing needed
    built-in modules and injecting them into the global namespace.

    Other components are extracted from the core bootstrap module.

    rArP�builtinsr��posix�/�nt�\css|]}t|�dkVqdS)r#N)r&)rrdrrr	r ssz_setup.<locals>.<genexpr>rOzimportlib requires posix or ntrrrr%�_threadN�_weakref�winregr�r
z.pywz_d.pydT)rArPryr�)r�rr�r.r��_builtin_from_namer��all�AssertionErrorr�r rr"r�rtrurmr�r�r�)�_bootstrap_module�self_module�builtin_name�builtin_module�
os_details�
builtin_osrr�	os_module�
thread_module�weakref_module�
winreg_modulerrr	�_setupZsR













r�cCs2t|�t�}tjjtj|�g�tjjt	�dS)z)Install the path-based import components.N)
r�r�rrBr�rMri�	meta_pathr�r=)r��supported_loadersrrr	�_install�sr�z-arm-linux-gnueabihf.z-armeb-linux-gnueabihf.z-mips64-linux-gnuabi64.z-mips64el-linux-gnuabi64.z-powerpc-linux-gnu.z-powerpc-linux-gnuspe.z-powerpc64-linux-gnu.z-powerpc64le-linux-gnu.z-arm-linux-gnueabi.z-armeb-linux-gnueabi.z-mips64-linux-gnu.z-mips64el-linux-gnu.z-ppc-linux-gnu.z-ppc-linux-gnuspe.z-ppc64-linux-gnu.z-ppc64le-linux-gnu.)z-arm-linux-gnueabi.z-armeb-linux-gnueabi.z-mips64-linux-gnu.z-mips64el-linux-gnu.z-ppc-linux-gnu.z-ppc-linux-gnuspe.z-ppc64-linux-gnu.z-ppc64le-linux-gnu.z-arm-linux-gnueabihf.z-armeb-linux-gnueabihf.z-mips64-linux-gnuabi64.z-mips64el-linux-gnuabi64.z-powerpc-linux-gnu.z-powerpc-linux-gnuspe.z-powerpc64-linux-gnu.z-powerpc64le-linux-gnu.cCsFx@|D]8}x2tj�D]&\}}||kr|j|j||��|SqWqW|S)z�Add a suffix with an alternative architecture name
    to the list of suffixes so an extension built with
    the default (upstream) setting is loadable with our Pythons
    )�	_ARCH_MAP�itemsr�rD)r�r�original�alternativerrr	rt�s
rt)r)rr)r9)N)NNN)NNN)rOrO)N)N)<r�r�%_CASE_INSENSITIVE_PLATFORMS_BYTES_KEYrrrrr"r.r0r5r6r8rJ�type�__code__r�rr�rr�_RAW_MAGIC_NUMBERr^r]rmr_�DEBUG_BYTECODE_SUFFIXES�OPTIMIZED_BYTECODE_SUFFIXESrhrsr{rr�r�r�r�r�r�r��objectr�r�r�r�r�r	rrr"rr#r;r=rMrsr�r�r�r�rtrrrr	�<module>s�
	

{-"
7


C@n)-5<*
D	__pycache__/machinery.cpython-36.pyc000064400000001670150327175300013370 0ustar003


 \L�@s�dZddlZddlmZddlmZddlmZddlmZmZm	Z	m
Z
mZddlmZdd	lm
Z
dd
lmZddlmZddlmZdd
lmZdd�ZdS)z9The machinery of importlib: finders, loaders, hooks, etc.�N�)�
ModuleSpec)�BuiltinImporter)�FrozenImporter)�SOURCE_SUFFIXES�DEBUG_BYTECODE_SUFFIXES�OPTIMIZED_BYTECODE_SUFFIXES�BYTECODE_SUFFIXES�EXTENSION_SUFFIXES)�WindowsRegistryFinder)�
PathFinder)�
FileFinder)�SourceFileLoader)�SourcelessFileLoader)�ExtensionFileLoadercCstttS)zAReturns a list of all recognized module suffixes for this process)rr	r
�rr�+/usr/lib64/python3.6/importlib/machinery.py�all_suffixessr)�__doc__�_imp�
_bootstraprrr�_bootstrap_externalrrrr	r
rrr
rrrrrrrr�<module>s__pycache__/util.cpython-36.opt-2.pyc000064400000013720150327175300013325 0ustar003


 \�*�@sddlmZddlmZddlmZddlmZddlmZddlmZddlm	Z	ddlm
Z
dd	lmZdd
lmZddl
mZdd
lZdd
lZdd
lZdd
lZdd�Zd dd�Zd!dd�Zedd��Zdd�Zdd�Zdd�ZGdd�dej�ZGdd�dej�Zd
S)"�)�abc)�module_from_spec)�
_resolve_name)�spec_from_loader)�
_find_spec)�MAGIC_NUMBER)�cache_from_source)�
decode_source)�source_from_cache)�spec_from_file_location�)�contextmanagerNcCs^|jd�s|S|s&tdt|��d���d}x|D]}|dkr>P|d7}q0Wt||d�||�S)N�.zno package specified for z% (required for relative module names)rr)�
startswith�
ValueError�reprr)�name�package�level�	character�r�&/usr/lib64/python3.6/importlib/util.py�resolve_names

rcCsx|tjkrt||�Stj|}|dkr*dSy
|j}Wn$tk
rXtdj|��d�YnX|dkrptdj|���|SdS)Nz{}.__spec__ is not setz{}.__spec__ is None)�sys�modulesr�__spec__�AttributeErrorr�format)r�path�module�specrrr�_find_spec_from_path#s



r!cCs�|jd�rt||�n|}|tjkrZ|jd�d}|rNt|dgd�}t||j�St|d�Sn`tj|}|dkrpdSy
|j}Wn$t	k
r�t
dj|��d�YnX|dkr�t
dj|���|SdS)Nrr�__path__)�fromlistz{}.__spec__ is not setz{}.__spec__ is None)rrrr�
rpartition�
__import__rr"rrrr)rr�fullname�parent_name�parentrr rrr�	find_specBs"


r)ccs�|tjk}tjj|�}|s6tt�|�}d|_|tj|<zJy
|VWn:tk
r||sxytj|=Wntk
rvYnXYnXWdd|_XdS)NTF)rr�get�type�__initializing__�	Exception�KeyError)r�	is_reloadrrrr�_module_to_loadjs


r0cstj���fdd��}|S)NcsRtjdtdd��||�}t|dd�dkrN|j|_t|d�sN|jjd�d|_|S)Nz7The import system now takes care of this automatically.�)�
stacklevel�__package__r"rr)�warnings�warn�DeprecationWarning�getattr�__name__r3�hasattrr$)�args�kwargsr)�fxnrr�set_package_wrapper�s


z(set_package.<locals>.set_package_wrapper)�	functools�wraps)r<r=r)r<r�set_package�s
r@cstj���fdd��}|S)Ncs:tjdtdd��|f|�|�}t|dd�dkr6||_|S)Nz7The import system now takes care of this automatically.r1)r2�
__loader__)r4r5r6r7rA)�selfr:r;r)r<rr�set_loader_wrapper�s
z&set_loader.<locals>.set_loader_wrapper)r>r?)r<rCr)r<r�
set_loader�srDcs*tjdtdd�tj���fdd��}|S)Nz7The import system now takes care of this automatically.r1)r2cspt|��^}||_y|j|�}Wnttfk
r6YnX|rD||_n|jd�d|_�||f|�|�SQRXdS)Nrr)r0rA�
is_package�ImportErrorrr3r$)rBr&r:r;rrE)r<rr�module_for_loader_wrapper�s
z4module_for_loader.<locals>.module_for_loader_wrapper)r4r5r6r>r?)r<rGr)r<r�module_for_loader�s
rHc@seZdZdd�Zdd�ZdS)�_LazyModulec	Cs�tj|_|jj}|jjd}|jjd}|j}i}xF|j�D]:\}}||krV|||<q<t||�t||�kr<|||<q<W|jj	j
|�|tjkr�t|�ttj|�kr�t
d|�d���|jj|�t||�S)N�__dict__�	__class__zmodule object for z. substituted in sys.modules during a lazy load)�types�
ModuleTyperKrr�loader_staterJ�items�id�loader�exec_modulerrr�updater7)	rB�attr�
original_name�
attrs_then�
original_type�	attrs_now�
attrs_updated�key�valuerrr�__getattribute__�s"

z_LazyModule.__getattribute__cCs|j|�t||�dS)N)r\�delattr)rBrTrrr�__delattr__�s
z_LazyModule.__delattr__N)r8�
__module__�__qualname__r\r^rrrrrI�s#rIc@s<eZdZedd��Zedd��Zdd�Zdd�Zd	d
�Z	dS)�
LazyLoadercCst|d�std��dS)NrRz loader must define exec_module())r9�	TypeError)rQrrr�__check_eager_loaders
zLazyLoader.__check_eager_loadercs�j����fdd�S)Ncs��||��S)Nr)r:r;)�clsrQrr�<lambda>sz$LazyLoader.factory.<locals>.<lambda>)�_LazyLoader__check_eager_loader)rdrQr)rdrQr�factorys
zLazyLoader.factorycCs|j|�||_dS)N)rfrQ)rBrQrrr�__init__
s
zLazyLoader.__init__cCs|jj|�S)N)rQ�
create_module)rBr rrrriszLazyLoader.create_modulecCs@|j|j_|j|_i}|jj�|d<|j|d<||j_t|_dS)NrJrK)rQrrArJ�copyrKrNrI)rBrrNrrrrRs

zLazyLoader.exec_moduleN)
r8r_r`�staticmethodrf�classmethodrgrhrirRrrrrra�s
ra)N)N)�r�
_bootstraprrrr�_bootstrap_externalrrr	r
r�
contextlibr
r>rrLr4rr!r)r0r@rDrHrMrI�Loaderrarrrr�<module>s.

('/__pycache__/machinery.cpython-36.opt-1.pyc000064400000001670150327175300014327 0ustar003


 \L�@s�dZddlZddlmZddlmZddlmZddlmZmZm	Z	m
Z
mZddlmZdd	lm
Z
dd
lmZddlmZddlmZdd
lmZdd�ZdS)z9The machinery of importlib: finders, loaders, hooks, etc.�N�)�
ModuleSpec)�BuiltinImporter)�FrozenImporter)�SOURCE_SUFFIXES�DEBUG_BYTECODE_SUFFIXES�OPTIMIZED_BYTECODE_SUFFIXES�BYTECODE_SUFFIXES�EXTENSION_SUFFIXES)�WindowsRegistryFinder)�
PathFinder)�
FileFinder)�SourceFileLoader)�SourcelessFileLoader)�ExtensionFileLoadercCstttS)zAReturns a list of all recognized module suffixes for this process)rr	r
�rr�+/usr/lib64/python3.6/importlib/machinery.py�all_suffixessr)�__doc__�_imp�
_bootstraprrr�_bootstrap_externalrrrr	r
rrr
rrrrrrrr�<module>s__pycache__/util.cpython-36.pyc000064400000021306150327175300012364 0ustar003


 \�*�@sdZddlmZddlmZddlmZddlmZddlmZddlm	Z	ddlm
Z
dd	lmZdd
lmZddlm
Z
dd
lmZddlZddlZddlZddlZdd�Zd!dd�Zd"dd�Zedd��Zdd�Zdd�Zdd�ZGdd�dej�ZGdd �d ej�ZdS)#z-Utility code for constructing importers, etc.�)�abc)�module_from_spec)�
_resolve_name)�spec_from_loader)�
_find_spec)�MAGIC_NUMBER)�cache_from_source)�
decode_source)�source_from_cache)�spec_from_file_location�)�contextmanagerNcCs^|jd�s|S|s&tdt|��d���d}x|D]}|dkr>P|d7}q0Wt||d�||�S)z2Resolve a relative module name to an absolute one.�.zno package specified for z% (required for relative module names)rrN)�
startswith�
ValueError�reprr)�name�package�level�	character�r�&/usr/lib64/python3.6/importlib/util.py�resolve_names

rcCsx|tjkrt||�Stj|}|dkr*dSy
|j}Wn$tk
rXtdj|��d�YnX|dkrptdj|���|SdS)a�Return the spec for the specified module.

    First, sys.modules is checked to see if the module was already imported. If
    so, then sys.modules[name].__spec__ is returned. If that happens to be
    set to None, then ValueError is raised. If the module is not in
    sys.modules, then sys.meta_path is searched for a suitable spec with the
    value of 'path' given to the finders. None is returned if no spec could
    be found.

    Dotted names do not have their parent packages implicitly imported. You will
    most likely need to explicitly import all parent packages in the proper
    order for a submodule to get the correct spec.

    Nz{}.__spec__ is not setz{}.__spec__ is None)�sys�modulesr�__spec__�AttributeErrorr�format)r�path�module�specrrr�_find_spec_from_path#s



r!cCs�|jd�rt||�n|}|tjkrZ|jd�d}|rNt|dgd�}t||j�St|d�Sn`tj|}|dkrpdSy
|j}Wn$t	k
r�t
dj|��d�YnX|dkr�t
dj|���|SdS)a�Return the spec for the specified module.

    First, sys.modules is checked to see if the module was already imported. If
    so, then sys.modules[name].__spec__ is returned. If that happens to be
    set to None, then ValueError is raised. If the module is not in
    sys.modules, then sys.meta_path is searched for a suitable spec with the
    value of 'path' given to the finders. None is returned if no spec could
    be found.

    If the name is for submodule (contains a dot), the parent module is
    automatically imported.

    The name and package arguments work the same as importlib.import_module().
    In other words, relative module names (with leading dots) work.

    rr�__path__)�fromlistNz{}.__spec__ is not setz{}.__spec__ is None)rrrr�
rpartition�
__import__rr"rrrr)rr�fullname�parent_name�parentrr rrr�	find_specBs"


r)ccs�|tjk}tjj|�}|s6tt�|�}d|_|tj|<zJy
|VWn:tk
r||sxytj|=Wntk
rvYnXYnXWdd|_XdS)NTF)rr�get�type�__initializing__�	Exception�KeyError)r�	is_reloadrrrr�_module_to_loadjs


r0cstj���fdd��}|S)zOSet __package__ on the returned module.

    This function is deprecated.

    csRtjdtdd��||�}t|dd�dkrN|j|_t|d�sN|jjd�d|_|S)Nz7The import system now takes care of this automatically.�)�
stacklevel�__package__r"rr)�warnings�warn�DeprecationWarning�getattr�__name__r3�hasattrr$)�args�kwargsr)�fxnrr�set_package_wrapper�s


z(set_package.<locals>.set_package_wrapper)�	functools�wraps)r<r=r)r<r�set_package�s
r@cstj���fdd��}|S)zNSet __loader__ on the returned module.

    This function is deprecated.

    cs:tjdtdd��|f|�|�}t|dd�dkr6||_|S)Nz7The import system now takes care of this automatically.r1)r2�
__loader__)r4r5r6r7rA)�selfr:r;r)r<rr�set_loader_wrapper�s
z&set_loader.<locals>.set_loader_wrapper)r>r?)r<rCr)r<r�
set_loader�srDcs*tjdtdd�tj���fdd��}|S)a*Decorator to handle selecting the proper module for loaders.

    The decorated function is passed the module to use instead of the module
    name. The module passed in to the function is either from sys.modules if
    it already exists or is a new module. If the module is new, then __name__
    is set the first argument to the method, __loader__ is set to self, and
    __package__ is set accordingly (if self.is_package() is defined) will be set
    before it is passed to the decorated function (if self.is_package() does
    not work for the module it will be set post-load).

    If an exception is raised and the decorator created the module it is
    subsequently removed from sys.modules.

    The decorator assumes that the decorated function takes the module name as
    the second argument.

    z7The import system now takes care of this automatically.r1)r2cspt|��^}||_y|j|�}Wnttfk
r6YnX|rD||_n|jd�d|_�||f|�|�SQRXdS)Nrr)r0rA�
is_package�ImportErrorrr3r$)rBr&r:r;rrE)r<rr�module_for_loader_wrapper�s
z4module_for_loader.<locals>.module_for_loader_wrapper)r4r5r6r>r?)r<rGr)r<r�module_for_loader�s
rHc@s eZdZdZdd�Zdd�ZdS)�_LazyModulezKA subclass of the module type which triggers loading upon attribute access.c	Cs�tj|_|jj}|jjd}|jjd}|j}i}xF|j�D]:\}}||krV|||<q<t||�t||�kr<|||<q<W|jj	j
|�|tjkr�t|�ttj|�kr�t
d|�d���|jj|�t||�S)z8Trigger the load of the module and return the attribute.�__dict__�	__class__zmodule object for z. substituted in sys.modules during a lazy load)�types�
ModuleTyperKrr�loader_staterJ�items�id�loader�exec_modulerrr�updater7)	rB�attr�
original_name�
attrs_then�
original_type�	attrs_now�
attrs_updated�key�valuerrr�__getattribute__�s"

z_LazyModule.__getattribute__cCs|j|�t||�dS)z/Trigger the load and then perform the deletion.N)r\�delattr)rBrTrrr�__delattr__�s
z_LazyModule.__delattr__N)r8�
__module__�__qualname__�__doc__r\r^rrrrrI�s#rIc@s@eZdZdZedd��Zedd��Zdd�Zdd	�Z	d
d�Z
dS)
�
LazyLoaderzKA loader that creates a module which defers loading until attribute access.cCst|d�std��dS)NrRz loader must define exec_module())r9�	TypeError)rQrrr�__check_eager_loaders
zLazyLoader.__check_eager_loadercs�j����fdd�S)z>Construct a callable which returns the eager loader made lazy.cs��||��S)Nr)r:r;)�clsrQrr�<lambda>sz$LazyLoader.factory.<locals>.<lambda>)�_LazyLoader__check_eager_loader)rerQr)rerQr�factorys
zLazyLoader.factorycCs|j|�||_dS)N)rgrQ)rBrQrrr�__init__
s
zLazyLoader.__init__cCs|jj|�S)N)rQ�
create_module)rBr rrrrjszLazyLoader.create_modulecCs@|j|j_|j|_i}|jj�|d<|j|d<||j_t|_dS)zMake the module load lazily.rJrKN)rQrrArJ�copyrKrNrI)rBrrNrrrrRs

zLazyLoader.exec_moduleN)r8r_r`ra�staticmethodrg�classmethodrhrirjrRrrrrrb�srb)N)N)ra�r�
_bootstraprrrr�_bootstrap_externalrrr	r
r�
contextlibr
r>rrLr4rr!r)r0r@rDrHrMrI�Loaderrbrrrr�<module>s0

('/__pycache__/_bootstrap.cpython-36.opt-2.pyc000064400000053351150327175300014530 0ustar003


 \���@s�dadd�Zdd�ZiZiZGdd�de�ZGdd�d�ZGd	d
�d
�ZGdd�d�Z	d
d�Z
dd�Zdd�Zdd�dd�Z
dd�Zdd�Zdd�Zdd�ZGdd �d �ZGd!d"�d"�Zddd#�d$d%�Zd\d&d'�Zd(d)�d*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�Zd6d7�ZGd8d9�d9�ZGd:d;�d;�ZGd<d=�d=�Zd>d?�Z d@dA�Z!d]dBdC�Z"dDdE�Z#dFZ$e$dGZ%dHdI�Z&e'�Z(dJdK�Z)d^dMdN�Z*d(dO�dPdQ�Z+dRdS�Z,ddfdLfdTdU�Z-dVdW�Z.dXdY�Z/dZd[�Z0dS)_NcCs<x(dD] }t||�rt||t||��qW|jj|j�dS)N�
__module__�__name__�__qualname__�__doc__)rrrr)�hasattr�setattr�getattr�__dict__�update)�new�old�replace�r
�,/usr/lib64/python3.6/importlib/_bootstrap.py�_wraps

rcCstt�|�S)N)�type�sys)�namer
r
r�_new_module#src@seZdZdS)�_DeadlockErrorN)rrrr
r
r
rr0src@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�_ModuleLockcCs0tj�|_tj�|_||_d|_d|_d|_dS)N�)�_thread�
allocate_lock�lock�wakeupr�owner�count�waiters)�selfrr
r
r�__init__:s

z_ModuleLock.__init__cCs@tj�}|j}x,tj|�}|dkr&dS|j}||krdSqWdS)NFT)r�	get_identr�_blocking_on�get)r�me�tidrr
r
r�has_deadlockBs
z_ModuleLock.has_deadlockcCs�tj�}|t|<z�x�|j�`|jdks0|j|krH||_|jd7_dS|j�r\td|��|jj	d�rv|j
d7_
WdQRX|jj	�|jj�qWWdt|=XdS)Nr�Tzdeadlock detected by %rF)rr r!rrrr%rr�acquirer�release)rr$r
r
rr'Ns 
z_ModuleLock.acquirec
Csltj�}|j�T|j|kr"td��|jd8_|jdkr^d|_|jr^|jd8_|jj�WdQRXdS)Nzcannot release un-acquired lockr&r)	rr rr�RuntimeErrorrrrr()rr$r
r
rr(gs

z_ModuleLock.releasecCsdj|jt|��S)Nz_ModuleLock({!r}) at {})�formatr�id)rr
r
r�__repr__tsz_ModuleLock.__repr__N)rrrrr%r'r(r,r
r
r
rr4s

rc@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�_DummyModuleLockcCs||_d|_dS)Nr)rr)rrr
r
rr|sz_DummyModuleLock.__init__cCs|jd7_dS)Nr&T)r)rr
r
rr'�sz_DummyModuleLock.acquirecCs$|jdkrtd��|jd8_dS)Nrzcannot release un-acquired lockr&)rr))rr
r
rr(�s
z_DummyModuleLock.releasecCsdj|jt|��S)Nz_DummyModuleLock({!r}) at {})r*rr+)rr
r
rr,�sz_DummyModuleLock.__repr__N)rrrrr'r(r,r
r
r
rr-xsr-c@s$eZdZdd�Zdd�Zdd�ZdS)�_ModuleLockManagercCs||_d|_dS)N)�_name�_lock)rrr
r
rr�sz_ModuleLockManager.__init__cCst|j�|_|jj�dS)N)�_get_module_lockr/r0r')rr
r
r�	__enter__�sz_ModuleLockManager.__enter__cOs|jj�dS)N)r0r()r�args�kwargsr
r
r�__exit__�sz_ModuleLockManager.__exit__N)rrrrr2r5r
r
r
rr.�sr.cCs�tj�zjyt|�}Wntk
r0d}YnX|dkrptdkrLt|�}nt|�}|fdd�}tj||�t|<Wdtj	�X|S)Nc
Ss0tj�ztj|�|krt|=Wdtj�XdS)N)�_imp�acquire_lock�
_module_locksr"�release_lock)�refrr
r
r�cb�s

z_get_module_lock.<locals>.cb)
r6r7r8�KeyErrorrr-r�_weakrefr:r9)rrr;r
r
rr1�s


r1cCs6t|�}y|j�Wntk
r(Yn
X|j�dS)N)r1r'rr()rrr
r
r�_lock_unlock_module�sr>cOs
|||�S)Nr
)�fr3�kwdsr
r
r�_call_with_frames_removed�srAr&)�	verbositycGs6tjj|kr2|jd�sd|}t|j|�tjd�dS)N�#�import z# )�file)rCrD)r�flags�verbose�
startswith�printr*�stderr)�messagerBr3r
r
r�_verbose_message�s
rLcs�fdd�}t|��|S)Ncs&|tjkrtdj|�|d���||�S)Nz{!r} is not a built-in module)r)r�builtin_module_names�ImportErrorr*)r�fullname)�fxnr
r�_requires_builtin_wrapper�s

z4_requires_builtin.<locals>._requires_builtin_wrapper)r)rPrQr
)rPr�_requires_builtin�s
rRcs�fdd�}t|��|S)Ncs&tj|�stdj|�|d���||�S)Nz{!r} is not a frozen module)r)r6�	is_frozenrNr*)rrO)rPr
r�_requires_frozen_wrapper�s

z2_requires_frozen.<locals>._requires_frozen_wrapper)r)rPrTr
)rPr�_requires_frozen�s
rUcCs>t||�}|tjkr2tj|}t||�tj|St|�SdS)N)�spec_from_loaderr�modules�_exec�_load)rrO�spec�moduler
r
r�_load_module_shim�s




r\c#Cs�t|dd�}t|d�r6y
|j|�Stk
r4YnXy
|j}Wntk
rTYnX|dk	rft|�Sy
|j}Wntk
r�d}YnXy
|j}Wn2tk
r�|dkr�dj	|�Sdj	||�SYnXdj	||�SdS)N�
__loader__�module_repr�?z
<module {!r}>z<module {!r} ({!r})>z<module {!r} from {!r}>)
rrr^�	Exception�__spec__�AttributeError�_module_repr_from_specr�__file__r*)r[�loaderrZr�filenamer
r
r�_module_repr
s.






rgc@s$eZdZdd�Zdd�Zdd�ZdS)�_installed_safelycCs||_|j|_dS)N)�_modulera�_spec)rr[r
r
rr3sz_installed_safely.__init__cCsd|j_|jtj|jj<dS)NT)rj�
_initializingrirrWr)rr
r
rr27sz_installed_safely.__enter__cGsbzR|j}tdd�|D��r@ytj|j=WqPtk
r<YqPXntd|j|j�Wdd|j_XdS)Ncss|]}|dk	VqdS)Nr
)�.0�argr
r
r�	<genexpr>Asz-_installed_safely.__exit__.<locals>.<genexpr>zimport {!r} # {!r}F)	rj�anyrrWrr<rLrerk)rr3rZr
r
rr5>sz_installed_safely.__exit__N)rrrrr2r5r
r
r
rrh1srhc@sneZdZdddd�dd�Zdd�Zdd�Zed	d
��Zejdd
��Zedd
��Z	edd��Z
e
jdd��Z
dS)�
ModuleSpecN)�origin�loader_state�
is_packagecCs6||_||_||_||_|r gnd|_d|_d|_dS)NF)rrerqrr�submodule_search_locations�
_set_fileattr�_cached)rrrerqrrrsr
r
rrqszModuleSpec.__init__cCsfdj|j�dj|j�g}|jdk	r4|jdj|j��|jdk	rP|jdj|j��dj|jjdj|��S)Nz	name={!r}zloader={!r}zorigin={!r}zsubmodule_search_locations={}z{}({})z, )	r*rrerq�appendrt�	__class__r�join)rr3r
r
rr,}s



zModuleSpec.__repr__cCsf|j}yF|j|jkoL|j|jkoL|j|jkoL||jkoL|j|jkoL|j|jkStk
r`dSXdS)NF)rtrrerq�cached�has_locationrb)r�other�smslr
r
r�__eq__�s
zModuleSpec.__eq__cCs:|jdkr4|jdk	r4|jr4tdkr&t�tj|j�|_|jS)N)rvrqru�_bootstrap_external�NotImplementedError�_get_cached)rr
r
rrz�s
zModuleSpec.cachedcCs
||_dS)N)rv)rrzr
r
rrz�scCs$|jdkr|jjd�dS|jSdS)N�.r)rtr�
rpartition)rr
r
r�parent�s
zModuleSpec.parentcCs|jS)N)ru)rr
r
rr{�szModuleSpec.has_locationcCst|�|_dS)N)�boolru)r�valuer
r
rr{�s)rrrrr,r~�propertyrz�setterr�r{r
r
r
rrpLs%
	rp)rqrscCs�t|d�rJtdkrt�tj}|dkr0|||d�S|r8gnd}||||d�S|dkr�t|d�r�y|j|�}Wq�tk
r�d}Yq�Xnd}t||||d�S)N�get_filename)re)rertrsF)rqrs)rrr��spec_from_file_locationrsrNrp)rrerqrsr��searchr
r
rrV�s"

rVc5Cs8y
|j}Wntk
rYnX|dk	r,|S|j}|dkrZy
|j}Wntk
rXYnXy
|j}Wntk
r|d}YnX|dkr�|dkr�y
|j}Wq�tk
r�d}Yq�Xn|}y
|j}Wntk
r�d}YnXyt|j�}Wntk
�rd}YnXt	|||d�}|dk�r"dnd|_
||_||_|S)N)rqFT)
rarbrr]rd�_ORIGIN�
__cached__�list�__path__rprurzrt)r[rerqrZr�locationrzrtr
r
r�_spec_from_module�sH







r�F)�overridec;Cs�|st|dd�dkr6y|j|_Wntk
r4YnX|sJt|dd�dkr�|j}|dkr�|jdk	r�tdkrnt�tj}|j	|�}|j|_
y
||_Wntk
r�YnX|s�t|dd�dkr�y|j|_
Wntk
r�YnXy
||_Wntk
r�YnX|�st|dd�dk�rD|jdk	�rDy|j|_Wntk
�rBYnX|j�r�|�sdt|dd�dk�r�y|j|_Wntk
�r�YnX|�s�t|dd�dk�r�|jdk	�r�y|j|_Wntk
�r�YnX|S)Nrr]�__package__r�rdr�)rrrrbrertrr��_NamespaceLoader�__new__�_pathr]r�r�rar�r{rqrdrzr�)rZr[r�rer�r
r
r�_init_module_attrs�s\



r�cCsRd}t|jd�r|jj|�}nt|jd�r2td��|dkrDt|j�}t||�|S)N�
create_module�exec_modulezBloaders that define exec_module() must also define create_module())rrer�rNrrr�)rZr[r
r
r�module_from_spec4s

r�cCsj|jdkrdn|j}|jdkrB|jdkr2dj|�Sdj||j�Sn$|jrVdj||j�Sdj|j|j�SdS)Nr_z
<module {!r}>z<module {!r} ({!r})>z<module {!r} from {!r}>z<module {!r} ({})>)rrqrer*r{)rZrr
r
rrcEs


rccCs�|j}t|���tjj|�|k	r6dj|�}t||d��|jdkrj|jdkrXtd|jd��t	||dd�|St	||dd�t
|jd�s�|jj|�n|jj|�WdQRXtj|S)Nzmodule {!r} not in sys.modules)rzmissing loaderT)r�r�)
rr.rrWr"r*rNrertr�r�load_moduler�)rZr[r�msgr
r
rrXVs



rXcCs�|jj|j�tj|j}t|dd�dkrLy|j|_Wntk
rJYnXt|dd�dkr�y(|j|_	t
|d�s�|jjd�d|_	Wntk
r�YnXt|dd�dkr�y
||_Wntk
r�YnX|S)Nr]r�r�r�rra)
rer�rrrWrr]rbrr�rr�ra)rZr[r
r
r�_load_backward_compatiblens(

r�cCsv|jdk	rt|jd�st|�St|�}t|��6|jdkrT|jdkr`td|jd��n|jj|�WdQRXt	j
|jS)Nr�zmissing loader)r)rerr�r�rhrtrNrr�rrW)rZr[r
r
r�_load_unlocked�s



r�c	Cst|j��
t|�SQRXdS)N)r.rr�)rZr
r
rrY�s	rYc@s�eZdZedd��Zeddd��Zeddd��Zedd	��Zed
d��Z	ee
dd
���Zee
dd���Zee
dd���Z
ee�ZdS)�BuiltinImportercCsdj|j�S)Nz<module {!r} (built-in)>)r*r)r[r
r
rr^�szBuiltinImporter.module_reprNcCs,|dk	rdStj|�r$t||dd�SdSdS)Nzbuilt-in)rq)r6�
is_builtinrV)�clsrO�path�targetr
r
r�	find_spec�s

zBuiltinImporter.find_speccCs|j||�}|dk	r|jSdS)N)r�re)r�rOr�rZr
r
r�find_module�s	zBuiltinImporter.find_modulecCs.|jtjkr"tdj|j�|jd��ttj|�S)Nz{!r} is not a built-in module)r)rrrMrNr*rAr6�create_builtin)rrZr
r
rr��s
zBuiltinImporter.create_modulecCsttj|�dS)N)rAr6�exec_builtin)rr[r
r
rr��szBuiltinImporter.exec_modulecCsdS)Nr
)r�rOr
r
r�get_code�szBuiltinImporter.get_codecCsdS)Nr
)r�rOr
r
r�
get_source�szBuiltinImporter.get_sourcecCsdS)NFr
)r�rOr
r
rrs�szBuiltinImporter.is_package)NN)N)rrr�staticmethodr^�classmethodr�r�r�r�rRr�r�rsr\r�r
r
r
rr��s		r�c@s�eZdZedd��Zeddd��Zeddd��Zedd	��Zed
d��Z	edd
��Z
eedd���Zeedd���Z
eedd���ZdS)�FrozenImportercCsdj|j�S)Nz<module {!r} (frozen)>)r*r)�mr
r
rr^szFrozenImporter.module_reprNcCs tj|�rt||dd�SdSdS)N�frozen)rq)r6rSrV)r�rOr�r�r
r
rr�s
zFrozenImporter.find_speccCstj|�r|SdS)N)r6rS)r�rOr�r
r
rr�szFrozenImporter.find_modulecCsdS)Nr
)r�rZr
r
rr�szFrozenImporter.create_modulecCs@|jj}tj|�s$tdj|�|d��ttj|�}t||j	�dS)Nz{!r} is not a frozen module)r)
rarr6rSrNr*rA�get_frozen_object�execr)r[r�coder
r
rr� s

zFrozenImporter.exec_modulecCs
t||�S)N)r\)r�rOr
r
rr�)szFrozenImporter.load_modulecCs
tj|�S)N)r6r�)r�rOr
r
rr�2szFrozenImporter.get_codecCsdS)Nr
)r�rOr
r
rr�8szFrozenImporter.get_sourcecCs
tj|�S)N)r6�is_frozen_package)r�rOr
r
rrs>szFrozenImporter.is_package)NN)N)rrrr�r^r�r�r�r�r�r�rUr�r�rsr
r
r
rr��s				r�c@seZdZdd�Zdd�ZdS)�_ImportLockContextcCstj�dS)N)r6r7)rr
r
rr2Ksz_ImportLockContext.__enter__cCstj�dS)N)r6r9)r�exc_type�	exc_value�
exc_tracebackr
r
rr5Osz_ImportLockContext.__exit__N)rrrr2r5r
r
r
rr�Gsr�cCs@|jd|d�}t|�|kr$td��|d}|r<dj||�S|S)Nr�r&z2attempted relative import beyond top-level packagerz{}.{})�rsplit�len�
ValueErrorr*)r�package�level�bits�baser
r
r�
_resolve_nameTs
r�cCs"|j||�}|dkrdSt||�S)N)r�rV)�finderrr�rer
r
r�_find_spec_legacy]sr�c
Cs�tj}|dkrtd��|s&tjdt�|tjk}x�|D]�}t��Hy
|j}Wn*t	k
rvt
|||�}|dkrrw6YnX||||�}WdQRX|dk	r6|r�|tjkr�tj|}y
|j}	Wnt	k
r�|SX|	dkr�|S|	Sq6|Sq6WdSdS)Nz5sys.meta_path is None, Python is likely shutting downzsys.meta_path is empty)r�	meta_pathrN�	_warnings�warn�
ImportWarningrWr�r�rbr�ra)
rr�r�r��	is_reloadr�r�rZr[rar
r
r�
_find_specfs6




r�cCsnt|t�stdjt|����|dkr,td��|dkrTt|t�sHtd��n|sTtd��|rj|dkrjtd��dS)Nzmodule name must be str, not {}rzlevel must be >= 0z__package__ not set to a stringz6attempted relative import with no known parent packagezEmpty module name)�
isinstance�str�	TypeErrorr*rr�rN)rr�r�r
r
r�
_sanity_check�s


r�zNo module named z{!r}cCs�d}|jd�d}|r�|tjkr*t||�|tjkr>tj|Stj|}y
|j}Wn2tk
r�tdj||�}t||d�d�YnXt	||�}|dkr�ttj|�|d��nt
|�}|r�tj|}t||jd�d|�|S)Nr�rz; {!r} is not a package)r�)r�rrWrAr�rb�_ERR_MSGr*�ModuleNotFoundErrorr�r�r)r�import_r�r��
parent_moduler�rZr[r
r
r�_find_and_load_unlocked�s*







r�cCs^t|��&tjj|t�}|tkr*t||�SWdQRX|dkrRdj|�}t||d��t|�|S)Nz(import of {} halted; None in sys.modules)r)	r.rrWr"�_NEEDS_LOADINGr�r*r�r>)rr�r[rKr
r
r�_find_and_load�s
r�rcCs*t|||�|dkr t|||�}t|t�S)Nr)r�r�r��_gcd_import)rr�r�r
r
rr��s	r�)�	recursivecCs�t|d�r�x�|D]�}t|t�sN|r.|jd}nd}td|�dt|�j����q|dkrz|r�t|d�r�t||j|dd	�qt||�sd
j|j|�}yt	||�Wqt
k
r�}z&|j|kr�tj
j|t�dk	r�w�WYdd}~XqXqW|S)Nr�z.__all__z
``from list''zItem in z must be str, not �*�__all__T)r�z{}.{})rr�r�rr�r�_handle_fromlistr�r*rAr�rrrWr"r�)r[�fromlistr�r��x�where�	from_name�excr
r
rr��s*







r�cCs�|jd�}|jd�}|dk	rR|dk	rN||jkrNtjd|�d|j�d�tdd�|S|dk	r`|jStjdtdd�|d	}d
|kr�|jd�d}|S)
Nr�raz __package__ != __spec__.parent (z != �)�)�
stacklevelzYcan't resolve package from __spec__ or __package__, falling back on __name__ and __path__rr�r�r)r"r�r�r�r�r�)�globalsr�rZr
r
r�_calc___package__s



r�c	Cs�|dkrt|�}n$|dk	r|ni}t|�}t|||�}|s�|dkrTt|jd�d�S|s\|St|�t|jd�d�}tj|jdt|j�|�Snt||t�SdS)Nrr�)r�r��	partitionr�rrWrr�)	rr��localsr�r�r[�globals_r��cut_offr
r
r�
__import__&s
 r�cCs&tj|�}|dkrtd|��t|�S)Nzno built-in module named )r�r�rNr�)rrZr
r
r�_builtin_from_nameIs
r�cCs�|a|att�}xVtjj�D]H\}}t||�r|tjkr>t}ntj|�rt	}nqt
||�}t||�qWtjt}x6dD].}|tjkr�t
|�}	n
tj|}	t|||	�qxWyt
d�}
Wntk
r�d}
YnXt|d|
�t
d�}t|d|�dS)Nr�rr=)r�)r6rrrW�itemsr�rMr�rSr�r�r�rr�rrN)�
sys_module�_imp_module�module_typerr[rerZ�self_module�builtin_name�builtin_module�
thread_module�weakref_moduler
r
r�_setupPs2	









r�cCsBt||�tjjt�tjjt�ddl}|a|jtj	t
�dS)Nr)r�rr�rwr�r��_frozen_importlib_externalr�_installrWr)r�r�r�r
r
rr�s
r�)NN)N)Nr)1rrrr8r!r)rrr-r.r1r>rArLrRrUr\rgrhrprVr�r�r�rcrXr�r�rYr�r�r�r�r�r�r��_ERR_MSG_PREFIXr�r��objectr�r�r�r�r�r�r�r�r�r
r
r
r�<module>s\D%$e
-<IM
		
/
&#/__pycache__/__init__.cpython-36.pyc000064400000007022150327175300013145 0ustar003


 \��#@sjdZddddgZddlZddlZyddlZWn,ek
rXddlmZejee�Yn@Xd	e_	d
e_
yejdd�e_Wne
k
r�YnXeejd	<yddlZWn0ek
r�dd
lmZeje�ee_YnBXde_	d
e_
yejdd�e_Wne
k
�r
YnXeejd<ejZejZddlZddlZddlmZdd�Zddd�Zddd�ZiZdd�ZdS)z'A pure Python implementation of import.�
__import__�
import_module�invalidate_caches�reload�N�)�
_bootstrapzimportlib._bootstrap�	importlibz__init__.pyz
_bootstrap.py)�_bootstrap_externalzimportlib._bootstrap_externalz_bootstrap_external.py)rcCs&x tjD]}t|d�r|j�qWdS)zmCall the invalidate_caches() method on all meta path finders stored in
    sys.meta_path (where implemented).rN)�sys�	meta_path�hasattrr)�finder�r�*/usr/lib64/python3.6/importlib/__init__.pyrBs
cCs�tjdtdd�y,tj|j}|dkr6tdj|���n|SWn6tk
rPYn$t	k
rrtdj|��d�YnXt
j||�}|dkr�dS|jdkr�|j
dkr�tdj|�|d��td	|d��|jS)
z�Return the loader for the specified module.

    This is a backward-compatible wrapper around find_spec().

    This function is deprecated in favor of importlib.util.find_spec().

    z'Use importlib.util.find_spec() instead.�)�
stacklevelNz{}.__loader__ is Nonez{}.__loader__ is not setzspec for {} missing loader)�namez&namespace packages do not have loaders)�warnings�warn�DeprecationWarningr
�modules�
__loader__�
ValueError�format�KeyError�AttributeErrorr�
_find_spec�loader�submodule_search_locations�ImportError)r�pathr�specrrr�find_loaderJs*



r"cCsZd}|jd�rD|s$d}t|j|���x|D]}|dkr8P|d7}q*Wtj||d�||�S)z�Import a module.

    The 'package' argument is required when performing a relative import. It
    specifies the package to use as the anchor point from which to resolve the
    relative import to an absolute import.

    r�.zHthe 'package' argument is required to perform a relative import for {!r}rN)�
startswith�	TypeErrorrr�_gcd_import)r�package�level�msg�	characterrrrrls

c"Cs4|st|tj�rtd��y|jj}Wntk
rB|j}YnXtj	j
|�|k	rjd}t|j|�|d��|t
krzt
|S|t
|<z�|jd�d}|r�ytj	|}Wn,tk
r�d}t|j|�|d�d�Yq�X|j}nd}|}tj|||�}|_tj||�tj	|Sy
t
|=Wntk
�r,YnXXdS)zcReload the module and return it.

    The module must have been successfully imported before.

    z"reload() argument must be a modulezmodule {} not in sys.modules)rr#rzparent {!r} not in sys.modulesN)�
isinstance�types�
ModuleTyper%�__spec__rr�__name__r
r�getrr�
_RELOADING�
rpartitionr�__path__rr�_exec)�modulerr)�parent_name�parent�pkgpath�targetr!rrrr�s>


)N)N)�__doc__�__all__�_impr
�_frozen_importlibrr��_setupr/�__package__�__file__�replace�	NameErrorr�_frozen_importlib_externalr	�_w_long�_r_longr,rrrr"rr1rrrrr�<module>sL




"
__pycache__/__init__.cpython-36.opt-1.pyc000064400000007022150327175300014104 0ustar003


 \��#@sjdZddddgZddlZddlZyddlZWn,ek
rXddlmZejee�Yn@Xd	e_	d
e_
yejdd�e_Wne
k
r�YnXeejd	<yddlZWn0ek
r�dd
lmZeje�ee_YnBXde_	d
e_
yejdd�e_Wne
k
�r
YnXeejd<ejZejZddlZddlZddlmZdd�Zddd�Zddd�ZiZdd�ZdS)z'A pure Python implementation of import.�
__import__�
import_module�invalidate_caches�reload�N�)�
_bootstrapzimportlib._bootstrap�	importlibz__init__.pyz
_bootstrap.py)�_bootstrap_externalzimportlib._bootstrap_externalz_bootstrap_external.py)rcCs&x tjD]}t|d�r|j�qWdS)zmCall the invalidate_caches() method on all meta path finders stored in
    sys.meta_path (where implemented).rN)�sys�	meta_path�hasattrr)�finder�r�*/usr/lib64/python3.6/importlib/__init__.pyrBs
cCs�tjdtdd�y,tj|j}|dkr6tdj|���n|SWn6tk
rPYn$t	k
rrtdj|��d�YnXt
j||�}|dkr�dS|jdkr�|j
dkr�tdj|�|d��td	|d��|jS)
z�Return the loader for the specified module.

    This is a backward-compatible wrapper around find_spec().

    This function is deprecated in favor of importlib.util.find_spec().

    z'Use importlib.util.find_spec() instead.�)�
stacklevelNz{}.__loader__ is Nonez{}.__loader__ is not setzspec for {} missing loader)�namez&namespace packages do not have loaders)�warnings�warn�DeprecationWarningr
�modules�
__loader__�
ValueError�format�KeyError�AttributeErrorr�
_find_spec�loader�submodule_search_locations�ImportError)r�pathr�specrrr�find_loaderJs*



r"cCsZd}|jd�rD|s$d}t|j|���x|D]}|dkr8P|d7}q*Wtj||d�||�S)z�Import a module.

    The 'package' argument is required when performing a relative import. It
    specifies the package to use as the anchor point from which to resolve the
    relative import to an absolute import.

    r�.zHthe 'package' argument is required to perform a relative import for {!r}rN)�
startswith�	TypeErrorrr�_gcd_import)r�package�level�msg�	characterrrrrls

c"Cs4|st|tj�rtd��y|jj}Wntk
rB|j}YnXtj	j
|�|k	rjd}t|j|�|d��|t
krzt
|S|t
|<z�|jd�d}|r�ytj	|}Wn,tk
r�d}t|j|�|d�d�Yq�X|j}nd}|}tj|||�}|_tj||�tj	|Sy
t
|=Wntk
�r,YnXXdS)zcReload the module and return it.

    The module must have been successfully imported before.

    z"reload() argument must be a modulezmodule {} not in sys.modules)rr#rzparent {!r} not in sys.modulesN)�
isinstance�types�
ModuleTyper%�__spec__rr�__name__r
r�getrr�
_RELOADING�
rpartitionr�__path__rr�_exec)�modulerr)�parent_name�parent�pkgpath�targetr!rrrr�s>


)N)N)�__doc__�__all__�_impr
�_frozen_importlibrr��_setupr/�__package__�__file__�replace�	NameErrorr�_frozen_importlib_externalr	�_w_long�_r_longr,rrrr"rr1rrrrr�<module>sL




"
__pycache__/_bootstrap.cpython-36.opt-1.pyc000064400000070634150327175300014532 0ustar003


 \���@s�dZdadd�Zdd�ZiZiZGdd�de�ZGdd	�d	�ZGd
d�d�Z	Gdd
�d
�Z
dd�Zdd�Zdd�Z
dd�dd�Zdd�Zdd�Zdd�Zdd�ZGd d!�d!�ZGd"d#�d#�Zddd$�d%d&�Zd]d'd(�Zd)d*�d+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Zd7d8�ZGd9d:�d:�ZGd;d<�d<�ZGd=d>�d>�Z d?d@�Z!dAdB�Z"d^dCdD�Z#dEdF�Z$dGZ%e%dHZ&dIdJ�Z'e(�Z)dKdL�Z*d_dNdO�Z+d)dP�dQdR�Z,dSdT�Z-ddfdMfdUdV�Z.dWdX�Z/dYdZ�Z0d[d\�Z1dS)`aSCore implementation of import.

This module is NOT meant to be directly imported! It has been designed such
that it can be bootstrapped into Python as the implementation of import. As
such it requires the injection of specific modules and attributes in order to
work. One should use importlib as the public-facing version of this module.

NcCs<x(dD] }t||�rt||t||��qW|jj|j�dS)z/Simple substitute for functools.update_wrapper.�
__module__�__name__�__qualname__�__doc__N)rrrr)�hasattr�setattr�getattr�__dict__�update)�new�old�replace�r
�,/usr/lib64/python3.6/importlib/_bootstrap.py�_wraps

rcCstt�|�S)N)�type�sys)�namer
r
r�_new_module#src@seZdZdS)�_DeadlockErrorN)rrrr
r
r
rr0src@s8eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
�_ModuleLockz�A recursive lock implementation which is able to detect deadlocks
    (e.g. thread 1 trying to take locks A then B, and thread 2 trying to
    take locks B then A).
    cCs0tj�|_tj�|_||_d|_d|_d|_dS)N�)�_thread�
allocate_lock�lock�wakeupr�owner�count�waiters)�selfrr
r
r�__init__:s

z_ModuleLock.__init__cCs@tj�}|j}x,tj|�}|dkr&dS|j}||krdSqWdS)NFT)r�	get_identr�_blocking_on�get)r�me�tidrr
r
r�has_deadlockBs
z_ModuleLock.has_deadlockcCs�tj�}|t|<z�x�|j�`|jdks0|j|krH||_|jd7_dS|j�r\td|��|jj	d�rv|j
d7_
WdQRX|jj	�|jj�qWWdt|=XdS)z�
        Acquire the module lock.  If a potential deadlock is detected,
        a _DeadlockError is raised.
        Otherwise, the lock is always acquired and True is returned.
        r�Tzdeadlock detected by %rFN)rr r!rrrr%rr�acquirer�release)rr$r
r
rr'Ns 
z_ModuleLock.acquirec
Csltj�}|j�T|j|kr"td��|jd8_|jdkr^d|_|jr^|jd8_|jj�WdQRXdS)Nzcannot release un-acquired lockr&r)	rr rr�RuntimeErrorrrrr()rr$r
r
rr(gs

z_ModuleLock.releasecCsdj|jt|��S)Nz_ModuleLock({!r}) at {})�formatr�id)rr
r
r�__repr__tsz_ModuleLock.__repr__N)	rrrrrr%r'r(r,r
r
r
rr4s
rc@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�_DummyModuleLockzVA simple _ModuleLock equivalent for Python builds without
    multi-threading support.cCs||_d|_dS)Nr)rr)rrr
r
rr|sz_DummyModuleLock.__init__cCs|jd7_dS)Nr&T)r)rr
r
rr'�sz_DummyModuleLock.acquirecCs$|jdkrtd��|jd8_dS)Nrzcannot release un-acquired lockr&)rr))rr
r
rr(�s
z_DummyModuleLock.releasecCsdj|jt|��S)Nz_DummyModuleLock({!r}) at {})r*rr+)rr
r
rr,�sz_DummyModuleLock.__repr__N)rrrrrr'r(r,r
r
r
rr-xs
r-c@s$eZdZdd�Zdd�Zdd�ZdS)�_ModuleLockManagercCs||_d|_dS)N)�_name�_lock)rrr
r
rr�sz_ModuleLockManager.__init__cCst|j�|_|jj�dS)N)�_get_module_lockr/r0r')rr
r
r�	__enter__�sz_ModuleLockManager.__enter__cOs|jj�dS)N)r0r()r�args�kwargsr
r
r�__exit__�sz_ModuleLockManager.__exit__N)rrrrr2r5r
r
r
rr.�sr.cCs�tj�zjyt|�}Wntk
r0d}YnX|dkrptdkrLt|�}nt|�}|fdd�}tj||�t|<Wdtj	�X|S)z�Get or create the module lock for a given module name.

    Acquire/release internally the global import lock to protect
    _module_locks.Nc
Ss0tj�ztj|�|krt|=Wdtj�XdS)N)�_imp�acquire_lock�
_module_locksr"�release_lock)�refrr
r
r�cb�s

z_get_module_lock.<locals>.cb)
r6r7r8�KeyErrorrr-r�_weakrefr:r9)rrr;r
r
rr1�s


r1cCs6t|�}y|j�Wntk
r(Yn
X|j�dS)z�Acquires then releases the module lock for a given module name.

    This is used to ensure a module is completely initialized, in the
    event it is being imported by another thread.
    N)r1r'rr()rrr
r
r�_lock_unlock_module�sr>cOs
|||�S)a.remove_importlib_frames in import.c will always remove sequences
    of importlib frames that end with a call to this function

    Use it instead of a normal call in places where including the importlib
    frames introduces unwanted noise into the traceback (e.g. when executing
    module code)
    r
)�fr3�kwdsr
r
r�_call_with_frames_removed�srAr&)�	verbositycGs6tjj|kr2|jd�sd|}t|j|�tjd�dS)z=Print the message to stderr if -v/PYTHONVERBOSE is turned on.�#�import z# )�fileN)rCrD)r�flags�verbose�
startswith�printr*�stderr)�messagerBr3r
r
r�_verbose_message�s
rLcs�fdd�}t|��|S)z1Decorator to verify the named module is built-in.cs&|tjkrtdj|�|d���||�S)Nz{!r} is not a built-in module)r)r�builtin_module_names�ImportErrorr*)r�fullname)�fxnr
r�_requires_builtin_wrapper�s

z4_requires_builtin.<locals>._requires_builtin_wrapper)r)rPrQr
)rPr�_requires_builtin�s
rRcs�fdd�}t|��|S)z/Decorator to verify the named module is frozen.cs&tj|�stdj|�|d���||�S)Nz{!r} is not a frozen module)r)r6�	is_frozenrNr*)rrO)rPr
r�_requires_frozen_wrapper�s

z2_requires_frozen.<locals>._requires_frozen_wrapper)r)rPrTr
)rPr�_requires_frozen�s
rUcCs>t||�}|tjkr2tj|}t||�tj|St|�SdS)z�Load the specified module into sys.modules and return it.

    This method is deprecated.  Use loader.exec_module instead.

    N)�spec_from_loaderr�modules�_exec�_load)rrO�spec�moduler
r
r�_load_module_shim�s




r\c#Cs�t|dd�}t|d�r6y
|j|�Stk
r4YnXy
|j}Wntk
rTYnX|dk	rft|�Sy
|j}Wntk
r�d}YnXy
|j}Wn2tk
r�|dkr�dj	|�Sdj	||�SYnXdj	||�SdS)N�
__loader__�module_repr�?z
<module {!r}>z<module {!r} ({!r})>z<module {!r} from {!r}>)
rrr^�	Exception�__spec__�AttributeError�_module_repr_from_specr�__file__r*)r[�loaderrZr�filenamer
r
r�_module_repr
s.






rgc@s$eZdZdd�Zdd�Zdd�ZdS)�_installed_safelycCs||_|j|_dS)N)�_modulera�_spec)rr[r
r
rr3sz_installed_safely.__init__cCsd|j_|jtj|jj<dS)NT)rj�
_initializingrirrWr)rr
r
rr27sz_installed_safely.__enter__cGsbzR|j}tdd�|D��r@ytj|j=WqPtk
r<YqPXntd|j|j�Wdd|j_XdS)Ncss|]}|dk	VqdS)Nr
)�.0�argr
r
r�	<genexpr>Asz-_installed_safely.__exit__.<locals>.<genexpr>zimport {!r} # {!r}F)	rj�anyrrWrr<rLrerk)rr3rZr
r
rr5>sz_installed_safely.__exit__N)rrrrr2r5r
r
r
rrh1srhc@sreZdZdZdddd�dd�Zdd�Zdd	�Zed
d��Zej	dd��Zed
d��Z
edd��Zej	dd��ZdS)�
ModuleSpeca�The specification for a module, used for loading.

    A module's spec is the source for information about the module.  For
    data associated with the module, including source, use the spec's
    loader.

    `name` is the absolute name of the module.  `loader` is the loader
    to use when loading the module.  `parent` is the name of the
    package the module is in.  The parent is derived from the name.

    `is_package` determines if the module is considered a package or
    not.  On modules this is reflected by the `__path__` attribute.

    `origin` is the specific location used by the loader from which to
    load the module, if that information is available.  When filename is
    set, origin will match.

    `has_location` indicates that a spec's "origin" reflects a location.
    When this is True, `__file__` attribute of the module is set.

    `cached` is the location of the cached bytecode file, if any.  It
    corresponds to the `__cached__` attribute.

    `submodule_search_locations` is the sequence of path entries to
    search when importing submodules.  If set, is_package should be
    True--and False otherwise.

    Packages are simply modules that (may) have submodules.  If a spec
    has a non-None value in `submodule_search_locations`, the import
    system will consider modules loaded from the spec as packages.

    Only finders (see importlib.abc.MetaPathFinder and
    importlib.abc.PathEntryFinder) should modify ModuleSpec instances.

    N)�origin�loader_state�
is_packagecCs6||_||_||_||_|r gnd|_d|_d|_dS)NF)rrerqrr�submodule_search_locations�
_set_fileattr�_cached)rrrerqrrrsr
r
rrqszModuleSpec.__init__cCsfdj|j�dj|j�g}|jdk	r4|jdj|j��|jdk	rP|jdj|j��dj|jjdj|��S)Nz	name={!r}zloader={!r}zorigin={!r}zsubmodule_search_locations={}z{}({})z, )	r*rrerq�appendrt�	__class__r�join)rr3r
r
rr,}s



zModuleSpec.__repr__cCsf|j}yF|j|jkoL|j|jkoL|j|jkoL||jkoL|j|jkoL|j|jkStk
r`dSXdS)NF)rtrrerq�cached�has_locationrb)r�other�smslr
r
r�__eq__�s
zModuleSpec.__eq__cCs:|jdkr4|jdk	r4|jr4tdkr&t�tj|j�|_|jS)N)rvrqru�_bootstrap_external�NotImplementedError�_get_cached)rr
r
rrz�s
zModuleSpec.cachedcCs
||_dS)N)rv)rrzr
r
rrz�scCs$|jdkr|jjd�dS|jSdS)z The name of the module's parent.N�.r)rtr�
rpartition)rr
r
r�parent�s
zModuleSpec.parentcCs|jS)N)ru)rr
r
rr{�szModuleSpec.has_locationcCst|�|_dS)N)�boolru)r�valuer
r
rr{�s)rrrrrr,r~�propertyrz�setterr�r{r
r
r
rrpLs#
	rp)rqrscCs�t|d�rJtdkrt�tj}|dkr0|||d�S|r8gnd}||||d�S|dkr�t|d�r�y|j|�}Wq�tk
r�d}Yq�Xnd}t||||d�S)z5Return a module spec based on various loader methods.�get_filenameN)re)rertrsF)rqrs)rrr��spec_from_file_locationrsrNrp)rrerqrsr��searchr
r
rrV�s"

rVc5Cs8y
|j}Wntk
rYnX|dk	r,|S|j}|dkrZy
|j}Wntk
rXYnXy
|j}Wntk
r|d}YnX|dkr�|dkr�y
|j}Wq�tk
r�d}Yq�Xn|}y
|j}Wntk
r�d}YnXyt|j�}Wntk
�rd}YnXt	|||d�}|dk�r"dnd|_
||_||_|S)N)rqFT)
rarbrr]rd�_ORIGIN�
__cached__�list�__path__rprurzrt)r[rerqrZr�locationrzrtr
r
r�_spec_from_module�sH







r�F)�overridec;Cs�|st|dd�dkr6y|j|_Wntk
r4YnX|sJt|dd�dkr�|j}|dkr�|jdk	r�tdkrnt�tj}|j	|�}|j|_
y
||_Wntk
r�YnX|s�t|dd�dkr�y|j|_
Wntk
r�YnXy
||_Wntk
r�YnX|�st|dd�dk�rD|jdk	�rDy|j|_Wntk
�rBYnX|j�r�|�sdt|dd�dk�r�y|j|_Wntk
�r�YnX|�s�t|dd�dk�r�|jdk	�r�y|j|_Wntk
�r�YnX|S)Nrr]�__package__r�rdr�)rrrrbrertrr��_NamespaceLoader�__new__�_pathr]r�r�rar�r{rqrdrzr�)rZr[r�rer�r
r
r�_init_module_attrs�s\



r�cCsRd}t|jd�r|jj|�}nt|jd�r2td��|dkrDt|j�}t||�|S)z+Create a module based on the provided spec.N�
create_module�exec_modulezBloaders that define exec_module() must also define create_module())rrer�rNrrr�)rZr[r
r
r�module_from_spec4s

r�cCsj|jdkrdn|j}|jdkrB|jdkr2dj|�Sdj||j�Sn$|jrVdj||j�Sdj|j|j�SdS)z&Return the repr to use for the module.Nr_z
<module {!r}>z<module {!r} ({!r})>z<module {!r} from {!r}>z<module {!r} ({})>)rrqrer*r{)rZrr
r
rrcEs


rccCs�|j}t|���tjj|�|k	r6dj|�}t||d��|jdkrj|jdkrXtd|jd��t	||dd�|St	||dd�t
|jd�s�|jj|�n|jj|�WdQRXtj|S)zFExecute the spec's specified module in an existing module's namespace.zmodule {!r} not in sys.modules)rNzmissing loaderT)r�r�)
rr.rrWr"r*rNrertr�r�load_moduler�)rZr[r�msgr
r
rrXVs



rXcCs�|jj|j�tj|j}t|dd�dkrLy|j|_Wntk
rJYnXt|dd�dkr�y(|j|_	t
|d�s�|jjd�d|_	Wntk
r�YnXt|dd�dkr�y
||_Wntk
r�YnX|S)Nr]r�r�r�rra)
rer�rrrWrr]rbrr�rr�ra)rZr[r
r
r�_load_backward_compatiblens(

r�cCsv|jdk	rt|jd�st|�St|�}t|��6|jdkrT|jdkr`td|jd��n|jj|�WdQRXt	j
|jS)Nr�zmissing loader)r)rerr�r�rhrtrNrr�rrW)rZr[r
r
r�_load_unlocked�s



r�c	Cst|j��
t|�SQRXdS)z�Return a new module object, loaded by the spec's loader.

    The module is not added to its parent.

    If a module is already in sys.modules, that existing module gets
    clobbered.

    N)r.rr�)rZr
r
rrY�s	rYc@s�eZdZdZedd��Zeddd��Zeddd��Zed	d
��Z	edd��Z
eed
d���Zeedd���Z
eedd���Zee�ZdS)�BuiltinImporterz�Meta path import for built-in modules.

    All methods are either class or static methods to avoid the need to
    instantiate the class.

    cCsdj|j�S)zsReturn repr for the module.

        The method is deprecated.  The import machinery does the job itself.

        z<module {!r} (built-in)>)r*r)r[r
r
rr^�szBuiltinImporter.module_reprNcCs,|dk	rdStj|�r$t||dd�SdSdS)Nzbuilt-in)rq)r6�
is_builtinrV)�clsrO�path�targetr
r
r�	find_spec�s

zBuiltinImporter.find_speccCs|j||�}|dk	r|jSdS)z�Find the built-in module.

        If 'path' is ever specified then the search is considered a failure.

        This method is deprecated.  Use find_spec() instead.

        N)r�re)r�rOr�rZr
r
r�find_module�s	zBuiltinImporter.find_modulecCs.|jtjkr"tdj|j�|jd��ttj|�S)zCreate a built-in modulez{!r} is not a built-in module)r)rrrMrNr*rAr6�create_builtin)rrZr
r
rr��s
zBuiltinImporter.create_modulecCsttj|�dS)zExec a built-in moduleN)rAr6�exec_builtin)rr[r
r
rr��szBuiltinImporter.exec_modulecCsdS)z9Return None as built-in modules do not have code objects.Nr
)r�rOr
r
r�get_code�szBuiltinImporter.get_codecCsdS)z8Return None as built-in modules do not have source code.Nr
)r�rOr
r
r�
get_source�szBuiltinImporter.get_sourcecCsdS)z4Return False as built-in modules are never packages.Fr
)r�rOr
r
rrs�szBuiltinImporter.is_package)NN)N)rrrr�staticmethodr^�classmethodr�r�r�r�rRr�r�rsr\r�r
r
r
rr��s	r�c@s�eZdZdZedd��Zeddd��Zeddd��Zed	d
��Z	edd��Z
ed
d��Zeedd���Z
eedd���Zeedd���ZdS)�FrozenImporterz�Meta path import for frozen modules.

    All methods are either class or static methods to avoid the need to
    instantiate the class.

    cCsdj|j�S)zsReturn repr for the module.

        The method is deprecated.  The import machinery does the job itself.

        z<module {!r} (frozen)>)r*r)�mr
r
rr^szFrozenImporter.module_reprNcCs tj|�rt||dd�SdSdS)N�frozen)rq)r6rSrV)r�rOr�r�r
r
rr�s
zFrozenImporter.find_speccCstj|�r|SdS)z]Find a frozen module.

        This method is deprecated.  Use find_spec() instead.

        N)r6rS)r�rOr�r
r
rr�szFrozenImporter.find_modulecCsdS)z*Use default semantics for module creation.Nr
)r�rZr
r
rr�szFrozenImporter.create_modulecCs@|jj}tj|�s$tdj|�|d��ttj|�}t||j	�dS)Nz{!r} is not a frozen module)r)
rarr6rSrNr*rA�get_frozen_object�execr)r[r�coder
r
rr� s

zFrozenImporter.exec_modulecCs
t||�S)z_Load a frozen module.

        This method is deprecated.  Use exec_module() instead.

        )r\)r�rOr
r
rr�)szFrozenImporter.load_modulecCs
tj|�S)z-Return the code object for the frozen module.)r6r�)r�rOr
r
rr�2szFrozenImporter.get_codecCsdS)z6Return None as frozen modules do not have source code.Nr
)r�rOr
r
rr�8szFrozenImporter.get_sourcecCs
tj|�S)z.Return True if the frozen module is a package.)r6�is_frozen_package)r�rOr
r
rrs>szFrozenImporter.is_package)NN)N)rrrrr�r^r�r�r�r�r�r�rUr�r�rsr
r
r
rr��s			r�c@s eZdZdZdd�Zdd�ZdS)�_ImportLockContextz$Context manager for the import lock.cCstj�dS)zAcquire the import lock.N)r6r7)rr
r
rr2Ksz_ImportLockContext.__enter__cCstj�dS)z<Release the import lock regardless of any raised exceptions.N)r6r9)r�exc_type�	exc_value�
exc_tracebackr
r
rr5Osz_ImportLockContext.__exit__N)rrrrr2r5r
r
r
rr�Gsr�cCs@|jd|d�}t|�|kr$td��|d}|r<dj||�S|S)z2Resolve a relative module name to an absolute one.r�r&z2attempted relative import beyond top-level packagerz{}.{})�rsplit�len�
ValueErrorr*)r�package�level�bits�baser
r
r�
_resolve_nameTs
r�cCs"|j||�}|dkrdSt||�S)N)r�rV)�finderrr�rer
r
r�_find_spec_legacy]sr�c
Cs�tj}|dkrtd��|s&tjdt�|tjk}x�|D]�}t��Hy
|j}Wn*t	k
rvt
|||�}|dkrrw6YnX||||�}WdQRX|dk	r6|r�|tjkr�tj|}y
|j}	Wnt	k
r�|SX|	dkr�|S|	Sq6|Sq6WdSdS)zFind a module's spec.Nz5sys.meta_path is None, Python is likely shutting downzsys.meta_path is empty)r�	meta_pathrN�	_warnings�warn�
ImportWarningrWr�r�rbr�ra)
rr�r�r��	is_reloadr�r�rZr[rar
r
r�
_find_specfs6




r�cCsnt|t�stdjt|����|dkr,td��|dkrTt|t�sHtd��n|sTtd��|rj|dkrjtd��dS)zVerify arguments are "sane".zmodule name must be str, not {}rzlevel must be >= 0z__package__ not set to a stringz6attempted relative import with no known parent packagezEmpty module nameN)�
isinstance�str�	TypeErrorr*rr�rN)rr�r�r
r
r�
_sanity_check�s


r�zNo module named z{!r}cCs�d}|jd�d}|r�|tjkr*t||�|tjkr>tj|Stj|}y
|j}Wn2tk
r�tdj||�}t||d�d�YnXt	||�}|dkr�ttj|�|d��nt
|�}|r�tj|}t||jd�d|�|S)Nr�rz; {!r} is not a package)r�)r�rrWrAr�rb�_ERR_MSGr*�ModuleNotFoundErrorr�r�r)r�import_r�r��
parent_moduler�rZr[r
r
r�_find_and_load_unlocked�s*







r�cCs^t|��&tjj|t�}|tkr*t||�SWdQRX|dkrRdj|�}t||d��t|�|S)zFind and load the module.Nz(import of {} halted; None in sys.modules)r)	r.rrWr"�_NEEDS_LOADINGr�r*r�r>)rr�r[rKr
r
r�_find_and_load�s
r�rcCs*t|||�|dkr t|||�}t|t�S)a2Import and return the module based on its name, the package the call is
    being made from, and the level adjustment.

    This function represents the greatest common denominator of functionality
    between import_module and __import__. This includes setting __package__ if
    the loader did not.

    r)r�r�r��_gcd_import)rr�r�r
r
rr��s	r�)�	recursivecCs�t|d�r�x�|D]�}t|t�sN|r.|jd}nd}td|�dt|�j����q|dkrz|r�t|d�r�t||j|dd	�qt||�sd
j|j|�}yt	||�Wqt
k
r�}z&|j|kr�tj
j|t�dk	r�w�WYdd}~XqXqW|S)z�Figure out what __import__ should return.

    The import_ parameter is a callable which takes the name of module to
    import. It is required to decouple the function from assuming importlib's
    import implementation is desired.

    r�z.__all__z
``from list''zItem in z must be str, not �*�__all__T)r�z{}.{}N)rr�r�rr�r�_handle_fromlistr�r*rAr�rrrWr"r�)r[�fromlistr�r��x�where�	from_name�excr
r
rr��s*







r�cCs�|jd�}|jd�}|dk	rR|dk	rN||jkrNtjd|�d|j�d�tdd�|S|dk	r`|jStjd	tdd�|d
}d|kr�|jd�d
}|S)z�Calculate what __package__ should be.

    __package__ is not guaranteed to be defined or could be set to None
    to represent that its proper value is unknown.

    r�raNz __package__ != __spec__.parent (z != �)�)�
stacklevelzYcan't resolve package from __spec__ or __package__, falling back on __name__ and __path__rr�r�r)r"r�r�r�r�r�)�globalsr�rZr
r
r�_calc___package__s



r�c	Cs�|dkrt|�}n$|dk	r|ni}t|�}t|||�}|s�|dkrTt|jd�d�S|s\|St|�t|jd�d�}tj|jdt|j�|�Snt||t�SdS)a�Import a module.

    The 'globals' argument is used to infer where the import is occurring from
    to handle relative imports. The 'locals' argument is ignored. The
    'fromlist' argument specifies what should exist as attributes on the module
    being imported (e.g. ``from module import <fromlist>``).  The 'level'
    argument represents the package location to import from in a relative
    import (e.g. ``from ..pkg import mod`` would have a 'level' of 2).

    rNr�)r�r��	partitionr�rrWrr�)	rr��localsr�r�r[�globals_r��cut_offr
r
r�
__import__&s
 r�cCs&tj|�}|dkrtd|��t|�S)Nzno built-in module named )r�r�rNr�)rrZr
r
r�_builtin_from_nameIs
r�cCs�|a|att�}xVtjj�D]H\}}t||�r|tjkr>t}ntj|�rt	}nqt
||�}t||�qWtjt}x6dD].}|tjkr�t
|�}	n
tj|}	t|||	�qxWyt
d�}
Wntk
r�d}
YnXt|d|
�t
d�}t|d|�dS)z�Setup importlib by importing needed built-in modules and injecting them
    into the global namespace.

    As sys is needed for sys.modules access and _imp is needed to load built-in
    modules, those two modules must be explicitly passed in.

    r�rNr=)r�)r6rrrW�itemsr�rMr�rSr�r�r�rr�rrN)�
sys_module�_imp_module�module_typerr[rerZ�self_module�builtin_name�builtin_module�
thread_module�weakref_moduler
r
r�_setupPs2	









r�cCsBt||�tjjt�tjjt�ddl}|a|jtj	t
�dS)z2Install importlib as the implementation of import.rN)r�rr�rwr�r��_frozen_importlib_externalr�_installrWr)r�r�r�r
r
rr�s
r�)NN)N)Nr)2rrrrr8r!r)rrr-r.r1r>rArLrRrUr\rgrhrprVr�r�r�rcrXr�r�rYr�r�r�r�r�r�r��_ERR_MSG_PREFIXr�r��objectr�r�r�r�r�r�r�r�r�r
r
r
r�<module>s^D%$e
-<IM
		
/
&#/__pycache__/_bootstrap_external.cpython-36.opt-1.pyc000064400000116017150327175300016430 0ustar003

�\dhm��@s&dZdnZdoZeeZdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdpdd�Z
ee
j�Zdjdd�dZejed�ZdZdZdgZd gZeZZdqd!d"�d#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Z d-d.�Z!d/d0�Z"drd1d2�Z#dsd3d4�Z$dtd6d7�Z%d8d9�Z&e'�Z(dud!e(d:�d;d<�Z)Gd=d>�d>�Z*Gd?d@�d@�Z+GdAdB�dBe+�Z,GdCdD�dD�Z-GdEdF�dFe-e,�Z.GdGdH�dHe-e+�Z/gZ0GdIdJ�dJe-e+�Z1GdKdL�dL�Z2GdMdN�dN�Z3GdOdP�dP�Z4GdQdR�dR�Z5dvdSdT�Z6dUdV�Z7dWdX�Z8dYdZ�Z9d[d\d]d^d_d`dadbdcdddedfdgdhdidjdk�Z:dldm�Z;d!S)wa^Core implementation of path-based import.

This module is NOT meant to be directly imported! It has been designed such
that it can be bootstrapped into Python as the implementation of import. As
such it requires the injection of specific modules and attributes in order to
work. One should use importlib as the public-facing version of this module.

�win�cygwin�darwincs<tjjt�r0tjjt�rd�nd��fdd�}ndd�}|S)N�PYTHONCASEOKsPYTHONCASEOKcs
�tjkS)z5True if filenames must be checked case-insensitively.)�_os�environ�)�keyr�5/usr/lib64/python3.6/importlib/_bootstrap_external.py�_relax_case%sz%_make_relax_case.<locals>._relax_casecSsdS)z5True if filenames must be checked case-insensitively.Frrrrr	r
)s)�sys�platform�
startswith�_CASE_INSENSITIVE_PLATFORMS�#_CASE_INSENSITIVE_PLATFORMS_STR_KEY)r
r)rr	�_make_relax_casesrcCst|�d@jdd�S)z*Convert a 32-bit integer to little-endian.l����little)�int�to_bytes)�xrrr	�_w_long/srcCstj|d�S)z/Convert 4 bytes in little-endian to an integer.r)r�
from_bytes)�	int_bytesrrr	�_r_long4srcGstjdd�|D��S)zReplacement for os.path.join().cSsg|]}|r|jt��qSr)�rstrip�path_separators)�.0�partrrr	�
<listcomp>;sz_path_join.<locals>.<listcomp>)�path_sep�join)�
path_partsrrr	�
_path_join9s
r"cCs`tt�dkr$|jt�\}}}||fSx2t|�D]&}|tkr.|j|dd�\}}||fSq.Wd|fS)z Replacement for os.path.split().�)�maxsplit�)�lenr�
rpartitionr�reversed�rsplit)�path�front�_�tailrrrr	�_path_split?sr.cCs
tj|�S)z~Stat the path.

    Made a separate function to make it easier to override in experiments
    (e.g. cache stat results).

    )r�stat)r*rrr	�
_path_statKsr0cCs0yt|�}Wntk
r dSX|jd@|kS)z1Test whether the path is the specified mode type.Fi�)r0�OSError�st_mode)r*�mode�	stat_inforrr	�_path_is_mode_typeUs
r5cCs
t|d�S)zReplacement for os.path.isfile.i�)r5)r*rrr	�_path_isfile^sr6cCs|stj�}t|d�S)zReplacement for os.path.isdir.i@)r�getcwdr5)r*rrr	�_path_isdircsr8�cCs�dj|t|��}tj|tjtjBtjB|d@�}y2tj|d��}|j	|�WdQRXtj
||�Wn:tk
r�ytj|�Wntk
r�YnX�YnXdS)z�Best-effort function to write data to a path atomically.
    Be prepared to handle a FileExistsError if concurrent writing of the
    temporary file is attempted.z{}.{}i��wbN)
�format�idr�open�O_EXCL�O_CREAT�O_WRONLY�_io�FileIO�write�replacer1�unlink)r*�datar3�path_tmp�fd�filerrr	�
_write_atomicjsrJi3
�rs
�__pycache__zopt-z.pyz.pycN)�optimizationcCs�|dk	r4tjdt�|dk	r(d}t|��|r0dnd}tj|�}t|�\}}|jd�\}}}tj	j
}	|	dkrrtd��dj|r~|n|||	g�}
|dkr�tj
jdkr�d}ntj
j}t|�}|dkr�|j�s�td	j|���d
j|
t|�}
t|t|
td�S)a�Given the path to a .py file, return the path to its .pyc file.

    The .py file does not need to exist; this simply returns the path to the
    .pyc file calculated as if the .py file were imported.

    The 'optimization' parameter controls the presumed optimization level of
    the bytecode file. If 'optimization' is not None, the string representation
    of the argument is taken and verified to be alphanumeric (else ValueError
    is raised).

    The debug_override parameter is deprecated. If debug_override is not None,
    a True value is the same as setting 'optimization' to the empty string
    while a False value is equivalent to setting 'optimization' to '1'.

    If sys.implementation.cache_tag is None then NotImplementedError is raised.

    NzFthe debug_override parameter is deprecated; use 'optimization' insteadz2debug_override or optimization must be set to Noner%r#�.z$sys.implementation.cache_tag is None�z{!r} is not alphanumericz{}.{}{})�	_warnings�warn�DeprecationWarning�	TypeErrorr�fspathr.r'r�implementation�	cache_tag�NotImplementedErrorr �flags�optimize�str�isalnum�
ValueErrorr;�_OPTr"�_PYCACHE�BYTECODE_SUFFIXES)r*�debug_overriderM�message�headr-�base�sep�rest�tag�almost_filenamerrr	�cache_from_sources0
rhcCs�tjjdkrtd��tj|�}t|�\}}t|�\}}|tkrNtdj	t|���|j
d�}|dkrptdj	|���nV|dkr�|jdd�d}|jt
�s�tdj	t
���|tt
�d�}|j�s�td	j	|���|jd�d
}t||td
�S)
anGiven the path to a .pyc. file, return the path to its .py file.

    The .pyc file does not need to exist; this simply returns the path to
    the .py file calculated to correspond to the .pyc file.  If path does
    not conform to PEP 3147/488 format, ValueError will be raised. If
    sys.implementation.cache_tag is None then NotImplementedError is raised.

    Nz$sys.implementation.cache_tag is Nonez%{} not bottom-level directory in {!r}rNrK�z!expected only 2 or 3 dots in {!r}z9optimization portion of filename does not start with {!r}z4optimization level {!r} is not an alphanumeric valuerO>rKri���)rrUrVrWrrTr.r^r\r;�countr)r
r]r&r[�	partitionr"�SOURCE_SUFFIXES)r*rb�pycache_filename�pycache�	dot_countrM�	opt_level�
base_filenamerrr	�source_from_cache4s.	




rscCs�t|�dkrdS|jd�\}}}|s:|j�dd�dkr>|Syt|�}Wn$ttfk
rn|dd	�}YnXt|�r||S|S)
z�Convert a bytecode file path to a source path (if possible).

    This function exists purely for backwards-compatibility for
    PyImport_ExecCodeModuleWithFilenames() in the C API.

    rONrNrir#�py������rv)r&r'�lowerrsrWr\r6)�
bytecode_pathrer,�	extension�source_pathrrr	�_get_sourcefileVsr{cCsH|jtt��r.yt|�Stk
r*YqDXn|jtt��r@|SdSdS)N)�endswith�tuplermrhrWr_)�filenamerrr	�_get_cachedisrcCs4yt|�j}Wntk
r&d}YnX|dO}|S)z3Calculate the mode permissions for a bytecode file.i��)r0r2r1)r*r3rrr	�
_calc_modeus
r�csDd�fdd�	}y
tj}Wntk
r4dd�}YnX||��|S)z�Decorator to verify that the module being requested matches the one the
    loader can handle.

    The first argument (self) must define _name which the second argument is
    compared against. If the comparison fails then ImportError is raised.

    NcsB|dkr|j}n |j|kr0td|j|f|d���||f|�|�S)Nzloader for %s cannot handle %s)�name)r��ImportError)�selfr��args�kwargs)�methodrr	�_check_name_wrapper�s
z(_check_name.<locals>._check_name_wrappercSs<x(dD] }t||�rt||t||��qW|jj|j�dS)N�
__module__�__name__�__qualname__�__doc__)r�r�r�r�)�hasattr�setattr�getattr�__dict__�update)�new�oldrDrrr	�_wrap�s

z_check_name.<locals>._wrap)N)�
_bootstrapr��	NameError)r�r�r�r)r�r	�_check_name�s

r�cCs<|j|�\}}|dkr8t|�r8d}tj|j|d�t�|S)z�Try to find a loader for the specified module by delegating to
    self.find_loader().

    This method is deprecated in favor of finder.find_spec().

    Nz,Not importing directory {}: missing __init__rO)�find_loaderr&rPrQr;�
ImportWarning)r��fullname�loader�portions�msgrrr	�_find_module_shim�s

r�cCs�i}|dk	r||d<nd}|dk	r*||d<|dd�}|dd�}|dd�}|tkr|dj||�}tjd	|�t|f|��nVt|�dkr�d
j|�}tjd	|�t|��n*t|�dkr�dj|�}tjd	|�t|��|dk	�r|yt|d�}	Wntk
�rYn2Xt	|�|	k�r4d
j|�}tjd	|�t|f|��y|dd@}
Wntk
�rZYn"Xt	|�|
k�r|td
j|�f|��|dd�S)azValidate the header of the passed-in bytecode against source_stats (if
    given) and returning the bytecode that can be compiled by compile().

    All other arguments are used to enhance error reporting.

    ImportError is raised when the magic number is incorrect or the bytecode is
    found to be stale. EOFError is raised when the data is found to be
    truncated.

    Nr�z
<bytecode>r*r��zbad magic number in {!r}: {!r}z{}z+reached EOF while reading timestamp in {!r}z0reached EOF while reading size of source in {!r}�mtimezbytecode is stale for {!r}�sizel��)
�MAGIC_NUMBERr;r��_verbose_messager�r&�EOFErrorr�KeyErrorr)rF�source_statsr�r*�exc_details�magic�
raw_timestamp�raw_sizera�source_mtime�source_sizerrr	�_validate_bytecode_header�sL





r�cCsPtj|�}t|t�r8tjd|�|dk	r4tj||�|Stdj	|�||d��dS)z<Compile bytecode as returned by _validate_bytecode_header().zcode object from {!r}NzNon-code object in {!r})r�r*)
�marshal�loads�
isinstance�
_code_typer�r��_imp�_fix_co_filenamer�r;)rFr�rxrz�coderrr	�_compile_bytecode�s


r�rOcCs8tt�}|jt|��|jt|��|jtj|��|S)zPCompile a code object into bytecode for writing out to a byte-compiled
    file.)�	bytearrayr��extendrr��dumps)r�r�r�rFrrr	�_code_to_bytecode�s
r�cCs>ddl}tj|�j}|j|�}tjdd�}|j|j|d��S)zyDecode bytes representing source code and return the string.

    Universal newline support is used in the decoding.
    rONT)�tokenizerA�BytesIO�readline�detect_encoding�IncrementalNewlineDecoder�decode)�source_bytesr��source_bytes_readline�encoding�newline_decoderrrr	�
decode_source�s

r�)r��submodule_search_locationsc	Cs|dkr<d}t|d�rFy|j|�}WqFtk
r8YqFXn
tj|�}tj|||d�}d|_|dkr�x6t�D](\}}|j	t
|��rl|||�}||_PqlWdS|tkr�t|d�r�y|j
|�}Wntk
r�Yq�X|r�g|_n||_|jgk�r|�rt|�d}|jj|�|S)a=Return a module spec based on a file location.

    To indicate that the module is a package, set
    submodule_search_locations to a list of directory paths.  An
    empty list is sufficient, though its not otherwise useful to the
    import system.

    The loader must take a spec as its only __init__() arg.

    Nz	<unknown>�get_filename)�originT�
is_packagerO)r�r�r�rrTr��
ModuleSpec�
_set_fileattr�_get_supported_file_loadersr|r}r��	_POPULATEr�r�r.�append)	r��locationr�r��spec�loader_class�suffixesr��dirnamerrr	�spec_from_file_locations>



r�c@sPeZdZdZdZdZdZedd��Zedd��Z	edd
d��Z
eddd
��Zd	S)�WindowsRegistryFinderz>Meta path finder for modules declared in the Windows registry.z;Software\Python\PythonCore\{sys_version}\Modules\{fullname}zASoftware\Python\PythonCore\{sys_version}\Modules\{fullname}\DebugFcCs2ytjtj|�Stk
r,tjtj|�SXdS)N)�_winreg�OpenKey�HKEY_CURRENT_USERr1�HKEY_LOCAL_MACHINE)�clsrrrr	�_open_registry\sz$WindowsRegistryFinder._open_registrycCsp|jr|j}n|j}|j|dtjdd�d�}y&|j|��}tj|d�}WdQRXWnt	k
rjdSX|S)Nz%d.%drK)r��sys_versionr%)
�DEBUG_BUILD�REGISTRY_KEY_DEBUG�REGISTRY_KEYr;r�version_infor�r��
QueryValuer1)r�r��registry_keyr�hkey�filepathrrr	�_search_registrycsz&WindowsRegistryFinder._search_registryNcCsx|j|�}|dkrdSyt|�Wntk
r6dSXx:t�D]0\}}|jt|��r@tj||||�|d�}|Sq@WdS)N)r�)r�r0r1r�r|r}r��spec_from_loader)r�r�r*�targetr�r�r�r�rrr	�	find_specrs
zWindowsRegistryFinder.find_speccCs"|j||�}|dk	r|jSdSdS)zlFind module named in the registry.

        This method is deprecated.  Use exec_module() instead.

        N)r�r�)r�r�r*r�rrr	�find_module�sz!WindowsRegistryFinder.find_module)NN)N)r�r�r�r�r�r�r��classmethodr�r�r�r�rrrr	r�Psr�c@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�
_LoaderBasicszSBase class of common code needed by both SourceLoader and
    SourcelessFileLoader.cCs@t|j|��d}|jdd�d}|jd�d}|dko>|dkS)z�Concrete implementation of InspectLoader.is_package by checking if
        the path returned by get_filename has a filename of '__init__.py'.r#rNrOrK�__init__)r.r�r)r')r�r�r~�
filename_base�	tail_namerrr	r��sz_LoaderBasics.is_packagecCsdS)z*Use default semantics for module creation.Nr)r�r�rrr	�
create_module�sz_LoaderBasics.create_modulecCs8|j|j�}|dkr$tdj|j���tjt||j�dS)zExecute the module.Nz4cannot load module {!r} when get_code() returns None)�get_coder�r�r;r��_call_with_frames_removed�execr�)r��moduler�rrr	�exec_module�s

z_LoaderBasics.exec_modulecCstj||�S)zThis module is deprecated.)r��_load_module_shim)r�r�rrr	�load_module�sz_LoaderBasics.load_moduleN)r�r�r�r�r�r�r�r�rrrr	r��s
r�c@sJeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�d
d�Zdd�Z	dS)�SourceLoadercCst�dS)z�Optional method that returns the modification time (an int) for the
        specified path, where path is a str.

        Raises IOError when the path cannot be handled.
        N)�IOError)r�r*rrr	�
path_mtime�szSourceLoader.path_mtimecCsd|j|�iS)a�Optional method returning a metadata dict for the specified path
        to by the path (str).
        Possible keys:
        - 'mtime' (mandatory) is the numeric timestamp of last source
          code modification;
        - 'size' (optional) is the size in bytes of the source code.

        Implementing this method allows the loader to read bytecode files.
        Raises IOError when the path cannot be handled.
        r�)r�)r�r*rrr	�
path_stats�szSourceLoader.path_statscCs|j||�S)z�Optional method which writes data (bytes) to a file path (a str).

        Implementing this method allows for the writing of bytecode files.

        The source path is needed in order to correctly transfer permissions
        )�set_data)r�rz�
cache_pathrFrrr	�_cache_bytecode�szSourceLoader._cache_bytecodecCsdS)z�Optional method which writes data (bytes) to a file path (a str).

        Implementing this method allows for the writing of bytecode files.
        Nr)r�r*rFrrr	r��szSourceLoader.set_datacCsR|j|�}y|j|�}Wn0tk
rH}ztd|d�|�WYdd}~XnXt|�S)z4Concrete implementation of InspectLoader.get_source.z'source not available through get_data())r�N)r��get_datar1r�r�)r�r�r*r��excrrr	�
get_source�s
zSourceLoader.get_sourcer#)�	_optimizecCstjt||dd|d�S)z�Return the code object compiled from source.

        The 'data' argument can be any object type that compile() supports.
        r�T)�dont_inheritrY)r�r��compile)r�rFr*rrrr	�source_to_code�szSourceLoader.source_to_codec
+Cs^|j|�}d}yt|�}Wntk
r2d}Yn�Xy|j|�}Wntk
rVYn~Xt|d�}y|j|�}Wntk
r�YnNXyt||||d�}Wnt	t
fk
r�Yn Xtjd||�t
||||d�S|j|�}|j||�}	tjd|�tj�rZ|dk	�rZ|dk	�rZt|	|t|��}y|j|||�tjd|�Wntk
�rXYnX|	S)z�Concrete implementation of InspectLoader.get_code.

        Reading of bytecode requires path_stats to be implemented. To write
        bytecode, set_data must also be implemented.

        Nr�)r�r�r*z
{} matches {})r�rxrzzcode object from {}z
wrote {!r})r�rhrWr�r�rr�r1r�r�r�r�r�r�rr�dont_write_bytecoder�r&r�)
r�r�rzr�rx�strF�
bytes_datar��code_objectrrr	r��sN




zSourceLoader.get_codeNrv)
r�r�r�r�r�r�r�rrr�rrrr	r��s


r�csPeZdZdZdd�Zdd�Zdd�Ze�fdd	��Zed
d��Z	dd
�Z
�ZS)�
FileLoaderzgBase file loader class which implements the loader protocol methods that
    require file system usage.cCs||_||_dS)zKCache the module name and the path to the file found by the
        finder.N)r�r*)r�r�r*rrr	r� szFileLoader.__init__cCs|j|jko|j|jkS)N)�	__class__r�)r��otherrrr	�__eq__&szFileLoader.__eq__cCst|j�t|j�AS)N)�hashr�r*)r�rrr	�__hash__*szFileLoader.__hash__cstt|�j|�S)zdLoad a module from a file.

        This method is deprecated.  Use exec_module() instead.

        )�superr	r�)r�r�)r
rr	r�-s
zFileLoader.load_modulecCs|jS)z:Return the path to the source file as found by the finder.)r*)r�r�rrr	r�9szFileLoader.get_filenamec	Cs tj|d��
}|j�SQRXdS)z'Return the data from path as raw bytes.�rN)rArB�read)r�r*rIrrr	r�>szFileLoader.get_data)r�r�r�r�r�rrr�r�r�r��
__classcell__rr)r
r	r	sr	c@s.eZdZdZdd�Zdd�Zdd�dd	�Zd
S)�SourceFileLoaderz>Concrete implementation of SourceLoader using the file system.cCst|�}|j|jd�S)z!Return the metadata for the path.)r�r�)r0�st_mtime�st_size)r�r*rrrr	r�HszSourceFileLoader.path_statscCst|�}|j|||d�S)N)�_mode)r�r�)r�rzrxrFr3rrr	r�Msz SourceFileLoader._cache_bytecodei�)rc	Cs�t|�\}}g}x(|r8t|�r8t|�\}}|j|�qWxlt|�D]`}t||�}ytj|�WqDtk
rvwDYqDtk
r�}zt	j
d||�dSd}~XqDXqDWyt|||�t	j
d|�Wn0tk
r�}zt	j
d||�WYdd}~XnXdS)zWrite bytes data to a file.zcould not create {!r}: {!r}Nzcreated {!r})r.r8r�r(r"r�mkdir�FileExistsErrorr1r�r�rJ)	r�r*rFr�parentr~r!rr�rrr	r�Rs*
zSourceFileLoader.set_dataN)r�r�r�r�r�r�r�rrrr	rDsrc@s eZdZdZdd�Zdd�ZdS)�SourcelessFileLoaderz-Loader which handles sourceless file imports.cCs0|j|�}|j|�}t|||d�}t|||d�S)N)r�r*)r�rx)r�r�r�r�)r�r�r*rFrrrr	r�us

zSourcelessFileLoader.get_codecCsdS)z'Return None as there is no source code.Nr)r�r�rrr	r{szSourcelessFileLoader.get_sourceN)r�r�r�r�r�rrrrr	rqsrc@s\eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zedd��Z
dS)�ExtensionFileLoaderz]Loader for extension modules.

    The constructor is designed to work with FileFinder.

    cCs||_||_dS)N)r�r*)r�r�r*rrr	r��szExtensionFileLoader.__init__cCs|j|jko|j|jkS)N)r
r�)r�rrrr	r�szExtensionFileLoader.__eq__cCst|j�t|j�AS)N)r
r�r*)r�rrr	r�szExtensionFileLoader.__hash__cCs$tjtj|�}tjd|j|j�|S)z&Create an unitialized extension modulez&extension module {!r} loaded from {!r})r�r�r��create_dynamicr�r�r*)r�r�r�rrr	r��s

z!ExtensionFileLoader.create_modulecCs$tjtj|�tjd|j|j�dS)zInitialize an extension modulez(extension module {!r} executed from {!r}N)r�r�r��exec_dynamicr�r�r*)r�r�rrr	r��szExtensionFileLoader.exec_modulecs$t|j�d�t�fdd�tD��S)z1Return True if the extension module is a package.r#c3s|]}�d|kVqdS)r�Nr)r�suffix)�	file_namerr	�	<genexpr>�sz1ExtensionFileLoader.is_package.<locals>.<genexpr>)r.r*�any�EXTENSION_SUFFIXES)r�r�r)rr	r��szExtensionFileLoader.is_packagecCsdS)z?Return None as an extension module cannot create a code object.Nr)r�r�rrr	r��szExtensionFileLoader.get_codecCsdS)z5Return None as extension modules have no source code.Nr)r�r�rrr	r�szExtensionFileLoader.get_sourcecCs|jS)z:Return the path to the source file as found by the finder.)r*)r�r�rrr	r��sz ExtensionFileLoader.get_filenameN)r�r�r�r�r�rrr�r�r�r�rr�r�rrrr	r�src@s`eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dS)�_NamespacePatha&Represents a namespace package's path.  It uses the module name
    to find its parent module, and from there it looks up the parent's
    __path__.  When this changes, the module's own path is recomputed,
    using path_finder.  For top-level modules, the parent module's path
    is sys.path.cCs$||_||_t|j��|_||_dS)N)�_name�_pathr}�_get_parent_path�_last_parent_path�_path_finder)r�r�r*�path_finderrrr	r��sz_NamespacePath.__init__cCs&|jjd�\}}}|dkrdS|dfS)z>Returns a tuple of (parent-module-name, parent-path-attr-name)rNr%rr*�__path__)rr*)r$r')r�r�dot�merrr	�_find_parent_path_names�sz&_NamespacePath._find_parent_path_namescCs|j�\}}ttj||�S)N)r-r�r�modules)r��parent_module_name�path_attr_namerrr	r&�sz_NamespacePath._get_parent_pathcCsPt|j��}||jkrJ|j|j|�}|dk	rD|jdkrD|jrD|j|_||_|jS)N)r}r&r'r(r$r�r�r%)r��parent_pathr�rrr	�_recalculate�s
z_NamespacePath._recalculatecCst|j��S)N)�iterr2)r�rrr	�__iter__�sz_NamespacePath.__iter__cCs||j|<dS)N)r%)r��indexr*rrr	�__setitem__�sz_NamespacePath.__setitem__cCst|j��S)N)r&r2)r�rrr	�__len__�sz_NamespacePath.__len__cCsdj|j�S)Nz_NamespacePath({!r}))r;r%)r�rrr	�__repr__�sz_NamespacePath.__repr__cCs||j�kS)N)r2)r��itemrrr	�__contains__�sz_NamespacePath.__contains__cCs|jj|�dS)N)r%r�)r�r9rrr	r��sz_NamespacePath.appendN)r�r�r�r�r�r-r&r2r4r6r7r8r:r�rrrr	r#�s

r#c@sPeZdZdd�Zedd��Zdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�ZdS)�_NamespaceLoadercCst|||�|_dS)N)r#r%)r�r�r*r)rrr	r��sz_NamespaceLoader.__init__cCsdj|j�S)zsReturn repr for the module.

        The method is deprecated.  The import machinery does the job itself.

        z<module {!r} (namespace)>)r;r�)r�r�rrr	�module_repr�sz_NamespaceLoader.module_reprcCsdS)NTr)r�r�rrr	r�sz_NamespaceLoader.is_packagecCsdS)Nr%r)r�r�rrr	rsz_NamespaceLoader.get_sourcecCstddddd�S)Nr%z<string>r�T)r)r)r�r�rrr	r�sz_NamespaceLoader.get_codecCsdS)z*Use default semantics for module creation.Nr)r�r�rrr	r�sz_NamespaceLoader.create_modulecCsdS)Nr)r�r�rrr	r�sz_NamespaceLoader.exec_modulecCstjd|j�tj||�S)zbLoad a namespace module.

        This method is deprecated.  Use exec_module() instead.

        z&namespace module loaded with path {!r})r�r�r%r�)r�r�rrr	r�sz_NamespaceLoader.load_moduleN)r�r�r�r�r�r<r�rr�r�r�r�rrrr	r;�s	r;c@sjeZdZdZedd��Zedd��Zedd��Zedd	��Zeddd��Z	edd
d��Z
eddd��Zd
S)�
PathFinderz>Meta path finder for sys.path and package __path__ attributes.cCs*x$tjj�D]}t|d�r|j�qWdS)z}Call the invalidate_caches() method on all path entry finders
        stored in sys.path_importer_caches (where implemented).�invalidate_cachesN)r�path_importer_cache�valuesr�r>)r��finderrrr	r>#s
zPathFinder.invalidate_cachescCsVtjdk	rtjrtjdt�x2tjD]$}y||�Stk
rHw&Yq&Xq&WdSdS)z.Search sys.path_hooks for a finder for 'path'.Nzsys.path_hooks is empty)r�
path_hooksrPrQr�r�)r�r*�hookrrr	�_path_hooks+szPathFinder._path_hookscCsf|dkr*ytj�}Wntk
r(dSXytj|}Wn(tk
r`|j|�}|tj|<YnX|S)z�Get the finder for the path entry from sys.path_importer_cache.

        If the path entry is not in the cache, find the appropriate finder
        and cache it. If no finder is available, store None.

        r%N)rr7�FileNotFoundErrorrr?r�rD)r�r*rArrr	�_path_importer_cache8s
zPathFinder._path_importer_cachecCsRt|d�r|j|�\}}n|j|�}g}|dk	r<tj||�Stj|d�}||_|S)Nr�)r�r�r�r�r�r�r�)r�r�rAr�r�r�rrr	�_legacy_get_specNs

zPathFinder._legacy_get_specNc	Cs�g}x�|D]�}t|ttf�sq
|j|�}|dk	r
t|d�rH|j||�}n|j||�}|dkr^q
|jdk	rl|S|j}|dkr�t	d��|j
|�q
Wtj|d�}||_|SdS)z?Find the loader or namespace_path for this module/package name.Nr�zspec missing loader)
r�rZ�bytesrFr�r�rGr�r�r�r�r�r�)	r�r�r*r��namespace_path�entryrAr�r�rrr	�	_get_spec]s(



zPathFinder._get_speccCsd|dkrtj}|j|||�}|dkr(dS|jdkr\|j}|rVd|_t|||j�|_|SdSn|SdS)z�Try to find a spec for 'fullname' on sys.path or 'path'.

        The search is based on sys.path_hooks and sys.path_importer_cache.
        N�	namespace)rr*rKr�r�r�r#)r�r�r*r�r�rIrrr	r�}s
zPathFinder.find_speccCs|j||�}|dkrdS|jS)z�find the module on sys.path or 'path' based on sys.path_hooks and
        sys.path_importer_cache.

        This method is deprecated.  Use find_spec() instead.

        N)r�r�)r�r�r*r�rrr	r��szPathFinder.find_module)N)NN)N)r�r�r�r�r�r>rDrFrGrKr�r�rrrr	r=s
r=c@sZeZdZdZdd�Zdd�ZeZdd�Zdd	�Z	ddd�Z
d
d�Zedd��Z
dd�Zd
S)�
FileFinderz�File-based finder.

    Interactions with the file system are cached for performance, being
    refreshed when the directory the finder is handling has been modified.

    csXg}x(|D] \�}|j�fdd�|D��q
W||_|p:d|_d|_t�|_t�|_dS)z�Initialize with the path to search on and a variable number of
        2-tuples containing the loader and the file suffixes the loader
        recognizes.c3s|]}|�fVqdS)Nr)rr)r�rr	r �sz&FileFinder.__init__.<locals>.<genexpr>rNr#Nrv)r��_loadersr*�_path_mtime�set�_path_cache�_relaxed_path_cache)r�r*�loader_details�loadersr�r)r�r	r��s
zFileFinder.__init__cCs
d|_dS)zInvalidate the directory mtime.r#Nrv)rO)r�rrr	r>�szFileFinder.invalidate_cachescCs*|j|�}|dkrdgfS|j|jp&gfS)z�Try to find a loader for the specified module, or the namespace
        package portions. Returns (loader, list-of-portions).

        This method is deprecated.  Use find_spec() instead.

        N)r�r�r�)r�r�r�rrr	r��s
zFileFinder.find_loadercCs|||�}t||||d�S)N)r�r�)r�)r�r�r�r*�smslr�r�rrr	rK�s
zFileFinder._get_specNcCsbd}|jd�d}yt|jp"tj��j}Wntk
rBd
}YnX||jkr\|j�||_t	�rr|j
}|j�}n
|j}|}||kr�t
|j|�}xH|jD]6\}	}
d|	}t
||�}t|�r�|j|
|||g|�Sq�Wt|�}xX|jD]N\}	}
t
|j||	�}tjd|dd�||	|kr�t|�r�|j|
||d|�Sq�W|�r^tjd	|�tj|d�}
|g|
_|
SdS)zoTry to find a spec for the specified module.

        Returns the matching spec, or None if not found.
        FrNrKr#r�z	trying {})�	verbosityNzpossible namespace for {}rv)r'r0r*rr7rr1rO�_fill_cacher
rRrwrQr"rNr6rKr8r�r�r�r�)r�r�r��is_namespace�tail_moduler��cache�cache_module�	base_pathrr��
init_filename�	full_pathr�rrr	r��sF




zFileFinder.find_specc	
Cs�|j}ytj|ptj��}Wntttfk
r:g}YnXtjj	d�sTt
|�|_nNt
�}x@|D]8}|jd�\}}}|r�dj
||j��}n|}|j|�q`W||_tjj	t�r�dd�|D�|_dS)zDFill the cache of potential modules and packages for this directory.rrNz{}.{}cSsh|]}|j��qSr)rw)r�fnrrr	�	<setcomp>sz)FileFinder._fill_cache.<locals>.<setcomp>N)r*r�listdirr7rE�PermissionError�NotADirectoryErrorrrr
rPrQrlr;rw�addrrR)	r�r*�contents�lower_suffix_contentsr9r�r+r�new_namerrr	rWs"

zFileFinder._fill_cachecs��fdd�}|S)aA class method which returns a closure to use on sys.path_hook
        which will return an instance using the specified loaders and the path
        called on the closure.

        If the path called on the closure is not a directory, ImportError is
        raised.

        cs"t|�std|d���|f���S)z-Path hook for importlib.machinery.FileFinder.zonly directories are supported)r*)r8r�)r*)r�rSrr	�path_hook_for_FileFinder*sz6FileFinder.path_hook.<locals>.path_hook_for_FileFinderr)r�rSrhr)r�rSr	�	path_hook s
zFileFinder.path_hookcCsdj|j�S)NzFileFinder({!r}))r;r*)r�rrr	r82szFileFinder.__repr__)N)r�r�r�r�r�r>r�r�r�rKr�rWr�rir8rrrr	rM�s
0rMcCs�|jd�}|jd�}|sB|r$|j}n||kr8t||�}n
t||�}|sTt|||d�}y$||d<||d<||d<||d<Wntk
r�YnXdS)N�
__loader__�__spec__)r��__file__�
__cached__)�getr�rrr��	Exception)�nsr��pathname�	cpathnamer�r�rrr	�_fix_up_module8s"


rscCs*tttj��f}ttf}ttf}|||gS)z_Returns a list of file-based module loaders.

    Each item is a tuple (loader, suffixes).
    )r�_alternative_architecturesr��extension_suffixesrrmrr_)�
extensions�source�bytecoderrr	r�Osr�cCs�|atjatjatjt}x8dD]0}|tjkr:tj|�}n
tj|}t|||�q Wddgfdddgff}x`|D]P\}}|d	}|tjkr�tj|}Pqpytj|�}PWqptk
r�wpYqpXqpWtd
��t|d|�t|d|�t|d
dj|��ytjd�}	Wntk
�rd}	YnXt|d|	�tjd�}
t|d|
�|dk�rbtjd�}t|d|�t|dt	��t
jttj
���|dk�r�tjd�dt
k�r�dt_dS)z�Setup the path-based importers for importlib by importing needed
    built-in modules and injecting them into the global namespace.

    Other components are extracted from the core bootstrap module.

    rArP�builtinsr��posix�/�nt�\rOzimportlib requires posix or ntrrrr%�_threadN�_weakref�winregr�r
z.pywz_d.pydT)rArPryr�)r�rr�r.r��_builtin_from_namer�r�r rr"r�rtrurmr�r�r�)�_bootstrap_module�self_module�builtin_name�builtin_module�
os_details�
builtin_osrr�	os_module�
thread_module�weakref_module�
winreg_modulerrr	�_setupZsP













r�cCs2t|�t�}tjjtj|�g�tjjt	�dS)z)Install the path-based import components.N)
r�r�rrBr�rMri�	meta_pathr�r=)r��supported_loadersrrr	�_install�sr�z-arm-linux-gnueabihf.z-armeb-linux-gnueabihf.z-mips64-linux-gnuabi64.z-mips64el-linux-gnuabi64.z-powerpc-linux-gnu.z-powerpc-linux-gnuspe.z-powerpc64-linux-gnu.z-powerpc64le-linux-gnu.z-arm-linux-gnueabi.z-armeb-linux-gnueabi.z-mips64-linux-gnu.z-mips64el-linux-gnu.z-ppc-linux-gnu.z-ppc-linux-gnuspe.z-ppc64-linux-gnu.z-ppc64le-linux-gnu.)z-arm-linux-gnueabi.z-armeb-linux-gnueabi.z-mips64-linux-gnu.z-mips64el-linux-gnu.z-ppc-linux-gnu.z-ppc-linux-gnuspe.z-ppc64-linux-gnu.z-ppc64le-linux-gnu.z-arm-linux-gnueabihf.z-armeb-linux-gnueabihf.z-mips64-linux-gnuabi64.z-mips64el-linux-gnuabi64.z-powerpc-linux-gnu.z-powerpc-linux-gnuspe.z-powerpc64-linux-gnu.z-powerpc64le-linux-gnu.cCsFx@|D]8}x2tj�D]&\}}||kr|j|j||��|SqWqW|S)z�Add a suffix with an alternative architecture name
    to the list of suffixes so an extension built with
    the default (upstream) setting is loadable with our Pythons
    )�	_ARCH_MAP�itemsr�rD)r�r�original�alternativerrr	rt�s
rt)r)rr)r9)N)NNN)NNN)rOrO)N)N)<r�r�%_CASE_INSENSITIVE_PLATFORMS_BYTES_KEYrrrrr"r.r0r5r6r8rJ�type�__code__r�rr�rr�_RAW_MAGIC_NUMBERr^r]rmr_�DEBUG_BYTECODE_SUFFIXES�OPTIMIZED_BYTECODE_SUFFIXESrhrsr{rr�r�r�r�r�r�r��objectr�r�r�r�r�r	rrr"rr#r;r=rMrsr�r�r�r�rtrrrr	�<module>s�
	

{-"
7


C@n)-5<*
D	_bootstrap.py000064400000115334150327175300007304 0ustar00"""Core implementation of import.

This module is NOT meant to be directly imported! It has been designed such
that it can be bootstrapped into Python as the implementation of import. As
such it requires the injection of specific modules and attributes in order to
work. One should use importlib as the public-facing version of this module.

"""
#
# IMPORTANT: Whenever making changes to this module, be sure to run a top-level
# `make regen-importlib` followed by `make` in order to get the frozen version
# of the module updated. Not doing so will result in the Makefile to fail for
# all others who don't have a ./python around to freeze the module
# in the early stages of compilation.
#

# See importlib._setup() for what is injected into the global namespace.

# When editing this code be aware that code executed at import time CANNOT
# reference any injected objects! This includes not only global code but also
# anything specified at the class level.

# Bootstrap-related code ######################################################

_bootstrap_external = None

def _wrap(new, old):
    """Simple substitute for functools.update_wrapper."""
    for replace in ['__module__', '__name__', '__qualname__', '__doc__']:
        if hasattr(old, replace):
            setattr(new, replace, getattr(old, replace))
    new.__dict__.update(old.__dict__)


def _new_module(name):
    return type(sys)(name)


# Module-level locking ########################################################

# A dict mapping module names to weakrefs of _ModuleLock instances
# Dictionary protected by the global import lock
_module_locks = {}
# A dict mapping thread ids to _ModuleLock instances
_blocking_on = {}


class _DeadlockError(RuntimeError):
    pass


class _ModuleLock:
    """A recursive lock implementation which is able to detect deadlocks
    (e.g. thread 1 trying to take locks A then B, and thread 2 trying to
    take locks B then A).
    """

    def __init__(self, name):
        self.lock = _thread.allocate_lock()
        self.wakeup = _thread.allocate_lock()
        self.name = name
        self.owner = None
        self.count = 0
        self.waiters = 0

    def has_deadlock(self):
        # Deadlock avoidance for concurrent circular imports.
        me = _thread.get_ident()
        tid = self.owner
        while True:
            lock = _blocking_on.get(tid)
            if lock is None:
                return False
            tid = lock.owner
            if tid == me:
                return True

    def acquire(self):
        """
        Acquire the module lock.  If a potential deadlock is detected,
        a _DeadlockError is raised.
        Otherwise, the lock is always acquired and True is returned.
        """
        tid = _thread.get_ident()
        _blocking_on[tid] = self
        try:
            while True:
                with self.lock:
                    if self.count == 0 or self.owner == tid:
                        self.owner = tid
                        self.count += 1
                        return True
                    if self.has_deadlock():
                        raise _DeadlockError('deadlock detected by %r' % self)
                    if self.wakeup.acquire(False):
                        self.waiters += 1
                # Wait for a release() call
                self.wakeup.acquire()
                self.wakeup.release()
        finally:
            del _blocking_on[tid]

    def release(self):
        tid = _thread.get_ident()
        with self.lock:
            if self.owner != tid:
                raise RuntimeError('cannot release un-acquired lock')
            assert self.count > 0
            self.count -= 1
            if self.count == 0:
                self.owner = None
                if self.waiters:
                    self.waiters -= 1
                    self.wakeup.release()

    def __repr__(self):
        return '_ModuleLock({!r}) at {}'.format(self.name, id(self))


class _DummyModuleLock:
    """A simple _ModuleLock equivalent for Python builds without
    multi-threading support."""

    def __init__(self, name):
        self.name = name
        self.count = 0

    def acquire(self):
        self.count += 1
        return True

    def release(self):
        if self.count == 0:
            raise RuntimeError('cannot release un-acquired lock')
        self.count -= 1

    def __repr__(self):
        return '_DummyModuleLock({!r}) at {}'.format(self.name, id(self))


class _ModuleLockManager:

    def __init__(self, name):
        self._name = name
        self._lock = None

    def __enter__(self):
        self._lock = _get_module_lock(self._name)
        self._lock.acquire()

    def __exit__(self, *args, **kwargs):
        self._lock.release()


# The following two functions are for consumption by Python/import.c.

def _get_module_lock(name):
    """Get or create the module lock for a given module name.

    Acquire/release internally the global import lock to protect
    _module_locks."""

    _imp.acquire_lock()
    try:
        try:
            lock = _module_locks[name]()
        except KeyError:
            lock = None

        if lock is None:
            if _thread is None:
                lock = _DummyModuleLock(name)
            else:
                lock = _ModuleLock(name)

            def cb(ref, name=name):
                _imp.acquire_lock()
                try:
                    # bpo-31070: Check if another thread created a new lock
                    # after the previous lock was destroyed
                    # but before the weakref callback was called.
                    if _module_locks.get(name) is ref:
                        del _module_locks[name]
                finally:
                    _imp.release_lock()

            _module_locks[name] = _weakref.ref(lock, cb)
    finally:
        _imp.release_lock()

    return lock


def _lock_unlock_module(name):
    """Acquires then releases the module lock for a given module name.

    This is used to ensure a module is completely initialized, in the
    event it is being imported by another thread.
    """
    lock = _get_module_lock(name)
    try:
        lock.acquire()
    except _DeadlockError:
        # Concurrent circular import, we'll accept a partially initialized
        # module object.
        pass
    else:
        lock.release()

# Frame stripping magic ###############################################
def _call_with_frames_removed(f, *args, **kwds):
    """remove_importlib_frames in import.c will always remove sequences
    of importlib frames that end with a call to this function

    Use it instead of a normal call in places where including the importlib
    frames introduces unwanted noise into the traceback (e.g. when executing
    module code)
    """
    return f(*args, **kwds)


def _verbose_message(message, *args, verbosity=1):
    """Print the message to stderr if -v/PYTHONVERBOSE is turned on."""
    if sys.flags.verbose >= verbosity:
        if not message.startswith(('#', 'import ')):
            message = '# ' + message
        print(message.format(*args), file=sys.stderr)


def _requires_builtin(fxn):
    """Decorator to verify the named module is built-in."""
    def _requires_builtin_wrapper(self, fullname):
        if fullname not in sys.builtin_module_names:
            raise ImportError('{!r} is not a built-in module'.format(fullname),
                              name=fullname)
        return fxn(self, fullname)
    _wrap(_requires_builtin_wrapper, fxn)
    return _requires_builtin_wrapper


def _requires_frozen(fxn):
    """Decorator to verify the named module is frozen."""
    def _requires_frozen_wrapper(self, fullname):
        if not _imp.is_frozen(fullname):
            raise ImportError('{!r} is not a frozen module'.format(fullname),
                              name=fullname)
        return fxn(self, fullname)
    _wrap(_requires_frozen_wrapper, fxn)
    return _requires_frozen_wrapper


# Typically used by loader classes as a method replacement.
def _load_module_shim(self, fullname):
    """Load the specified module into sys.modules and return it.

    This method is deprecated.  Use loader.exec_module instead.

    """
    spec = spec_from_loader(fullname, self)
    if fullname in sys.modules:
        module = sys.modules[fullname]
        _exec(spec, module)
        return sys.modules[fullname]
    else:
        return _load(spec)

# Module specifications #######################################################

def _module_repr(module):
    # The implementation of ModuleType.__repr__().
    loader = getattr(module, '__loader__', None)
    if hasattr(loader, 'module_repr'):
        # As soon as BuiltinImporter, FrozenImporter, and NamespaceLoader
        # drop their implementations for module_repr. we can add a
        # deprecation warning here.
        try:
            return loader.module_repr(module)
        except Exception:
            pass
    try:
        spec = module.__spec__
    except AttributeError:
        pass
    else:
        if spec is not None:
            return _module_repr_from_spec(spec)

    # We could use module.__class__.__name__ instead of 'module' in the
    # various repr permutations.
    try:
        name = module.__name__
    except AttributeError:
        name = '?'
    try:
        filename = module.__file__
    except AttributeError:
        if loader is None:
            return '<module {!r}>'.format(name)
        else:
            return '<module {!r} ({!r})>'.format(name, loader)
    else:
        return '<module {!r} from {!r}>'.format(name, filename)


class ModuleSpec:
    """The specification for a module, used for loading.

    A module's spec is the source for information about the module.  For
    data associated with the module, including source, use the spec's
    loader.

    `name` is the absolute name of the module.  `loader` is the loader
    to use when loading the module.  `parent` is the name of the
    package the module is in.  The parent is derived from the name.

    `is_package` determines if the module is considered a package or
    not.  On modules this is reflected by the `__path__` attribute.

    `origin` is the specific location used by the loader from which to
    load the module, if that information is available.  When filename is
    set, origin will match.

    `has_location` indicates that a spec's "origin" reflects a location.
    When this is True, `__file__` attribute of the module is set.

    `cached` is the location of the cached bytecode file, if any.  It
    corresponds to the `__cached__` attribute.

    `submodule_search_locations` is the sequence of path entries to
    search when importing submodules.  If set, is_package should be
    True--and False otherwise.

    Packages are simply modules that (may) have submodules.  If a spec
    has a non-None value in `submodule_search_locations`, the import
    system will consider modules loaded from the spec as packages.

    Only finders (see importlib.abc.MetaPathFinder and
    importlib.abc.PathEntryFinder) should modify ModuleSpec instances.

    """

    def __init__(self, name, loader, *, origin=None, loader_state=None,
                 is_package=None):
        self.name = name
        self.loader = loader
        self.origin = origin
        self.loader_state = loader_state
        self.submodule_search_locations = [] if is_package else None

        # file-location attributes
        self._set_fileattr = False
        self._cached = None

    def __repr__(self):
        args = ['name={!r}'.format(self.name),
                'loader={!r}'.format(self.loader)]
        if self.origin is not None:
            args.append('origin={!r}'.format(self.origin))
        if self.submodule_search_locations is not None:
            args.append('submodule_search_locations={}'
                        .format(self.submodule_search_locations))
        return '{}({})'.format(self.__class__.__name__, ', '.join(args))

    def __eq__(self, other):
        smsl = self.submodule_search_locations
        try:
            return (self.name == other.name and
                    self.loader == other.loader and
                    self.origin == other.origin and
                    smsl == other.submodule_search_locations and
                    self.cached == other.cached and
                    self.has_location == other.has_location)
        except AttributeError:
            return False

    @property
    def cached(self):
        if self._cached is None:
            if self.origin is not None and self._set_fileattr:
                if _bootstrap_external is None:
                    raise NotImplementedError
                self._cached = _bootstrap_external._get_cached(self.origin)
        return self._cached

    @cached.setter
    def cached(self, cached):
        self._cached = cached

    @property
    def parent(self):
        """The name of the module's parent."""
        if self.submodule_search_locations is None:
            return self.name.rpartition('.')[0]
        else:
            return self.name

    @property
    def has_location(self):
        return self._set_fileattr

    @has_location.setter
    def has_location(self, value):
        self._set_fileattr = bool(value)


def spec_from_loader(name, loader, *, origin=None, is_package=None):
    """Return a module spec based on various loader methods."""
    if hasattr(loader, 'get_filename'):
        if _bootstrap_external is None:
            raise NotImplementedError
        spec_from_file_location = _bootstrap_external.spec_from_file_location

        if is_package is None:
            return spec_from_file_location(name, loader=loader)
        search = [] if is_package else None
        return spec_from_file_location(name, loader=loader,
                                       submodule_search_locations=search)

    if is_package is None:
        if hasattr(loader, 'is_package'):
            try:
                is_package = loader.is_package(name)
            except ImportError:
                is_package = None  # aka, undefined
        else:
            # the default
            is_package = False

    return ModuleSpec(name, loader, origin=origin, is_package=is_package)


def _spec_from_module(module, loader=None, origin=None):
    # This function is meant for use in _setup().
    try:
        spec = module.__spec__
    except AttributeError:
        pass
    else:
        if spec is not None:
            return spec

    name = module.__name__
    if loader is None:
        try:
            loader = module.__loader__
        except AttributeError:
            # loader will stay None.
            pass
    try:
        location = module.__file__
    except AttributeError:
        location = None
    if origin is None:
        if location is None:
            try:
                origin = loader._ORIGIN
            except AttributeError:
                origin = None
        else:
            origin = location
    try:
        cached = module.__cached__
    except AttributeError:
        cached = None
    try:
        submodule_search_locations = list(module.__path__)
    except AttributeError:
        submodule_search_locations = None

    spec = ModuleSpec(name, loader, origin=origin)
    spec._set_fileattr = False if location is None else True
    spec.cached = cached
    spec.submodule_search_locations = submodule_search_locations
    return spec


def _init_module_attrs(spec, module, *, override=False):
    # The passed-in module may be not support attribute assignment,
    # in which case we simply don't set the attributes.
    # __name__
    if (override or getattr(module, '__name__', None) is None):
        try:
            module.__name__ = spec.name
        except AttributeError:
            pass
    # __loader__
    if override or getattr(module, '__loader__', None) is None:
        loader = spec.loader
        if loader is None:
            # A backward compatibility hack.
            if spec.submodule_search_locations is not None:
                if _bootstrap_external is None:
                    raise NotImplementedError
                _NamespaceLoader = _bootstrap_external._NamespaceLoader

                loader = _NamespaceLoader.__new__(_NamespaceLoader)
                loader._path = spec.submodule_search_locations
                spec.loader = loader
                # While the docs say that module.__file__ is not set for
                # built-in modules, and the code below will avoid setting it if
                # spec.has_location is false, this is incorrect for namespace
                # packages.  Namespace packages have no location, but their
                # __spec__.origin is None, and thus their module.__file__
                # should also be None for consistency.  While a bit of a hack,
                # this is the best place to ensure this consistency.
                #
                # See # https://docs.python.org/3/library/importlib.html#importlib.abc.Loader.load_module
                # and bpo-32305
                module.__file__ = None
        try:
            module.__loader__ = loader
        except AttributeError:
            pass
    # __package__
    if override or getattr(module, '__package__', None) is None:
        try:
            module.__package__ = spec.parent
        except AttributeError:
            pass
    # __spec__
    try:
        module.__spec__ = spec
    except AttributeError:
        pass
    # __path__
    if override or getattr(module, '__path__', None) is None:
        if spec.submodule_search_locations is not None:
            try:
                module.__path__ = spec.submodule_search_locations
            except AttributeError:
                pass
    # __file__/__cached__
    if spec.has_location:
        if override or getattr(module, '__file__', None) is None:
            try:
                module.__file__ = spec.origin
            except AttributeError:
                pass

        if override or getattr(module, '__cached__', None) is None:
            if spec.cached is not None:
                try:
                    module.__cached__ = spec.cached
                except AttributeError:
                    pass
    return module


def module_from_spec(spec):
    """Create a module based on the provided spec."""
    # Typically loaders will not implement create_module().
    module = None
    if hasattr(spec.loader, 'create_module'):
        # If create_module() returns `None` then it means default
        # module creation should be used.
        module = spec.loader.create_module(spec)
    elif hasattr(spec.loader, 'exec_module'):
        raise ImportError('loaders that define exec_module() '
                          'must also define create_module()')
    if module is None:
        module = _new_module(spec.name)
    _init_module_attrs(spec, module)
    return module


def _module_repr_from_spec(spec):
    """Return the repr to use for the module."""
    # We mostly replicate _module_repr() using the spec attributes.
    name = '?' if spec.name is None else spec.name
    if spec.origin is None:
        if spec.loader is None:
            return '<module {!r}>'.format(name)
        else:
            return '<module {!r} ({!r})>'.format(name, spec.loader)
    else:
        if spec.has_location:
            return '<module {!r} from {!r}>'.format(name, spec.origin)
        else:
            return '<module {!r} ({})>'.format(spec.name, spec.origin)


# Used by importlib.reload() and _load_module_shim().
def _exec(spec, module):
    """Execute the spec's specified module in an existing module's namespace."""
    name = spec.name
    with _ModuleLockManager(name):
        if sys.modules.get(name) is not module:
            msg = 'module {!r} not in sys.modules'.format(name)
            raise ImportError(msg, name=name)
        try:
            if spec.loader is None:
                if spec.submodule_search_locations is None:
                    raise ImportError('missing loader', name=spec.name)
                # Namespace package.
                _init_module_attrs(spec, module, override=True)
            else:
                _init_module_attrs(spec, module, override=True)
                if not hasattr(spec.loader, 'exec_module'):
                    # (issue19713) Once BuiltinImporter and ExtensionFileLoader
                    # have exec_module() implemented, we can add a deprecation
                    # warning here.
                    spec.loader.load_module(name)
                else:
                    spec.loader.exec_module(module)
        finally:
            # Update the order of insertion into sys.modules for module
            # clean-up at shutdown.
            module = sys.modules.pop(spec.name)
            sys.modules[spec.name] = module
    return module


def _load_backward_compatible(spec):
    # (issue19713) Once BuiltinImporter and ExtensionFileLoader
    # have exec_module() implemented, we can add a deprecation
    # warning here.
    try:
        spec.loader.load_module(spec.name)
    except:
        if spec.name in sys.modules:
            module = sys.modules.pop(spec.name)
            sys.modules[spec.name] = module
        raise
    # The module must be in sys.modules at this point!
    # Move it to the end of sys.modules.
    module = sys.modules.pop(spec.name)
    sys.modules[spec.name] = module
    if getattr(module, '__loader__', None) is None:
        try:
            module.__loader__ = spec.loader
        except AttributeError:
            pass
    if getattr(module, '__package__', None) is None:
        try:
            # Since module.__path__ may not line up with
            # spec.submodule_search_paths, we can't necessarily rely
            # on spec.parent here.
            module.__package__ = module.__name__
            if not hasattr(module, '__path__'):
                module.__package__ = spec.name.rpartition('.')[0]
        except AttributeError:
            pass
    if getattr(module, '__spec__', None) is None:
        try:
            module.__spec__ = spec
        except AttributeError:
            pass
    return module

def _load_unlocked(spec):
    # A helper for direct use by the import system.
    if spec.loader is not None:
        # Not a namespace package.
        if not hasattr(spec.loader, 'exec_module'):
            return _load_backward_compatible(spec)

    module = module_from_spec(spec)

    # This must be done before putting the module in sys.modules
    # (otherwise an optimization shortcut in import.c becomes
    # wrong).
    spec._initializing = True
    try:
        sys.modules[spec.name] = module
        try:
            if spec.loader is None:
                if spec.submodule_search_locations is None:
                    raise ImportError('missing loader', name=spec.name)
                # A namespace package so do nothing.
            else:
                spec.loader.exec_module(module)
        except:
            try:
                del sys.modules[spec.name]
            except KeyError:
                pass
            raise
        # Move the module to the end of sys.modules.
        # We don't ensure that the import-related module attributes get
        # set in the sys.modules replacement case.  Such modules are on
        # their own.
        module = sys.modules.pop(spec.name)
        sys.modules[spec.name] = module
        _verbose_message('import {!r} # {!r}', spec.name, spec.loader)
    finally:
        spec._initializing = False

    return module

# A method used during testing of _load_unlocked() and by
# _load_module_shim().
def _load(spec):
    """Return a new module object, loaded by the spec's loader.

    The module is not added to its parent.

    If a module is already in sys.modules, that existing module gets
    clobbered.

    """
    with _ModuleLockManager(spec.name):
        return _load_unlocked(spec)


# Loaders #####################################################################

class BuiltinImporter:

    """Meta path import for built-in modules.

    All methods are either class or static methods to avoid the need to
    instantiate the class.

    """

    @staticmethod
    def module_repr(module):
        """Return repr for the module.

        The method is deprecated.  The import machinery does the job itself.

        """
        return '<module {!r} (built-in)>'.format(module.__name__)

    @classmethod
    def find_spec(cls, fullname, path=None, target=None):
        if path is not None:
            return None
        if _imp.is_builtin(fullname):
            return spec_from_loader(fullname, cls, origin='built-in')
        else:
            return None

    @classmethod
    def find_module(cls, fullname, path=None):
        """Find the built-in module.

        If 'path' is ever specified then the search is considered a failure.

        This method is deprecated.  Use find_spec() instead.

        """
        spec = cls.find_spec(fullname, path)
        return spec.loader if spec is not None else None

    @classmethod
    def create_module(self, spec):
        """Create a built-in module"""
        if spec.name not in sys.builtin_module_names:
            raise ImportError('{!r} is not a built-in module'.format(spec.name),
                              name=spec.name)
        return _call_with_frames_removed(_imp.create_builtin, spec)

    @classmethod
    def exec_module(self, module):
        """Exec a built-in module"""
        _call_with_frames_removed(_imp.exec_builtin, module)

    @classmethod
    @_requires_builtin
    def get_code(cls, fullname):
        """Return None as built-in modules do not have code objects."""
        return None

    @classmethod
    @_requires_builtin
    def get_source(cls, fullname):
        """Return None as built-in modules do not have source code."""
        return None

    @classmethod
    @_requires_builtin
    def is_package(cls, fullname):
        """Return False as built-in modules are never packages."""
        return False

    load_module = classmethod(_load_module_shim)


class FrozenImporter:

    """Meta path import for frozen modules.

    All methods are either class or static methods to avoid the need to
    instantiate the class.

    """

    _ORIGIN = "frozen"

    @staticmethod
    def module_repr(m):
        """Return repr for the module.

        The method is deprecated.  The import machinery does the job itself.

        """
        return '<module {!r} ({})>'.format(m.__name__, FrozenImporter._ORIGIN)

    @classmethod
    def find_spec(cls, fullname, path=None, target=None):
        if _imp.is_frozen(fullname):
            return spec_from_loader(fullname, cls, origin=cls._ORIGIN)
        else:
            return None

    @classmethod
    def find_module(cls, fullname, path=None):
        """Find a frozen module.

        This method is deprecated.  Use find_spec() instead.

        """
        return cls if _imp.is_frozen(fullname) else None

    @classmethod
    def create_module(cls, spec):
        """Use default semantics for module creation."""

    @staticmethod
    def exec_module(module):
        name = module.__spec__.name
        if not _imp.is_frozen(name):
            raise ImportError('{!r} is not a frozen module'.format(name),
                              name=name)
        code = _call_with_frames_removed(_imp.get_frozen_object, name)
        exec(code, module.__dict__)

    @classmethod
    def load_module(cls, fullname):
        """Load a frozen module.

        This method is deprecated.  Use exec_module() instead.

        """
        return _load_module_shim(cls, fullname)

    @classmethod
    @_requires_frozen
    def get_code(cls, fullname):
        """Return the code object for the frozen module."""
        return _imp.get_frozen_object(fullname)

    @classmethod
    @_requires_frozen
    def get_source(cls, fullname):
        """Return None as frozen modules do not have source code."""
        return None

    @classmethod
    @_requires_frozen
    def is_package(cls, fullname):
        """Return True if the frozen module is a package."""
        return _imp.is_frozen_package(fullname)


# Import itself ###############################################################

class _ImportLockContext:

    """Context manager for the import lock."""

    def __enter__(self):
        """Acquire the import lock."""
        _imp.acquire_lock()

    def __exit__(self, exc_type, exc_value, exc_traceback):
        """Release the import lock regardless of any raised exceptions."""
        _imp.release_lock()


def _resolve_name(name, package, level):
    """Resolve a relative module name to an absolute one."""
    bits = package.rsplit('.', level - 1)
    if len(bits) < level:
        raise ValueError('attempted relative import beyond top-level package')
    base = bits[0]
    return '{}.{}'.format(base, name) if name else base


def _find_spec_legacy(finder, name, path):
    # This would be a good place for a DeprecationWarning if
    # we ended up going that route.
    loader = finder.find_module(name, path)
    if loader is None:
        return None
    return spec_from_loader(name, loader)


def _find_spec(name, path, target=None):
    """Find a module's spec."""
    meta_path = sys.meta_path
    if meta_path is None:
        # PyImport_Cleanup() is running or has been called.
        raise ImportError("sys.meta_path is None, Python is likely "
                          "shutting down")

    if not meta_path:
        _warnings.warn('sys.meta_path is empty', ImportWarning)

    # We check sys.modules here for the reload case.  While a passed-in
    # target will usually indicate a reload there is no guarantee, whereas
    # sys.modules provides one.
    is_reload = name in sys.modules
    for finder in meta_path:
        with _ImportLockContext():
            try:
                find_spec = finder.find_spec
            except AttributeError:
                spec = _find_spec_legacy(finder, name, path)
                if spec is None:
                    continue
            else:
                spec = find_spec(name, path, target)
        if spec is not None:
            # The parent import may have already imported this module.
            if not is_reload and name in sys.modules:
                module = sys.modules[name]
                try:
                    __spec__ = module.__spec__
                except AttributeError:
                    # We use the found spec since that is the one that
                    # we would have used if the parent module hadn't
                    # beaten us to the punch.
                    return spec
                else:
                    if __spec__ is None:
                        return spec
                    else:
                        return __spec__
            else:
                return spec
    else:
        return None


def _sanity_check(name, package, level):
    """Verify arguments are "sane"."""
    if not isinstance(name, str):
        raise TypeError('module name must be str, not {}'.format(type(name)))
    if level < 0:
        raise ValueError('level must be >= 0')
    if level > 0:
        if not isinstance(package, str):
            raise TypeError('__package__ not set to a string')
        elif not package:
            raise ImportError('attempted relative import with no known parent '
                              'package')
    if not name and level == 0:
        raise ValueError('Empty module name')


_ERR_MSG_PREFIX = 'No module named '
_ERR_MSG = _ERR_MSG_PREFIX + '{!r}'

def _find_and_load_unlocked(name, import_):
    path = None
    parent = name.rpartition('.')[0]
    if parent:
        if parent not in sys.modules:
            _call_with_frames_removed(import_, parent)
        # Crazy side-effects!
        if name in sys.modules:
            return sys.modules[name]
        parent_module = sys.modules[parent]
        try:
            path = parent_module.__path__
        except AttributeError:
            msg = (_ERR_MSG + '; {!r} is not a package').format(name, parent)
            raise ModuleNotFoundError(msg, name=name) from None
    spec = _find_spec(name, path)
    if spec is None:
        raise ModuleNotFoundError(_ERR_MSG.format(name), name=name)
    else:
        module = _load_unlocked(spec)
    if parent:
        # Set the module as an attribute on its parent.
        parent_module = sys.modules[parent]
        setattr(parent_module, name.rpartition('.')[2], module)
    return module


_NEEDS_LOADING = object()


def _find_and_load(name, import_):
    """Find and load the module."""
    with _ModuleLockManager(name):
        module = sys.modules.get(name, _NEEDS_LOADING)
        if module is _NEEDS_LOADING:
            return _find_and_load_unlocked(name, import_)

    if module is None:
        message = ('import of {} halted; '
                   'None in sys.modules'.format(name))
        raise ModuleNotFoundError(message, name=name)

    _lock_unlock_module(name)
    return module


def _gcd_import(name, package=None, level=0):
    """Import and return the module based on its name, the package the call is
    being made from, and the level adjustment.

    This function represents the greatest common denominator of functionality
    between import_module and __import__. This includes setting __package__ if
    the loader did not.

    """
    _sanity_check(name, package, level)
    if level > 0:
        name = _resolve_name(name, package, level)
    return _find_and_load(name, _gcd_import)


def _handle_fromlist(module, fromlist, import_, *, recursive=False):
    """Figure out what __import__ should return.

    The import_ parameter is a callable which takes the name of module to
    import. It is required to decouple the function from assuming importlib's
    import implementation is desired.

    """
    # The hell that is fromlist ...
    # If a package was imported, try to import stuff from fromlist.
    for x in fromlist:
        if not isinstance(x, str):
            if recursive:
                where = module.__name__ + '.__all__'
            else:
                where = "``from list''"
            raise TypeError(f"Item in {where} must be str, "
                            f"not {type(x).__name__}")
        elif x == '*':
            if not recursive and hasattr(module, '__all__'):
                _handle_fromlist(module, module.__all__, import_,
                                 recursive=True)
        elif not hasattr(module, x):
            from_name = '{}.{}'.format(module.__name__, x)
            try:
                _call_with_frames_removed(import_, from_name)
            except ModuleNotFoundError as exc:
                # Backwards-compatibility dictates we ignore failed
                # imports triggered by fromlist for modules that don't
                # exist.
                if (exc.name == from_name and
                    sys.modules.get(from_name, _NEEDS_LOADING) is not None):
                    continue
                raise
    return module


def _calc___package__(globals):
    """Calculate what __package__ should be.

    __package__ is not guaranteed to be defined or could be set to None
    to represent that its proper value is unknown.

    """
    package = globals.get('__package__')
    spec = globals.get('__spec__')
    if package is not None:
        if spec is not None and package != spec.parent:
            _warnings.warn("__package__ != __spec__.parent "
                           f"({package!r} != {spec.parent!r})",
                           ImportWarning, stacklevel=3)
        return package
    elif spec is not None:
        return spec.parent
    else:
        _warnings.warn("can't resolve package from __spec__ or __package__, "
                       "falling back on __name__ and __path__",
                       ImportWarning, stacklevel=3)
        package = globals['__name__']
        if '__path__' not in globals:
            package = package.rpartition('.')[0]
    return package


def __import__(name, globals=None, locals=None, fromlist=(), level=0):
    """Import a module.

    The 'globals' argument is used to infer where the import is occurring from
    to handle relative imports. The 'locals' argument is ignored. The
    'fromlist' argument specifies what should exist as attributes on the module
    being imported (e.g. ``from module import <fromlist>``).  The 'level'
    argument represents the package location to import from in a relative
    import (e.g. ``from ..pkg import mod`` would have a 'level' of 2).

    """
    if level == 0:
        module = _gcd_import(name)
    else:
        globals_ = globals if globals is not None else {}
        package = _calc___package__(globals_)
        module = _gcd_import(name, package, level)
    if not fromlist:
        # Return up to the first dot in 'name'. This is complicated by the fact
        # that 'name' may be relative.
        if level == 0:
            return _gcd_import(name.partition('.')[0])
        elif not name:
            return module
        else:
            # Figure out where to slice the module's name up to the first dot
            # in 'name'.
            cut_off = len(name) - len(name.partition('.')[0])
            # Slice end needs to be positive to alleviate need to special-case
            # when ``'.' not in name``.
            return sys.modules[module.__name__[:len(module.__name__)-cut_off]]
    elif hasattr(module, '__path__'):
        return _handle_fromlist(module, fromlist, _gcd_import)
    else:
        return module


def _builtin_from_name(name):
    spec = BuiltinImporter.find_spec(name)
    if spec is None:
        raise ImportError('no built-in module named ' + name)
    return _load_unlocked(spec)


def _setup(sys_module, _imp_module):
    """Setup importlib by importing needed built-in modules and injecting them
    into the global namespace.

    As sys is needed for sys.modules access and _imp is needed to load built-in
    modules, those two modules must be explicitly passed in.

    """
    global _imp, sys
    _imp = _imp_module
    sys = sys_module

    # Set up the spec for existing builtin/frozen modules.
    module_type = type(sys)
    for name, module in sys.modules.items():
        if isinstance(module, module_type):
            if name in sys.builtin_module_names:
                loader = BuiltinImporter
            elif _imp.is_frozen(name):
                loader = FrozenImporter
            else:
                continue
            spec = _spec_from_module(module, loader)
            _init_module_attrs(spec, module)

    # Directly load built-in modules needed during bootstrap.
    self_module = sys.modules[__name__]
    for builtin_name in ('_thread', '_warnings', '_weakref'):
        if builtin_name not in sys.modules:
            builtin_module = _builtin_from_name(builtin_name)
        else:
            builtin_module = sys.modules[builtin_name]
        setattr(self_module, builtin_name, builtin_module)


def _install(sys_module, _imp_module):
    """Install importers for builtin and frozen modules"""
    _setup(sys_module, _imp_module)

    sys.meta_path.append(BuiltinImporter)
    sys.meta_path.append(FrozenImporter)


def _install_external_importers():
    """Install importers that require external filesystem access"""
    global _bootstrap_external
    import _frozen_importlib_external
    _bootstrap_external = _frozen_importlib_external
    _frozen_importlib_external._install(sys.modules[__name__])
__pycache__/metadata.cpython-38.opt-2.pyc000064400000035411150327175520014137 0ustar00U

e5d�D�
@s�ddlZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlmZddlmZddlmZddlmZddlmZddd	d
ddd
dddg
ZGdd	�d	e�ZGdd�de
�dd��ZGdd�dej�ZGdd�d�ZGdd�d�ZGdd�de�Z Gdd�d�Z!Gdd�d�Z"Gd d!�d!e �Z#Gd"d#�d#e�Z$d$d
�Z%d%d�Z&d&d�Z'd'd�Z(d(d�Z)d)d
�Z*d*d�Z+dS)+�N)�ConfigParser)�suppress)�
import_module)�MetaPathFinder)�starmap�Distribution�DistributionFinder�PackageNotFoundError�distribution�
distributions�entry_points�files�metadata�requires�versionc@seZdZdS)r	N)�__name__�
__module__�__qualname__�rr�*/usr/lib64/python3.8/importlib/metadata.pyr	%sc@sReZdZe�d�Zdd�Zedd��Ze	dd��Z
e	dd	��Zd
d�Zdd
�Z
dS)�
EntryPointzH(?P<module>[\w.]+)\s*(:\s*(?P<attr>[\w.]+)\s*)?((?P<extras>\[.*\])\s*)?$cCsD|j�|j�}t|�d��}td|�d�p,d�d��}t�t	||�S)N�module�attr��.)
�pattern�match�valuer�group�filter�split�	functools�reduce�getattr)�selfrrZattrsrrr�loadGszEntryPoint.loadcCs(|j�|j�}tt�d|�d�p"d��S)Nz\w+�extrasr)rrr�list�re�finditerr)r$rrrrr&QszEntryPoint.extrascs��fdd����D�S)Ncs,g|]$}��|�D]\}}�|||��qqSr��items)�.0r�namer��cls�configrr�
<listcomp>Xs�z+EntryPoint._from_config.<locals>.<listcomp>)�sectionsr.rr.r�_from_configVs�zEntryPoint._from_configcCsNtdd�}t|_z|�|�Wn$tk
rB|�t�|��YnXt�	|�S)N�=)Z
delimiters)
r�strZoptionxformZread_string�AttributeErrorZreadfp�io�StringIOrr3)r/�textr0rrr�
_from_text^s
zEntryPoint._from_textcCst|j|f�S�N)�iterr-�r$rrr�__iter__jszEntryPoint.__iter__cCs|j|j|j|jffSr;)�	__class__r-rrr=rrr�
__reduce__ps�zEntryPoint.__reduce__N)rrrr(�compilerr%�propertyr&�classmethodr3r:r>r@rrrrr)s	�



rZEntryPointBasezname value groupc@s&eZdZd	dd�Zdd�Zdd�ZdS)
�PackagePath�utf-8c
Cs0|��j|d��}|��W5QR�SQRXdS)N��encoding��locate�open�read)r$rG�streamrrr�	read_textzszPackagePath.read_textc
Cs.|���d��}|��W5QR�SQRXdS)N�rbrH)r$rLrrr�read_binary~szPackagePath.read_binarycCs|j�|�Sr;)�dist�locate_filer=rrrrI�szPackagePath.locateN)rE)rrrrMrOrIrrrrrDws
rDc@seZdZdd�Zdd�ZdS)�FileHashcCs|�d�\|_}|_dS)Nr4)�	partition�moder)r$�spec�_rrr�__init__�szFileHash.__init__cCsd�|j|j�S)Nz<FileHash mode: {} value: {}>)�formatrTrr=rrr�__repr__�szFileHash.__repr__N)rrrrWrYrrrrrR�srRc@s�eZdZejdd��Zejdd��Zedd��Zedd��Z	e
d	d
��Ze
dd��Ze
d
d��Ze
dd��Ze
dd��Ze
dd��Zdd�Zdd�Ze
dd��Zdd�Zdd�Zedd ��Ze
d!d"��Ze
d#d$��Zd%S)&rcCsdSr;r�r$�filenamerrrrM�szDistribution.read_textcCsdSr;r�r$�pathrrrrQ�szDistribution.locate_filecCsD|��D].}|tj|d��}t|d�}|dk	r|Sqt|��dS)N�r-)�_discover_resolversr�Context�nextr	)r/r-�resolverZdistsrPrrr�	from_name�s


zDistribution.from_namecsJ|�dd���r|rtd���p*tjf|��tj��fdd�|��D��S)N�contextz cannot accept context and kwargsc3s|]}|��VqdSr;r)r,rb�rdrr�	<genexpr>�s�z(Distribution.discover.<locals>.<genexpr>)�pop�
ValueErrorrr`�	itertools�chain�
from_iterabler_)r/�kwargsrrer�discover�s
�zDistribution.discovercCstt�|��Sr;)�PathDistribution�pathlib�Path)r]rrr�at�szDistribution.atcCsdd�tjD�}td|�S)Ncss|]}t|dd�VqdS)�find_distributionsN)r#)r,�finderrrrrf�s�z3Distribution._discover_resolvers.<locals>.<genexpr>)�sys�	meta_pathr)Zdeclaredrrrr_�s�z Distribution._discover_resolverscCs(|�d�p|�d�p|�d�}t�|�S)NZMETADATAzPKG-INFOr)rM�emailZmessage_from_string�r$r9rrrr�s
��zDistribution.metadatacCs
|jdS)NZVersion)rr=rrrr�szDistribution.versioncCst�|�d��S)Nzentry_points.txt)rr:rMr=rrrr�szDistribution.entry_pointscs6���p���}d�fdd�	}|o4tt|t�|���S)Ncs6t|�}|rt|�nd|_|r&t|�nd|_�|_|Sr;)rDrR�hash�int�sizerP)r-rxZsize_str�resultr=rr�	make_file�s
z%Distribution.files.<locals>.make_file)NN)�_read_files_distinfo�_read_files_egginfor'r�csv�reader)r$Z
file_linesr|rr=rr
�szDistribution.filescCs|�d�}|o|��S)NZRECORD)rM�
splitlinesrwrrrr}s
z!Distribution._read_files_distinfocCs|�d�}|otdj|���S)NzSOURCES.txtz"{}")rM�maprXr�rwrrrr~s
z Distribution._read_files_egginfocCs|��p|��}|ot|�Sr;)�_read_dist_info_reqs�_read_egg_info_reqsr')r$ZreqsrrrrszDistribution.requirescCs|j�d�S)Nz
Requires-Dist)rZget_allr=rrrr�sz!Distribution._read_dist_info_reqscCs|�d�}|o|�|�S)Nzrequires.txt)rM�_deps_from_requires_text)r$�sourcerrrr� s
z Distribution._read_egg_info_reqscCs4|�|���}dd�t�|t�d��D�}|�|�S)NcSs&i|]\}}|ttt�d�|���qS)�line)r'r��operator�
itemgetter)r,�sectionZresultsrrr�
<dictcomp>'s�z9Distribution._deps_from_requires_text.<locals>.<dictcomp>r�)�_read_sectionsr�ri�groupbyr�r��%_convert_egg_info_reqs_to_simple_reqs)r/r�Z
section_pairsr2rrrr�$s
�z%Distribution._deps_from_requires_textccs<d}td|�D](}t�d|�}|r.|�d�}qt�VqdS)Nz	\[(.*)\]$�)rr(rr�locals)�linesr�r�Z
section_matchrrrr�.s
zDistribution._read_sectionsc#sBdd���fdd�}|��D] \}}|D]}|||�Vq(qdS)NcSs|odj|d�S)Nzextra == "{name}"r^)rXr^rrr�make_conditionCszJDistribution._convert_egg_info_reqs_to_simple_reqs.<locals>.make_conditioncsX|pd}|�d�\}}}|r,|r,dj|d�}ttd|�|�g��}|rTdd�|�SdS)Nr�:z({markers}))�markersz; z and )rSrXr'r�join)r�Zextra�sepr�Z
conditions�r�rr�parse_conditionFszKDistribution._convert_egg_info_reqs_to_simple_reqs.<locals>.parse_conditionr*)r2r�r�ZdepsZdeprr�rr�8s
z2Distribution._convert_egg_info_reqs_to_simple_reqsN)rrr�abc�abstractmethodrMrQrCrcrm�staticmethodrqr_rBrrrr
r}r~rr�r�r�r�r�rrrrr�s@











	
	c@s.eZdZGdd�d�Zeje�fdd��ZdS)rc@s$eZdZdZdd�Zedd��ZdS)zDistributionFinder.ContextNcKst|��|�dSr;)�vars�update)r$rlrrrrWjsz#DistributionFinder.Context.__init__cCst|��dtj�S)Nr])r��getrtr]r=rrrr]mszDistributionFinder.Context.path)rrrr-rWrBr]rrrrr`Xsr`cCsdSr;r)r$rdrrrrrwsz%DistributionFinder.find_distributionsN)rrrr`r�r�rrrrrrrSsc@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�FastPathcCs||_tj�|���|_dSr;)�root�osr]�basename�lower�base)r$r�rrrrW�szFastPath.__init__cCst�|j|�Sr;)rorpr�)r$�childrrr�joinpath�szFastPath.joinpathc
CsTtt��t�|jpd�W5QR�SQRXtt��|��W5QR�SQRXgS)Nr)r�	Exceptionr��listdirr��zip_childrenr=rrr�children�s

"
zFastPath.childrencCs2t�|j�}|j��}|j|_t�dd�|D��S)Ncss |]}|�tjd�dVqdS)r�rN)r �	posixpathr�)r,r�rrrrf�s�z(FastPath.zip_children.<locals>.<genexpr>)�zipfilerpr�Znamelistr��dict�fromkeys)r$Zzip_path�namesrrrr��s

�zFastPath.zip_childrencCs&|j}||jkp$|�|j�o$|�d�S)N�.egg)r��versionless_egg_name�
startswith�prefix�endswith)r$�searchr�rrr�is_egg�s

�zFastPath.is_eggccsZ|��D]L}|��}||jksH|�|j�r6|�|j�sH|�|�r|dkr|�|�VqdS)Nzegg-info)	r�r��
exact_matchesr�r�r��suffixesr�r�)r$r-r�Zn_lowrrrr��s

�
���zFastPath.searchN)	rrrrWr�r�r�r�r�rrrrr��s
r�c@s2eZdZdZdZdZdgdd�ZdZdd�ZdS)�Preparedr)z
.dist-infoz	.egg-infoNrcsV|�_|dkrdS|���dd��_�jd�_�fdd��jD��_�jd�_dS)N�-rVcsg|]}�j|�qSr)�
normalized)r,�suffixr=rrr1�sz%Prepared.__init__.<locals>.<listcomp>r�)r-r��replacer�r�r�r�r�)r$r-rr=rrW�s
�zPrepared.__init__)	rrrr�r�r�r�r�rWrrrrr��sr�c@s,eZdZee��fdd��Zedd��ZdS)�MetadataPathFindercCs|�|j|j�}tt|�Sr;)�
_search_pathsr-r]r�rn)r/rd�foundrrrrr�s
z%MetadataPathFinder.find_distributionscs tj��fdd�tt|�D��S)Nc3s|]}|�t���VqdSr;)r�r�)r,r]r^rrrf�s�z3MetadataPathFinder._search_paths.<locals>.<genexpr>)rirjrkr�r�)r/r-�pathsrr^rr��s�z MetadataPathFinder._search_pathsN)rrrrCrr`rrr�rrrrr��sr�c@s.eZdZdd�Zdd�Zejje_dd�ZdS)rncCs
||_dSr;)�_pathr\rrrrW�szPathDistribution.__init__c
Cs<tttttt��"|j�|�jdd�W5QR�SQRXdS)NrErF)	r�FileNotFoundError�IsADirectoryError�KeyError�NotADirectoryError�PermissionErrorr�r�rMrZrrrrM�s
�zPathDistribution.read_textcCs|jj|Sr;)r��parentr\rrrrQ�szPathDistribution.locate_fileN)rrrrWrMr�__doc__rQrrrrrn�s
rncCs
t�|�Sr;)rrc�Zdistribution_namerrrr
�scKstjf|�Sr;)rrm)rlrrrr�scCst�|�jSr;)rrcrr�rrrrscCs
t|�jSr;)r
rr�rrrrscCsHtj�dd�t�D��}t�d�}t||d�}t�||�}dd�|D�S)Ncss|]}|jVqdSr;)r)r,rPrrrrfszentry_points.<locals>.<genexpr>r)�keycSsi|]\}}|t|��qSr)�tuple)r,r�epsrrrr�s�z entry_points.<locals>.<dictcomp>)rirjrkrr��
attrgetter�sortedr�)r�Zby_groupZorderedZgroupedrrrrs�
�cCs
t|�jSr;)r
r
r�rrrr
%scCs
t|�jSr;)r
rr�rrrr.s),r7r�r(r�rrtrvror�r�r!rir��collectionsZconfigparserr�
contextlibr�	importlibr�
importlib.abcrr�__all__�ModuleNotFoundErrorr	�
namedtuplerZ
PurePosixPathrDrRrrr�r�r�rnr
rrrrr
rrrrr�<module>sb�

�NE/0		
	__pycache__/abc.cpython-38.opt-2.pyc000064400000015154150327175520013106 0ustar00U

e5dI2�
@s�ddlmZddlmZddlmZzddlZWn2ek
rbZzejdkrN�dZW5dZ[XYnXzddlZWn&ek
r�ZzeZW5dZ[XYnXddl	Z	ddl
Z
dd�ZGd	d
�d
e	jd�Z
Gdd
�d
e
�Zeeejejejej�Gdd�de
�Zeeej�Gdd�de	jd�ZGdd�de�ZGdd�de�Zeeejej�Gdd�de�Zeeej�Gdd�dejee�Zeeejej�Gdd�dejee�Zeeej�Gdd�de	jd�Zeeej�dS)�)�
_bootstrap)�_bootstrap_external)�	machinery�N�_frozen_importlibc	Gs\|D]R}|�|�tdk	rztt|j�}Wn tk
rJtt|j�}YnX|�|�qdS�N)�registerr�getattr�__name__�AttributeError�_frozen_importlib_external)�abstract_cls�classes�cls�
frozen_cls�r�%/usr/lib64/python3.8/importlib/abc.py�	_registers
rc@seZdZejddd��ZdS)�FinderNcCsdSrr)�self�fullname�pathrrr�find_module*szFinder.find_module)N)r
�
__module__�__qualname__�abc�abstractmethodrrrrrrsr)�	metaclassc@seZdZdd�Zdd�ZdS)�MetaPathFindercCs<tjdtdd�t|d�sdS|�||�}|dk	r8|jSdS)NzxMetaPathFinder.find_module() is deprecated since Python 3.4 in favor of MetaPathFinder.find_spec() (available since 3.4)���
stacklevel�	find_spec)�warnings�warn�DeprecationWarning�hasattrr"�loader)rrr�foundrrrr9s�
zMetaPathFinder.find_modulecCsdSrr�rrrr�invalidate_cachesNsz MetaPathFinder.invalidate_cachesN)r
rrrr*rrrrr2src@s"eZdZdd�ZejZdd�ZdS)�PathEntryFindercCs\tjdtdd�t|d�s"dgfS|�|�}|dk	rP|js@g}n|j}|j|fSdgfSdS)NzzPathEntryFinder.find_loader() is deprecated since Python 3.4 in favor of PathEntryFinder.find_spec() (available since 3.4)rr r")r#r$r%r&r"�submodule_search_locationsr')rrr(�portionsrrr�find_loader^s�


zPathEntryFinder.find_loadercCsdSrrr)rrrr*�sz!PathEntryFinder.invalidate_cachesN)r
rrr.r�_find_module_shimrr*rrrrr+Ws r+c@s$eZdZdd�Zdd�Zdd�ZdS)�LoadercCsdSrr)r�specrrr�
create_module�szLoader.create_modulecCst|d�st�t�||�S)N�exec_module)r&�ImportErrorr�_load_module_shim�rrrrr�load_module�s
zLoader.load_modulecCst�dSr)�NotImplementedError)r�modulerrr�module_repr�s
zLoader.module_reprN)r
rrr2r7r:rrrrr0�s
r0c@seZdZejdd��ZdS)�ResourceLoadercCst�dSr)�OSError�rrrrr�get_data�szResourceLoader.get_dataN)r
rrrrr>rrrrr;�s	r;c@sHeZdZdd�Zdd�Zejdd��Zeddd	��Z	e
jjZe
jj
Z
d
S)�
InspectLoadercCst�dSr�r4r6rrr�
is_package�szInspectLoader.is_packagecCs |�|�}|dkrdS|�|�Sr)�
get_source�source_to_code)rr�sourcerrr�get_code�s
zInspectLoader.get_codecCst�dSrr@r6rrrrB�szInspectLoader.get_source�<string>cCst||ddd�S)N�execT)�dont_inherit)�compile)�datarrrrrC�szInspectLoader.source_to_codeN)rF)r
rrrArErrrB�staticmethodrCr�
_LoaderBasicsr3r7rrrrr?�s	

r?c@s"eZdZejdd��Zdd�ZdS)�ExecutionLoadercCst�dSrr@r6rrr�get_filenameszExecutionLoader.get_filenamecCsT|�|�}|dkrdSz|�|�}Wntk
rB|�|�YSX|�||�SdSr)rBrNr4rC)rrrDrrrrrEs
zExecutionLoader.get_codeN)r
rrrrrNrErrrrrM�s	
rMc@seZdZdS)�
FileLoaderN)r
rrrrrrrO!srOc@s$eZdZdd�Zdd�Zdd�ZdS)�SourceLoadercCs$|jjtjkrt�t|�|�d�S�N�mtime)�
path_stats�__func__rPr<�intr=rrr�
path_mtime;szSourceLoader.path_mtimecCs |jjtjkrt�d|�|�iSrQ)rVrTrPr<r=rrrrSAszSourceLoader.path_statscCsdSrr)rrrJrrr�set_dataLszSourceLoader.set_dataN)r
rrrVrSrWrrrrrP*srPc@sDeZdZejdd��Zejdd��Zejdd��Zejdd��Zd	S)
�ResourceReadercCst�dSr��FileNotFoundError�r�resourcerrr�
open_resourcebs	zResourceReader.open_resourcecCst�dSrrYr[rrr�
resource_pathms
zResourceReader.resource_pathcCst�dSrrY)r�namerrr�is_resourceyszResourceReader.is_resourcecCsgSrrr)rrr�contents~szResourceReader.contentsN)	r
rrrrr]r^r`rarrrrrXYs	



rX)�rrrrr4�excr_rrr#r�ABCMetarr�BuiltinImporter�FrozenImporter�
PathFinder�WindowsRegistryFinderr+�
FileFinderr0r;r?rM�ExtensionFileLoaderrO�SourceFileLoader�SourcelessFileLoaderrPrXrrrr�<module>sJ
!�./2"�,+__pycache__/_bootstrap.cpython-38.opt-1.pyc000064400000067637150327175520014551 0ustar00U

e5dܚ�@s�dZdadd�Zdd�ZiZiZGdd�de�ZGdd	�d	�ZGd
d�d�Z	Gdd
�d
�Z
dd�Zdd�Zdd�Z
dd�dd�Zdd�Zdd�Zdd�Zdd�ZGd d!�d!�Zddd"�d#d$�Zd^d%d&�Zd'd(�d)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�ZGd7d8�d8�ZGd9d:�d:�ZGd;d<�d<�Zd=d>�Z d?d@�Z!d_dAdB�Z"dCdD�Z#dEZ$e$dFZ%dGdH�Z&e'�Z(dIdJ�Z)d`dLdM�Z*d'dN�dOdP�Z+dQdR�Z,dadTdU�Z-dVdW�Z.dXdY�Z/dZd[�Z0d\d]�Z1dS)baSCore implementation of import.

This module is NOT meant to be directly imported! It has been designed such
that it can be bootstrapped into Python as the implementation of import. As
such it requires the injection of specific modules and attributes in order to
work. One should use importlib as the public-facing version of this module.

NcCs8dD] }t||�rt||t||��q|j�|j�dS)z/Simple substitute for functools.update_wrapper.)�
__module__�__name__�__qualname__�__doc__N)�hasattr�setattr�getattr�__dict__�update)�new�old�replace�r
�,/usr/lib64/python3.8/importlib/_bootstrap.py�_wraps
rcCstt�|�S�N)�type�sys��namer
r
r�_new_module#src@seZdZdS)�_DeadlockErrorN)rrrr
r
r
rr0src@s8eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
�_ModuleLockz�A recursive lock implementation which is able to detect deadlocks
    (e.g. thread 1 trying to take locks A then B, and thread 2 trying to
    take locks B then A).
    cCs0t��|_t��|_||_d|_d|_d|_dS�N�)�_thread�
allocate_lock�lock�wakeupr�owner�count�waiters��selfrr
r
r�__init__:s

z_ModuleLock.__init__cCs<t��}|j}t�|�}|dkr$dS|j}||krdSqdS)NFT)r�	get_identr�_blocking_on�get)r"�me�tidrr
r
r�has_deadlockBs
z_ModuleLock.has_deadlockc	Cs�t��}|t|<z�|j�n|jdks.|j|krT||_|jd7_W5QR�W�VdS|��rhtd|��|j�	d�r�|j
d7_
W5QRX|j�	�|j��qW5t|=XdS)z�
        Acquire the module lock.  If a potential deadlock is detected,
        a _DeadlockError is raised.
        Otherwise, the lock is always acquired and True is returned.
        r�Tzdeadlock detected by %rFN)rr$r%rrrr)rr�acquirer �release�r"r(r
r
rr+Ns
z_ModuleLock.acquirec	Cslt��}|j�T|j|kr"td��|jd8_|jdkr^d|_|jr^|jd8_|j��W5QRXdS)N�cannot release un-acquired lockr*r)	rr$rr�RuntimeErrorrr rr,r-r
r
rr,gs

z_ModuleLock.releasecCsd�|jt|��S)Nz_ModuleLock({!r}) at {}��formatr�id�r"r
r
r�__repr__tsz_ModuleLock.__repr__N)	rrrrr#r)r+r,r4r
r
r
rr4s
rc@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�_DummyModuleLockzVA simple _ModuleLock equivalent for Python builds without
    multi-threading support.cCs||_d|_dSr)rrr!r
r
rr#|sz_DummyModuleLock.__init__cCs|jd7_dS)Nr*T)rr3r
r
rr+�sz_DummyModuleLock.acquirecCs$|jdkrtd��|jd8_dS)Nrr.r*)rr/r3r
r
rr,�s
z_DummyModuleLock.releasecCsd�|jt|��S)Nz_DummyModuleLock({!r}) at {}r0r3r
r
rr4�sz_DummyModuleLock.__repr__N)rrrrr#r+r,r4r
r
r
rr5xs
r5c@s$eZdZdd�Zdd�Zdd�ZdS)�_ModuleLockManagercCs||_d|_dSr)�_name�_lockr!r
r
rr#�sz_ModuleLockManager.__init__cCst|j�|_|j��dSr)�_get_module_lockr7r8r+r3r
r
r�	__enter__�sz_ModuleLockManager.__enter__cOs|j��dSr)r8r,)r"�args�kwargsr
r
r�__exit__�sz_ModuleLockManager.__exit__N)rrrr#r:r=r
r
r
rr6�sr6cCs�t��zjzt|�}Wntk
r0d}YnX|dkrptdkrLt|�}nt|�}|fdd�}t�	||�t|<W5t��X|S)z�Get or create the module lock for a given module name.

    Acquire/release internally the global import lock to protect
    _module_locks.NcSs0t��zt�|�|krt|=W5t��XdSr)�_imp�acquire_lock�release_lock�
_module_locksr&)�refrr
r
r�cb�s

z_get_module_lock.<locals>.cb)
r>r?r@rA�KeyErrorrr5r�_weakrefrB)rrrCr
r
rr9�s


r9cCs6t|�}z|��Wntk
r(Yn
X|��dS)z�Acquires then releases the module lock for a given module name.

    This is used to ensure a module is completely initialized, in the
    event it is being imported by another thread.
    N)r9r+rr,)rrr
r
r�_lock_unlock_module�srFcOs
|||�S)a.remove_importlib_frames in import.c will always remove sequences
    of importlib frames that end with a call to this function

    Use it instead of a normal call in places where including the importlib
    frames introduces unwanted noise into the traceback (e.g. when executing
    module code)
    r
)�fr;�kwdsr
r
r�_call_with_frames_removed�srIr*)�	verbositycGs6tjj|kr2|�d�sd|}t|j|�tjd�dS)z=Print the message to stderr if -v/PYTHONVERBOSE is turned on.)�#zimport z# )�fileN)r�flags�verbose�
startswith�printr1�stderr)�messagerJr;r
r
r�_verbose_message�s
rScs�fdd�}t|��|S)z1Decorator to verify the named module is built-in.cs&|tjkrtd�|�|d���||�S)N�{!r} is not a built-in moduler)r�builtin_module_names�ImportErrorr1�r"�fullname��fxnr
r�_requires_builtin_wrapper�s


�z4_requires_builtin.<locals>._requires_builtin_wrapper�r)rZr[r
rYr�_requires_builtin�s
r]cs�fdd�}t|��|S)z/Decorator to verify the named module is frozen.cs&t�|�std�|�|d���||�S�Nz{!r} is not a frozen moduler)r>�	is_frozenrVr1rWrYr
r�_requires_frozen_wrapper�s


�z2_requires_frozen.<locals>._requires_frozen_wrapperr\)rZr`r
rYr�_requires_frozen�s
racCs>t||�}|tjkr2tj|}t||�tj|St|�SdS)z�Load the specified module into sys.modules and return it.

    This method is deprecated.  Use loader.exec_module instead.

    N)�spec_from_loaderr�modules�_exec�_load)r"rX�spec�moduler
r
r�_load_module_shim�s




rhcCs�t|dd�}t|d�r8z|�|�WStk
r6YnXz
|j}Wntk
rVYnX|dk	rht|�Sz
|j}Wntk
r�d}YnXz
|j}Wn:tk
r�|dkr�d�	|�YSd�	||�YSYnXd�	||�SdS)N�
__loader__�module_repr�?�
<module {!r}>�<module {!r} ({!r})>�<module {!r} from {!r}>)
rrrj�	Exception�__spec__�AttributeError�_module_repr_from_specr�__file__r1)rg�loaderrfr�filenamer
r
r�_module_repr
s.




rvc@sreZdZdZdddd�dd�Zdd�Zdd	�Zed
d��Zej	dd��Zed
d��Z
edd��Zej	dd��ZdS)�
ModuleSpeca�The specification for a module, used for loading.

    A module's spec is the source for information about the module.  For
    data associated with the module, including source, use the spec's
    loader.

    `name` is the absolute name of the module.  `loader` is the loader
    to use when loading the module.  `parent` is the name of the
    package the module is in.  The parent is derived from the name.

    `is_package` determines if the module is considered a package or
    not.  On modules this is reflected by the `__path__` attribute.

    `origin` is the specific location used by the loader from which to
    load the module, if that information is available.  When filename is
    set, origin will match.

    `has_location` indicates that a spec's "origin" reflects a location.
    When this is True, `__file__` attribute of the module is set.

    `cached` is the location of the cached bytecode file, if any.  It
    corresponds to the `__cached__` attribute.

    `submodule_search_locations` is the sequence of path entries to
    search when importing submodules.  If set, is_package should be
    True--and False otherwise.

    Packages are simply modules that (may) have submodules.  If a spec
    has a non-None value in `submodule_search_locations`, the import
    system will consider modules loaded from the spec as packages.

    Only finders (see importlib.abc.MetaPathFinder and
    importlib.abc.PathEntryFinder) should modify ModuleSpec instances.

    N)�origin�loader_state�
is_packagecCs6||_||_||_||_|r gnd|_d|_d|_dS�NF)rrtrxry�submodule_search_locations�
_set_fileattr�_cached)r"rrtrxryrzr
r
rr#VszModuleSpec.__init__cCsfd�|j�d�|j�g}|jdk	r4|�d�|j��|jdk	rP|�d�|j��d�|jjd�|��S)Nz	name={!r}zloader={!r}zorigin={!r}zsubmodule_search_locations={}z{}({})z, )	r1rrtrx�appendr|�	__class__r�join)r"r;r
r
rr4bs

�

�zModuleSpec.__repr__cCsj|j}zH|j|jkoL|j|jkoL|j|jkoL||jkoL|j|jkoL|j|jkWStk
rdYdSXdSr{)r|rrtrx�cached�has_locationrq)r"�other�smslr
r
r�__eq__ls
�
��
�
�zModuleSpec.__eq__cCs:|jdkr4|jdk	r4|jr4tdkr&t�t�|j�|_|jSr)r~rxr}�_bootstrap_external�NotImplementedError�_get_cachedr3r
r
rr�xs
zModuleSpec.cachedcCs
||_dSr)r~)r"r�r
r
rr��scCs$|jdkr|j�d�dS|jSdS)z The name of the module's parent.N�.r)r|r�
rpartitionr3r
r
r�parent�s
zModuleSpec.parentcCs|jSr)r}r3r
r
rr��szModuleSpec.has_locationcCst|�|_dSr)�boolr})r"�valuer
r
rr��s)rrrrr#r4r��propertyr��setterr�r�r
r
r
rrw1s $�




rw�rxrzcCs�t|d�rJtdkrt�tj}|dkr0|||d�S|r8gnd}||||d�S|dkr�t|d�r�z|�|�}Wq�tk
r�d}Yq�Xnd}t||||d�S)z5Return a module spec based on various loader methods.�get_filenameN)rt)rtr|rzFr�)rr�r��spec_from_file_locationrzrVrw)rrtrxrzr��searchr
r
rrb�s$
�
rbcCs8z
|j}Wntk
rYnX|dk	r,|S|j}|dkrZz
|j}Wntk
rXYnXz
|j}Wntk
r|d}YnX|dkr�|dkr�z
|j}Wq�tk
r�d}Yq�Xn|}z
|j}Wntk
r�d}YnXzt|j�}Wntk
�rd}YnXt	|||d�}|dk�r"dnd|_
||_||_|S)N�rxFT)
rprqrrirs�_ORIGIN�
__cached__�list�__path__rwr}r�r|)rgrtrxrfr�locationr�r|r
r
r�_spec_from_module�sH







r�F��overridecCs�|st|dd�dkr6z|j|_Wntk
r4YnX|sJt|dd�dkr�|j}|dkr�|jdk	r�tdkrnt�tj}|�	|�}|j|_
||_d|_z
||_Wntk
r�YnX|s�t|dd�dkr�z|j
|_Wntk
r�YnXz
||_Wntk
�rYnX|�s"t|dd�dk�rR|jdk	�rRz|j|_Wntk
�rPYnX|j�r�|�srt|dd�dk�r�z|j|_Wntk
�r�YnX|�s�t|dd�dk�r�|jdk	�r�z|j|_Wntk
�r�YnX|S)Nrri�__package__r�rsr�)rrrrqrtr|r�r��_NamespaceLoader�__new__�_pathrsrir�r�rpr�r�rxr�r�)rfrgr�rtr�r
r
r�_init_module_attrs�s`



r�cCsRd}t|jd�r|j�|�}nt|jd�r2td��|dkrDt|j�}t||�|S)z+Create a module based on the provided spec.N�
create_module�exec_modulezBloaders that define exec_module() must also define create_module())rrtr�rVrrr��rfrgr
r
r�module_from_spec%s

r�cCsj|jdkrdn|j}|jdkrB|jdkr2d�|�Sd�||j�Sn$|jrVd�||j�Sd�|j|j�SdS)z&Return the repr to use for the module.Nrkrlrmrn�<module {!r} ({})>)rrxrtr1r�)rfrr
r
rrr6s


rrc
Cs�|j}t|���tj�|�|k	r6d�|�}t||d��zj|jdkrj|j	dkrZtd|jd��t
||dd�n4t
||dd�t|jd�s�|j�|�n|j�
|�W5tj�|j�}|tj|j<XW5QRX|S)zFExecute the spec's specified module in an existing module's namespace.zmodule {!r} not in sys.modulesrN�missing loaderTr�r�)rr6rrcr&r1rV�poprtr|r�r�load_moduler�)rfrgr�msgr
r
rrdGs"



rdcCsz|j�|j�Wn4|jtjkr@tj�|j�}|tj|j<�YnXtj�|j�}|tj|j<t|dd�dkr�z|j|_Wntk
r�YnXt|dd�dkr�z(|j	|_
t|d�s�|j�d�d|_
Wntk
r�YnXt|dd�dk�rz
||_
Wntk
�rYnX|S)Nrir�r�r�rrp)rtr�rrrcr�rrirqrr�rr�rpr�r
r
r�_load_backward_compatiblees6

r�cCs�|jdk	rt|jd�st|�St|�}d|_z�|tj|j<z4|jdkr`|jdkrlt	d|jd��n|j�
|�Wn2ztj|j=Wntk
r�YnX�YnXtj�|j�}|tj|j<t
d|j|j�W5d|_X|S)Nr�TFr�rzimport {!r} # {!r})rtrr�r��
_initializingrrcrr|rVr�rDr�rSr�r
r
r�_load_unlocked�s.


r�c
Cs*t|j��t|�W5QR�SQRXdS)z�Return a new module object, loaded by the spec's loader.

    The module is not added to its parent.

    If a module is already in sys.modules, that existing module gets
    clobbered.

    N)r6rr�)rfr
r
rre�s	rec@s�eZdZdZedd��Zeddd��Zeddd��Zed	d
��Z	edd��Z
eed
d���Zeedd���Z
eedd���Zee�ZdS)�BuiltinImporterz�Meta path import for built-in modules.

    All methods are either class or static methods to avoid the need to
    instantiate the class.

    cCsd�|j�S)�sReturn repr for the module.

        The method is deprecated.  The import machinery does the job itself.

        z<module {!r} (built-in)>)r1r)rgr
r
rrj�szBuiltinImporter.module_reprNcCs,|dk	rdSt�|�r$t||dd�SdSdS)Nzbuilt-inr�)r>�
is_builtinrb��clsrX�path�targetr
r
r�	find_spec�s

zBuiltinImporter.find_speccCs|�||�}|dk	r|jSdS)z�Find the built-in module.

        If 'path' is ever specified then the search is considered a failure.

        This method is deprecated.  Use find_spec() instead.

        N)r�rt)r�rXr�rfr
r
r�find_module�s	zBuiltinImporter.find_modulecCs.|jtjkr"td�|j�|jd��ttj|�S)zCreate a built-in modulerTr)rrrUrVr1rIr>�create_builtin)r"rfr
r
rr��s
�zBuiltinImporter.create_modulecCsttj|�dS)zExec a built-in moduleN)rIr>�exec_builtin)r"rgr
r
rr��szBuiltinImporter.exec_modulecCsdS)z9Return None as built-in modules do not have code objects.Nr
�r�rXr
r
r�get_code�szBuiltinImporter.get_codecCsdS)z8Return None as built-in modules do not have source code.Nr
r�r
r
r�
get_source�szBuiltinImporter.get_sourcecCsdS)z4Return False as built-in modules are never packages.Fr
r�r
r
rrzszBuiltinImporter.is_package)NN)N)rrrr�staticmethodrj�classmethodr�r�r�r�r]r�r�rzrhr�r
r
r
rr��s*


r�c@s�eZdZdZdZedd��Zeddd��Zeddd	��Z	ed
d��Z
edd
��Zedd��Zee
dd���Zee
dd���Zee
dd���ZdS)�FrozenImporterz�Meta path import for frozen modules.

    All methods are either class or static methods to avoid the need to
    instantiate the class.

    �frozencCsd�|jtj�S)r�r�)r1rr�r�)�mr
r
rrjszFrozenImporter.module_reprNcCs"t�|�rt|||jd�SdSdS)Nr�)r>r_rbr�r�r
r
rr� s
zFrozenImporter.find_speccCst�|�r|SdS)z]Find a frozen module.

        This method is deprecated.  Use find_spec() instead.

        N)r>r_)r�rXr�r
r
rr�'szFrozenImporter.find_modulecCsdS)z*Use default semantics for module creation.Nr
)r�rfr
r
rr�0szFrozenImporter.create_modulecCs@|jj}t�|�s$td�|�|d��ttj|�}t||j	�dSr^)
rprr>r_rVr1rI�get_frozen_object�execr)rgr�coder
r
rr�4s

�zFrozenImporter.exec_modulecCs
t||�S)z_Load a frozen module.

        This method is deprecated.  Use exec_module() instead.

        )rhr�r
r
rr�=szFrozenImporter.load_modulecCs
t�|�S)z-Return the code object for the frozen module.)r>r�r�r
r
rr�FszFrozenImporter.get_codecCsdS)z6Return None as frozen modules do not have source code.Nr
r�r
r
rr�LszFrozenImporter.get_sourcecCs
t�|�S)z.Return True if the frozen module is a package.)r>�is_frozen_packager�r
r
rrzRszFrozenImporter.is_package)NN)N)rrrrr�r�rjr�r�r�r�r�r�rar�r�rzr
r
r
rr�s.



r�c@s eZdZdZdd�Zdd�ZdS)�_ImportLockContextz$Context manager for the import lock.cCst��dS)zAcquire the import lock.N)r>r?r3r
r
rr:_sz_ImportLockContext.__enter__cCst��dS)z<Release the import lock regardless of any raised exceptions.N)r>r@)r"�exc_type�	exc_value�
exc_tracebackr
r
rr=csz_ImportLockContext.__exit__N)rrrrr:r=r
r
r
rr�[sr�cCs@|�d|d�}t|�|kr$td��|d}|r<d�||�S|S)z2Resolve a relative module name to an absolute one.r�r*z2attempted relative import beyond top-level packager�{}.{})�rsplit�len�
ValueErrorr1)r�package�level�bits�baser
r
r�
_resolve_namehs
r�cCs"|�||�}|dkrdSt||�Sr)r�rb)�finderrr�rtr
r
r�_find_spec_legacyqsr�c

Cstj}|dkrtd��|s&t�dt�|tjk}|D]�}t��Tz
|j}Wn6t	k
r�t
|||�}|dkr|YW5QR�q4YnX||||�}W5QRX|dk	r4|�s�|tjk�r�tj|}z
|j}	Wnt	k
r�|YSX|	dkr�|S|	Sq4|Sq4dS)zFind a module's spec.Nz5sys.meta_path is None, Python is likely shutting downzsys.meta_path is empty)r�	meta_pathrV�	_warnings�warn�
ImportWarningrcr�r�rqr�rp)
rr�r�r��	is_reloadr�r�rfrgrpr
r
r�
_find_speczs6





r�cCslt|t�std�t|����|dkr,td��|dkrTt|t�sHtd��n|sTtd��|sh|dkrhtd��dS)zVerify arguments are "sane".zmodule name must be str, not {}rzlevel must be >= 0z__package__ not set to a stringz6attempted relative import with no known parent packagezEmpty module nameN)�
isinstance�str�	TypeErrorr1rr�rV�rr�r�r
r
r�
_sanity_check�s


r�zNo module named z{!r}cCs�d}|�d�d}|r�|tjkr*t||�|tjkr>tj|Stj|}z
|j}Wn2tk
r�td�||�}t||d�d�YnXt	||�}|dkr�tt�|�|d��nt
|�}|r�tj|}t||�d�d|�|S)Nr�rz; {!r} is not a packager�)r�rrcrIr�rq�_ERR_MSGr1�ModuleNotFoundErrorr�r�r)r�import_r�r��
parent_moduler�rfrgr
r
r�_find_and_load_unlocked�s*







r�c
Csjt|��2tj�|t�}|tkr6t||�W5QR�SW5QRX|dkr^d�|�}t||d��t|�|S)zFind and load the module.Nz(import of {} halted; None in sys.modulesr)	r6rrcr&�_NEEDS_LOADINGr�r1r�rF)rr�rgrRr
r
r�_find_and_load�s
 �r�rcCs*t|||�|dkr t|||�}t|t�S)a2Import and return the module based on its name, the package the call is
    being made from, and the level adjustment.

    This function represents the greatest common denominator of functionality
    between import_module and __import__. This includes setting __package__ if
    the loader did not.

    r)r�r�r��_gcd_importr�r
r
rr��s	r���	recursivecCs�|D]�}t|t�sB|r"|jd}nd}td|�dt|�j����q|dkrl|s�t|d�r�t||j|dd�qt||�sd	�|j|�}zt	||�Wqt
k
r�}z*|j|kr�tj
�|t�d
k	r�WY�q�W5d
}~XYqXq|S)z�Figure out what __import__ should return.

    The import_ parameter is a callable which takes the name of module to
    import. It is required to decouple the function from assuming importlib's
    import implementation is desired.

    z.__all__z
``from list''zItem in z must be str, not �*�__all__Tr�r�N)r�r�rr�rr�_handle_fromlistr�r1rIr�rrrcr&r�)rg�fromlistr�r��x�where�	from_name�excr
r
rr��s,


�

�r�cCs�|�d�}|�d�}|dk	rR|dk	rN||jkrNtjd|�d|j�d�tdd�|S|dk	r`|jStjd	tdd�|d
}d|kr�|�d�d
}|S)z�Calculate what __package__ should be.

    __package__ is not guaranteed to be defined or could be set to None
    to represent that its proper value is unknown.

    r�rpNz __package__ != __spec__.parent (z != �)�)�
stacklevelzYcan't resolve package from __spec__ or __package__, falling back on __name__ and __path__rr�r�r)r&r�r�r�r�r�)�globalsr�rfr
r
r�_calc___package__s&

��r�r
c	Cs�|dkrt|�}n$|dk	r|ni}t|�}t|||�}|s�|dkrTt|�d�d�S|s\|St|�t|�d�d�}tj|jdt|j�|�Snt|d�r�t||t�S|SdS)a�Import a module.

    The 'globals' argument is used to infer where the import is occurring from
    to handle relative imports. The 'locals' argument is ignored. The
    'fromlist' argument specifies what should exist as attributes on the module
    being imported (e.g. ``from module import <fromlist>``).  The 'level'
    argument represents the package location to import from in a relative
    import (e.g. ``from ..pkg import mod`` would have a 'level' of 2).

    rNr�r�)	r�r��	partitionr�rrcrrr�)	rr��localsr�r�rg�globals_r��cut_offr
r
r�
__import__9s
 
r�cCs&t�|�}|dkrtd|��t|�S)Nzno built-in module named )r�r�rVr�)rrfr
r
r�_builtin_from_name^s
r�c
Cs�|a|att�}tj��D]H\}}t||�r|tjkr<t}nt�|�rt	}nqt
||�}t||�qtjt}dD].}|tjkr�t
|�}	n
tj|}	t|||	�qrdS)z�Setup importlib by importing needed built-in modules and injecting them
    into the global namespace.

    As sys is needed for sys.modules access and _imp is needed to load built-in
    modules, those two modules must be explicitly passed in.

    )rr�rEN)r>rrrc�itemsr�rUr�r_r�r�r�rr�r)
�
sys_module�_imp_module�module_typerrgrtrf�self_module�builtin_name�builtin_moduler
r
r�_setupes$	







rcCs&t||�tj�t�tj�t�dS)z0Install importers for builtin and frozen modulesN)rrr�rr�r�)r�rr
r
r�_install�s
rcCs ddl}|a|�tjt�dS)z9Install importers that require external filesystem accessrN)�_frozen_importlib_externalr�rrrcr)rr
r
r�_install_external_importers�sr)NN)N)Nr)NNr
r)2rr�rrrAr%r/rrr5r6r9rFrIrSr]rarhrvrwrbr�r�r�rrrdr�r�rer�r�r�r�r�r�r��_ERR_MSG_PREFIXr�r��objectr�r�r�r�r�r�r�rrrr
r
r
r�<module>s^D%$e
-H%*IO
		
/
%
%#__pycache__/util.cpython-38.opt-1.pyc000064400000022116150327175520013331 0ustar00U

e5d7,�@s,dZddlmZddlmZddlmZddlmZddlmZddlm	Z	ddlm
Z
dd	lmZdd
lmZddlm
Z
ddlmZd
dlmZd
dlZd
dlZd
dlZd
dlZd
dlZdd�Zdd�Zd$dd�Zd%dd�Zedd��Zdd�Zdd�Zdd�ZGd d!�d!ej�ZGd"d#�d#ej �Z!dS)&z-Utility code for constructing importers, etc.�)�abc)�module_from_spec)�
_resolve_name)�spec_from_loader)�
_find_spec)�MAGIC_NUMBER)�_RAW_MAGIC_NUMBER)�cache_from_source)�
decode_source)�source_from_cache)�spec_from_file_location�)�contextmanagerNcCst�t|�S)zBReturn the hash of *source_bytes* as used in hash-based pyc files.)�_imp�source_hashr)�source_bytes�r�&/usr/lib64/python3.8/importlib/util.pyrsrcCs\|�d�s|S|s&tdt|��d���d}|D]}|dkr>qH|d7}q.t||d�||�S)z2Resolve a relative module name to an absolute one.�.zno package specified for z% (required for relative module names)r
rN)�
startswith�
ValueError�reprr)�name�package�level�	characterrrr�resolve_names

rcCsx|tjkrt||�Stj|}|dkr*dSz
|j}Wn$tk
rXtd�|��d�YnX|dkrptd�|���|SdS)a�Return the spec for the specified module.

    First, sys.modules is checked to see if the module was already imported. If
    so, then sys.modules[name].__spec__ is returned. If that happens to be
    set to None, then ValueError is raised. If the module is not in
    sys.modules, then sys.meta_path is searched for a suitable spec with the
    value of 'path' given to the finders. None is returned if no spec could
    be found.

    Dotted names do not have their parent packages implicitly imported. You will
    most likely need to explicitly import all parent packages in the proper
    order for a submodule to get the correct spec.

    N�{}.__spec__ is not set�{}.__spec__ is None)�sys�modulesr�__spec__�AttributeErrorr�format)r�path�module�specrrr�_find_spec_from_path*s



r'c	
Cs�|�d�rt||�n|}|tjkr�|�d�d}|r�t|dgd�}z
|j}Wq�tk
r�}ztd|�d|��|d�|�W5d}~XYq�Xnd}t	||�Stj|}|dkr�dSz
|j
}Wn$tk
r�td	�|��d�YnX|dkr�td
�|���|SdS)a�Return the spec for the specified module.

    First, sys.modules is checked to see if the module was already imported. If
    so, then sys.modules[name].__spec__ is returned. If that happens to be
    set to None, then ValueError is raised. If the module is not in
    sys.modules, then sys.meta_path is searched for a suitable spec with the
    value of 'path' given to the finders. None is returned if no spec could
    be found.

    If the name is for submodule (contains a dot), the parent module is
    automatically imported.

    The name and package arguments work the same as importlib.import_module().
    In other words, relative module names (with leading dots) work.

    rr
�__path__)�fromlistz __path__ attribute not found on z while trying to find )rNrr)
rrrr �
rpartition�
__import__r(r"�ModuleNotFoundErrorrr!rr#)	rr�fullname�parent_name�parent�parent_path�er%r&rrr�	find_specIs4

��


r2ccs�|tjk}tj�|�}|s6tt�|�}d|_|tj|<zJz
|VWn:tk
r||sxztj|=Wntk
rvYnXYnXW5d|_XdS)NTF)rr �get�type�__initializing__�	Exception�KeyError)r�	is_reloadr%rrr�_module_to_loadvs


r9cst����fdd��}|S)zOSet __package__ on the returned module.

    This function is deprecated.

    csRtjdtdd��||�}t|dd�dkrN|j|_t|d�sN|j�d�d|_|S)N�7The import system now takes care of this automatically.���
stacklevel�__package__r(rr
)�warnings�warn�DeprecationWarning�getattr�__name__r>�hasattrr*)�args�kwargsr%��fxnrr�set_package_wrapper�s�

z(set_package.<locals>.set_package_wrapper��	functools�wraps)rHrIrrGr�set_package�s	rMcst����fdd��}|S)zNSet __loader__ on the returned module.

    This function is deprecated.

    cs:tjdtdd��|f|�|�}t|dd�dkr6||_|S)Nr:r;r<�
__loader__)r?r@rArBrN)�selfrErFr%rGrr�set_loader_wrapper�s�z&set_loader.<locals>.set_loader_wrapperrJ)rHrPrrGr�
set_loader�srQcs*tjdtdd�t����fdd��}|S)a*Decorator to handle selecting the proper module for loaders.

    The decorated function is passed the module to use instead of the module
    name. The module passed in to the function is either from sys.modules if
    it already exists or is a new module. If the module is new, then __name__
    is set the first argument to the method, __loader__ is set to self, and
    __package__ is set accordingly (if self.is_package() is defined) will be set
    before it is passed to the decorated function (if self.is_package() does
    not work for the module it will be set post-load).

    If an exception is raised and the decorator created the module it is
    subsequently removed from sys.modules.

    The decorator assumes that the decorated function takes the module name as
    the second argument.

    r:r;r<c
s|t|��j}||_z|�|�}Wnttfk
r6YnX|rD||_n|�d�d|_�||f|�|�W5QR�SQRXdS)Nrr
)r9rN�
is_package�ImportErrorr"r>r*)rOr-rErFr%rRrGrr�module_for_loader_wrapper�s
z4module_for_loader.<locals>.module_for_loader_wrapper)r?r@rArKrL)rHrTrrGr�module_for_loader�s�rUc@s eZdZdZdd�Zdd�ZdS)�_LazyModulezKA subclass of the module type which triggers loading upon attribute access.c	Cs�tj|_|jj}|jjd}|jjd}|j}i}|��D]:\}}||krT|||<q:t||�t||�kr:|||<q:|jj	�
|�|tjkr�t|�ttj|�kr�t
d|�d���|j�|�t||�S)z8Trigger the load of the module and return the attribute.�__dict__�	__class__zmodule object for z. substituted in sys.modules during a lazy load)�types�
ModuleTyperXr!r�loader_staterW�items�id�loader�exec_modulerr r�updaterB)	rO�attr�
original_name�
attrs_then�
original_type�	attrs_now�
attrs_updated�key�valuerrr�__getattribute__�s"


z_LazyModule.__getattribute__cCs|�|�t||�dS)z/Trigger the load and then perform the deletion.N)ri�delattr)rOrarrr�__delattr__s
z_LazyModule.__delattr__N)rC�
__module__�__qualname__�__doc__rirkrrrrrV�s#rVc@s@eZdZdZedd��Zedd��Zdd�Zdd	�Z	d
d�Z
dS)
�
LazyLoaderzKA loader that creates a module which defers loading until attribute access.cCst|d�std��dS)Nr_z loader must define exec_module())rD�	TypeError)r^rrr�__check_eager_loaders
zLazyLoader.__check_eager_loadercs������fdd�S)z>Construct a callable which returns the eager loader made lazy.cs��||��S�Nr)rErF��clsr^rr�<lambda>�z$LazyLoader.factory.<locals>.<lambda>)�_LazyLoader__check_eager_loaderrsrrsr�factorys
zLazyLoader.factorycCs|�|�||_dSrr)rwr^)rOr^rrr�__init__s
zLazyLoader.__init__cCs|j�|�Srr)r^�
create_module)rOr&rrrrzszLazyLoader.create_modulecCs@|j|j_|j|_i}|j��|d<|j|d<||j_t|_dS)zMake the module load lazily.rWrXN)r^r!rNrW�copyrXr[rV)rOr%r[rrrr_ s

zLazyLoader.exec_moduleN)rCrlrmrn�staticmethodrw�classmethodrxryrzr_rrrrro
s

ro)N)N)"rn�r�
_bootstraprrrr�_bootstrap_externalrrr	r
rr�
contextlibrrrKrrYr?rrr'r2r9rMrQrUrZrV�Loaderrorrrr�<module>s8

-
'/__pycache__/_bootstrap_external.cpython-38.pyc000064400000132103150327175520015471 0ustar00U

&�.e��@sdZddladdlZddladdlZddlZtjdkZerLddlZ	ddl
Z
nddlZ	erbddgZndgZe
dd�eD��s~t�edZee�Zd�e�Zd	d
�eD�ZdZdZeeZd
d�Zdd�Zdd�Zdd�Zer�dd�Zndd�Zdd�Zdd�Zdd�Zdd�Zd d!�Z e�r$d"d#�Z!nd$d#�Z!d�d&d'�Z"e#e"j$�Z%d(�&d)d*�d+Z'e(�)e'd*�Z*d,Z+d-Z,d.gZ-d/gZ.e.Z/Z0d�dd0�d1d2�Z1d3d4�Z2d5d6�Z3d7d8�Z4d9d:�Z5d;d<�Z6d=d>�Z7d?d@�Z8dAdB�Z9dCdD�Z:d�dEdF�Z;d�dGdH�Z<d�dJdK�Z=dLdM�Z>e?�Z@d�de@dN�dOdP�ZAGdQdR�dR�ZBGdSdT�dT�ZCGdUdV�dVeC�ZDGdWdX�dX�ZEGdYdZ�dZeEeD�ZFGd[d\�d\eEeC�ZGgZHGd]d^�d^eEeC�ZIGd_d`�d`�ZJGdadb�db�ZKGdcdd�dd�ZLGdedf�df�ZMd�dgdh�ZNdidj�ZOdkdl�ZPdmdn�ZQdodpdqdrdsdtdudvdwdxdydzd{d|d}d~d�ZRd�d��ZSdS)�a^Core implementation of path-based import.

This module is NOT meant to be directly imported! It has been designed such
that it can be bootstrapped into Python as the implementation of import. As
such it requires the injection of specific modules and attributes in order to
work. One should use importlib as the public-facing version of this module.

�NZwin32�\�/ccs|]}t|�dkVqdS��N��len��.0�sep�r�5/usr/lib64/python3.8/importlib/_bootstrap_external.py�	<genexpr>+sr
�cCsh|]}d|���qS��:r�r	�srrr�	<setcomp>/sr)�win)�cygwin�darwincs<tj�t�r0tj�t�rd�nd��fdd�}ndd�}|S)N�PYTHONCASEOKsPYTHONCASEOKcs
�tjkS)�5True if filenames must be checked case-insensitively.)�_os�environr��keyrr�_relax_case@sz%_make_relax_case.<locals>._relax_casecSsdS)rFrrrrrrDs)�sys�platform�
startswith�_CASE_INSENSITIVE_PLATFORMS�#_CASE_INSENSITIVE_PLATFORMS_STR_KEY)rrrr�_make_relax_case9sr#cCst|�d@�dd�S)z*Convert a 32-bit integer to little-endian.�����little)�int�to_bytes)�xrrr�_pack_uint32Jsr*cCst|�dkst�t�|d�S)z/Convert 4 bytes in little-endian to an integer.r%r&�r�AssertionErrorr'�
from_bytes��datarrr�_unpack_uint32Osr0cCst|�dkst�t�|d�S)z/Convert 2 bytes in little-endian to an integer.�r&r+r.rrr�_unpack_uint16Tsr2cGs�|sdSt|�dkr|dSd}g}ttj|�D]z\}}|�t�sL|�t�rf|�t�pX|}t	|g}q0|�d�r�|�
�|�
�kr�|}|g}q�|�|�q0|p�|}|�|�q0dd�|D�}t|�dkr�|ds�|t	S|t	�|�S)�Replacement for os.path.join().rrrrcSsg|]}|r|�t��qSr��rstrip�path_separators�r	�prrr�
<listcomp>rs�_path_join.<locals>.<listcomp>)
r�mapr�_path_splitrootr �path_sep_tuple�endswithr5r6�path_sep�casefold�append�join)�
path_parts�root�pathZnew_root�tailrrr�
_path_join[s*
rGcGst�dd�|D��S)r3cSsg|]}|r|�t��qSrr4)r	�partrrrr9{s�r:)r?rB)rCrrrrGys
�csBt�fdd�tD��}|dkr&d�fS�d|��|dd�fS)z Replacement for os.path.split().c3s|]}��|�VqdS�N)�rfindr7�rErrr
�sz_path_split.<locals>.<genexpr>rrNr)�maxr6)rE�irrKr�_path_splitsrNcCs
t�|�S)z~Stat the path.

    Made a separate function to make it easier to override in experiments
    (e.g. cache stat results).

    )r�statrKrrr�
_path_stat�srPcCs2zt|�}Wntk
r"YdSX|jd@|kS)z1Test whether the path is the specified mode type.Fi�)rP�OSError�st_mode)rE�mode�	stat_inforrr�_path_is_mode_type�s
rUcCs
t|d�S)zReplacement for os.path.isfile.i�)rUrKrrr�_path_isfile�srVcCs|st��}t|d�S)zReplacement for os.path.isdir.i@)r�getcwdrUrKrrr�_path_isdir�srXcCs>|sdSt�|�d�dd�}t|�dko<|�d�p<|�d�S)�Replacement for os.path.isabs.Frrrrz\\)rr<�replacerr r>)rErDrrr�_path_isabs�sr[cCs
|�t�S)rY)r r6rKrrrr[�s�cCs�d�|t|��}t�|tjtjBtjB|d@�}z2t�|d��}|�	|�W5QRXt�
||�Wn:tk
r�zt�|�Wntk
r�YnX�YnXdS)z�Best-effort function to write data to a path atomically.
    Be prepared to handle a FileExistsError if concurrent writing of the
    temporary file is attempted.�{}.{}r\�wbN)
�format�idr�open�O_EXCL�O_CREAT�O_WRONLY�_io�FileIO�writerZrQ�unlink)rEr/rS�path_tmp�fd�filerrr�
_write_atomic�s�rliU
r1r&s
�__pycache__zopt-z.pyz.pyc)�optimizationcCsX|dk	r4t�dt�|dk	r(d}t|��|r0dnd}t�|�}t|�\}}|�d�\}}}tj	j
}	|	dkrrtd��d�|r~|n|||	g�}
|dkr�tj
jdkr�d}ntj
j}t|�}|dkr�|��s�td	�|���d
�|
t|�}
|
td}tjdk	�rLt|��stt��|�}|ddk�r8|dtk�r8|dd�}ttj|�t�|�St|t|�S)
a�Given the path to a .py file, return the path to its .pyc file.

    The .py file does not need to exist; this simply returns the path to the
    .pyc file calculated as if the .py file were imported.

    The 'optimization' parameter controls the presumed optimization level of
    the bytecode file. If 'optimization' is not None, the string representation
    of the argument is taken and verified to be alphanumeric (else ValueError
    is raised).

    The debug_override parameter is deprecated. If debug_override is not None,
    a True value is the same as setting 'optimization' to the empty string
    while a False value is equivalent to setting 'optimization' to '1'.

    If sys.implementation.cache_tag is None then NotImplementedError is raised.

    NzFthe debug_override parameter is deprecated; use 'optimization' insteadz2debug_override or optimization must be set to Nonerr�.�$sys.implementation.cache_tag is Nonerz{!r} is not alphanumericz{}.{}{}rr1)�	_warnings�warn�DeprecationWarning�	TypeErrorr�fspathrN�
rpartitionr�implementation�	cache_tag�NotImplementedErrorrB�flags�optimize�str�isalnum�
ValueErrorr_�_OPT�BYTECODE_SUFFIXES�pycache_prefixr[rGrWr6�lstrip�_PYCACHE)rE�debug_overridern�message�headrF�baser
�rest�tag�almost_filename�filenamerrr�cache_from_sourcebsH�
	
�r�c
Cs.tjjdkrtd��t�|�}t|�\}}d}tjdk	rftj�t	�}|�
|t�rf|t|�d�}d}|s�t|�\}}|t
kr�tt
�d|����|�d�}|dkr�td|����n\|d	k�r|�dd
�d}|�
t�s�tdt����|tt�d�}|���std
|�d���|�d�d}	t||	td�S)anGiven the path to a .pyc. file, return the path to its .py file.

    The .pyc file does not need to exist; this simply returns the path to
    the .py file calculated to correspond to the .pyc file.  If path does
    not conform to PEP 3147/488 format, ValueError will be raised. If
    sys.implementation.cache_tag is None then NotImplementedError is raised.

    NrpFTz not bottom-level directory in ro>r1�zexpected only 2 or 3 dots in r�r1���z5optimization portion of filename does not start with zoptimization level z is not an alphanumeric valuer)rrwrxryrrurNr�r5r6r r?rr�r~�count�rsplitrr}�	partitionrG�SOURCE_SUFFIXES)
rEr��pycache_filename�found_in_pycache_prefix�
stripped_path�pycache�	dot_countrn�	opt_level�
base_filenamerrr�source_from_cache�s4	





r�c	Cs~t|�dkrdS|�d�\}}}|r8|��dd�dkr<|Szt|�}Wn$ttfk
rl|dd�}YnXt|�rz|S|S)z�Convert a bytecode file path to a source path (if possible).

    This function exists purely for backwards-compatibility for
    PyImport_ExecCodeModuleWithFilenames() in the C API.

    rNro�������py)rrv�lowerr�ryr~rV)�
bytecode_pathr��_�	extension�source_pathrrr�_get_sourcefile�sr�cCsJ|�tt��r0z
t|�WStk
r,YqFXn|�tt��rB|SdSdSrI)r>�tupler�r�ryr�)r�rrr�_get_cached�s
r�cCs4zt|�j}Wntk
r&d}YnX|dO}|S)z3Calculate the mode permissions for a bytecode file.r\�)rPrRrQ)rErSrrr�
_calc_mode�s
r�csDd�fdd�	}z
tj}Wntk
r4dd�}YnX||��|S)z�Decorator to verify that the module being requested matches the one the
    loader can handle.

    The first argument (self) must define _name which the second argument is
    compared against. If the comparison fails then ImportError is raised.

    NcsB|dkr|j}n |j|kr0td|j|f|d���||f|�|�S)Nzloader for %s cannot handle %s��name)r��ImportError)�selfr��args�kwargs��methodrr�_check_name_wrappers
��z(_check_name.<locals>._check_name_wrappercSs8dD] }t||�rt||t||��q|j�|j�dS)N)�
__module__�__name__�__qualname__�__doc__)�hasattr�setattr�getattr�__dict__�update)�new�oldrZrrr�_wraps
z_check_name.<locals>._wrap)N)�
_bootstrapr��	NameError)r�r�r�rr�r�_check_name�s

r�cCs<|�|�\}}|dkr8t|�r8d}t�|�|d�t�|S)z�Try to find a loader for the specified module by delegating to
    self.find_loader().

    This method is deprecated in favor of finder.find_spec().

    Nz,Not importing directory {}: missing __init__r)�find_loaderrrqrrr_�
ImportWarning)r��fullname�loader�portions�msgrrr�_find_module_shims

r�cCs�|dd�}|tkr<d|�d|��}t�d|�t|f|��t|�dkrfd|��}t�d|�t|��t|dd��}|d	@r�d
|�d|��}t|f|��|S)aTPerform basic validity checking of a pyc header and return the flags field,
    which determines how the pyc should be further validated against the source.

    *data* is the contents of the pyc file. (Only the first 16 bytes are
    required, though.)

    *name* is the name of the module being imported. It is used for logging.

    *exc_details* is a dictionary passed to ImportError if it raised for
    improved debugging.

    ImportError is raised when the magic number is incorrect or when the flags
    field is invalid. EOFError is raised when the data is found to be truncated.

    Nr%zbad magic number in z: �{}�z(reached EOF while reading pyc header of ����zinvalid flags z in )�MAGIC_NUMBERr��_verbose_messager�r�EOFErrorr0)r/r��exc_details�magicr�rzrrr�
_classify_pyc)s
r�cCspt|dd��|d@kr:d|��}t�d|�t|f|��|dk	rlt|dd��|d@krltd|��f|��dS)aValidate a pyc against the source last-modified time.

    *data* is the contents of the pyc file. (Only the first 16 bytes are
    required.)

    *source_mtime* is the last modified timestamp of the source file.

    *source_size* is None or the size of the source file in bytes.

    *name* is the name of the module being imported. It is used for logging.

    *exc_details* is a dictionary passed to ImportError if it raised for
    improved debugging.

    An ImportError is raised if the bytecode is stale.

    r��r$zbytecode is stale for r�Nr�)r0r�r�r�)r/�source_mtime�source_sizer�r�r�rrr�_validate_timestamp_pycJs
�r�cCs&|dd�|kr"td|��f|��dS)a�Validate a hash-based pyc by checking the real source hash against the one in
    the pyc header.

    *data* is the contents of the pyc file. (Only the first 16 bytes are
    required.)

    *source_hash* is the importlib.util.source_hash() of the source file.

    *name* is the name of the module being imported. It is used for logging.

    *exc_details* is a dictionary passed to ImportError if it raised for
    improved debugging.

    An ImportError is raised if the bytecode is stale.

    r�r�z.hash in bytecode doesn't match hash of source N)r�)r/�source_hashr�r�rrr�_validate_hash_pycfs��r�cCsPt�|�}t|t�r8t�d|�|dk	r4t�||�|Std�	|�||d��dS)z#Compile bytecode as found in a pyc.zcode object from {!r}NzNon-code object in {!r}�r�rE)
�marshal�loads�
isinstance�
_code_typer�r��_imp�_fix_co_filenamer�r_)r/r�r�r��coderrr�_compile_bytecode~s


�r�cCsFtt�}|�td��|�t|��|�t|��|�t�|��|S)z+Produce the data for a timestamp-based pyc.r)�	bytearrayr��extendr*r��dumps)r��mtimer�r/rrr�_code_to_timestamp_pyc�sr�TcCsPtt�}d|d>B}|�t|��t|�dks2t�|�|�|�t�|��|S)z&Produce the data for a hash-based pyc.rr�)r�r�r�r*rr,r�r�)r�r��checkedr/rzrrr�_code_to_hash_pyc�s
r�cCs>ddl}t�|�j}|�|�}t�dd�}|�|�|d��S)zyDecode bytes representing source code and return the string.

    Universal newline support is used in the decoding.
    rNT)�tokenizere�BytesIO�readline�detect_encoding�IncrementalNewlineDecoder�decode)�source_bytesr��source_bytes_readline�encoding�newline_decoderrrr�
decode_source�s

r��r��submodule_search_locationsc	Cs|dkr<d}t|d�rFz|�|�}WqFtk
r8YqFXn
t�|�}tj|||d�}d|_|dkr�t�D]*\}}|�	t
|��rj|||�}||_q�qjdS|tkr�t|d�r�z|�
|�}Wntk
r�Yq�X|r�g|_n||_|jgk�r|�rt|�d}|j�|�|S)a=Return a module spec based on a file location.

    To indicate that the module is a package, set
    submodule_search_locations to a list of directory paths.  An
    empty list is sufficient, though its not otherwise useful to the
    import system.

    The loader must take a spec as its only __init__() arg.

    Nz	<unknown>�get_filename��originT�
is_packager)r�r�r�rrur��
ModuleSpec�
_set_fileattr�_get_supported_file_loadersr>r�r��	_POPULATEr�r�rNrA)	r��locationr�r��spec�loader_class�suffixesr��dirnamerrr�spec_from_file_location�s>



rc@sPeZdZdZdZdZdZedd��Zedd��Z	edd
d��Z
eddd
��Zd	S)�WindowsRegistryFinderz>Meta path finder for modules declared in the Windows registry.z;Software\Python\PythonCore\{sys_version}\Modules\{fullname}zASoftware\Python\PythonCore\{sys_version}\Modules\{fullname}\DebugFcCs8zt�tj|�WStk
r2t�tj|�YSXdSrI)�_winreg�OpenKey�HKEY_CURRENT_USERrQ�HKEY_LOCAL_MACHINE)�clsrrrr�_open_registrysz$WindowsRegistryFinder._open_registryc	Csr|jr|j}n|j}|j|dtjdd�d�}z&|�|��}t�|d�}W5QRXWnt	k
rlYdSX|S)Nz%d.%dr1)r��sys_versionr)
�DEBUG_BUILD�REGISTRY_KEY_DEBUG�REGISTRY_KEYr_r�version_inforr�
QueryValuerQ)rr��registry_keyr�hkey�filepathrrr�_search_registrys�z&WindowsRegistryFinder._search_registryNcCsz|�|�}|dkrdSzt|�Wntk
r8YdSXt�D]4\}}|�t|��r@tj||||�|d�}|Sq@dS)Nr�)rrPrQr�r>r�r��spec_from_loader)rr�rE�targetrr�r�r�rrr�	find_specs
�zWindowsRegistryFinder.find_speccCs"|�||�}|dk	r|jSdSdS)zlFind module named in the registry.

        This method is deprecated.  Use exec_module() instead.

        N�rr��rr�rEr�rrr�find_module'sz!WindowsRegistryFinder.find_module)NN)N)r�r�r�r�rrr
�classmethodrrrrrrrrr�s��

rc@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�
_LoaderBasicszSBase class of common code needed by both SourceLoader and
    SourcelessFileLoader.cCs@t|�|��d}|�dd�d}|�d�d}|dko>|dkS)z�Concrete implementation of InspectLoader.is_package by checking if
        the path returned by get_filename has a filename of '__init__.py'.rrorr1�__init__)rNr�r�rv)r�r�r��
filename_base�	tail_namerrrr�:sz_LoaderBasics.is_packagecCsdS�z*Use default semantics for module creation.Nr�r�r�rrr�
create_moduleBsz_LoaderBasics.create_modulecCs8|�|j�}|dkr$td�|j���t�t||j�dS)zExecute the module.Nz4cannot load module {!r} when get_code() returns None)�get_coder�r�r_r��_call_with_frames_removed�execr�)r��moduler�rrr�exec_moduleEs�z_LoaderBasics.exec_modulecCst�||�S)zThis module is deprecated.)r��_load_module_shim�r�r�rrr�load_moduleMsz_LoaderBasics.load_moduleN)r�r�r�r�r�r r%r(rrrrr5s
rc@sJeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�d
d�Zdd�Z	dS)�SourceLoadercCst�dS)z�Optional method that returns the modification time (an int) for the
        specified path (a str).

        Raises OSError when the path cannot be handled.
        N)rQ�r�rErrr�
path_mtimeTszSourceLoader.path_mtimecCsd|�|�iS)a�Optional method returning a metadata dict for the specified
        path (a str).

        Possible keys:
        - 'mtime' (mandatory) is the numeric timestamp of last source
          code modification;
        - 'size' (optional) is the size in bytes of the source code.

        Implementing this method allows the loader to read bytecode files.
        Raises OSError when the path cannot be handled.
        r�)r+r*rrr�
path_stats\szSourceLoader.path_statscCs|�||�S)z�Optional method which writes data (bytes) to a file path (a str).

        Implementing this method allows for the writing of bytecode files.

        The source path is needed in order to correctly transfer permissions
        )�set_data)r�r��
cache_pathr/rrr�_cache_bytecodejszSourceLoader._cache_bytecodecCsdS)z�Optional method which writes data (bytes) to a file path (a str).

        Implementing this method allows for the writing of bytecode files.
        Nr)r�rEr/rrrr-tszSourceLoader.set_datac
CsR|�|�}z|�|�}Wn0tk
rH}ztd|d�|�W5d}~XYnXt|�S)z4Concrete implementation of InspectLoader.get_source.z'source not available through get_data()r�N)r��get_datarQr�r�)r�r�rEr��excrrr�
get_source{s
��zSourceLoader.get_sourcer�)�	_optimizecCstjt||dd|d�S)z�Return the code object compiled from source.

        The 'data' argument can be any object type that compile() supports.
        r#T)�dont_inheritr{)r�r"�compile)r�r/rEr3rrr�source_to_code�s�zSourceLoader.source_to_codec	Cs"|�|�}d}d}d}d}d}zt|�}Wntk
rDd}Y�n0Xz|�|�}	Wntk
rjY�n
Xt|	d�}z|�|�}
Wntk
r�Yn�X||d�}z�t|
||�}t|
�dd�}
|d@dk}|�r$|d	@dk}t	j
d
k�r8|s�t	j
dk�r8|�|�}t	�t|�}t
|
|||�nt|
||	d||�Wnttfk
�rTYn Xt�d
||�t|
|||d�S|dk�r�|�|�}|�||�}t�d|�tj�s|dk	�r|dk	�r|�r�|dk�r�t	�|�}t|||�}
nt||t|��}
z|�|||
�Wntk
�rYnX|S)z�Concrete implementation of InspectLoader.get_code.

        Reading of bytecode requires path_stats to be implemented. To write
        bytecode, set_data must also be implemented.

        NFTr�r�r�rrr1�never�always�sizez
{} matches {})r�r�r�zcode object from {})r�r�ryr,rQr'r0r��
memoryviewr��check_hash_based_pycsr��_RAW_MAGIC_NUMBERr�r�r�r�r�r�r�r6r�dont_write_bytecoder�r�rr/)r�r�r�r�r�r��
hash_based�check_sourcer��str/r�rz�
bytes_data�code_objectrrrr!�s�
���
�����

�

�zSourceLoader.get_codeN)
r�r�r�r+r,r/r-r2r6r!rrrrr)Rs

r)cs|eZdZdZdd�Zdd�Zdd�Ze�fdd	��Zed
d��Z	dd
�Z
edd��Zdd�Zdd�Z
dd�Zdd�Z�ZS)�
FileLoaderzgBase file loader class which implements the loader protocol methods that
    require file system usage.cCs||_||_dS)zKCache the module name and the path to the file found by the
        finder.Nr�)r�r�rErrrr�szFileLoader.__init__cCs|j|jko|j|jkSrI��	__class__r��r��otherrrr�__eq__�s
�zFileLoader.__eq__cCst|j�t|j�ASrI��hashr�rE�r�rrr�__hash__�szFileLoader.__hash__cstt|��|�S)zdLoad a module from a file.

        This method is deprecated.  Use exec_module() instead.

        )�superrCr(r'�rErrr(�s
zFileLoader.load_modulecCs|jS�z:Return the path to the source file as found by the finder.rKr'rrrr�szFileLoader.get_filenamec
Csft|ttf�r:t�t|���}|��W5QR�SQRXn(t�|d��}|��W5QR�SQRXdS)z'Return the data from path as raw bytes.�rN)r�r)�ExtensionFileLoaderre�	open_coder|�readrf)r�rErkrrrr0s
zFileLoader.get_datacCs|�|�r|SdSrI)r��r�r$rrr�get_resource_readers
zFileLoader.get_resource_readercCs tt|j�d|�}t�|d�S)NrrP)rGrNrErerf�r��resourcerErrr�
open_resourceszFileLoader.open_resourcecCs&|�|�st�tt|j�d|�}|S�Nr)�is_resource�FileNotFoundErrorrGrNrErVrrr�
resource_paths
zFileLoader.resource_pathcCs(t|krdStt|j�d|�}t|�S)NFr)r?rGrNrErV�r�r�rErrrrZ szFileLoader.is_resourcecCstt�t|j�d��SrY)�iterr�listdirrNrErKrrr�contents&szFileLoader.contents)r�r�r�r�rrHrLr�r(r�r0rUrXr\rZr`�
__classcell__rrrNrrC�s

rCc@s.eZdZdZdd�Zdd�Zdd�dd	�Zd
S)�SourceFileLoaderz>Concrete implementation of SourceLoader using the file system.cCst|�}|j|jd�S)z!Return the metadata for the path.)r�r9)rP�st_mtime�st_size)r�rEr@rrrr,.szSourceFileLoader.path_statscCst|�}|j|||d�S)N��_mode)r�r-)r�r�r�r/rSrrrr/3sz SourceFileLoader._cache_bytecoder\rec	Cs�t|�\}}g}|r4t|�s4t|�\}}|�|�qt|�D]l}t||�}zt�|�Wq<tk
rpYq<Yq<tk
r�}zt	�
d||�WY�dSd}~XYq<Xq<zt|||�t	�
d|�Wn0tk
r�}zt	�
d||�W5d}~XYnXdS)zWrite bytes data to a file.zcould not create {!r}: {!r}Nzcreated {!r})rNrXrA�reversedrGr�mkdir�FileExistsErrorrQr�r�rl)	r�rEr/rf�parentr�rCrHr1rrrr-8s0
��zSourceFileLoader.set_dataN)r�r�r�r�r,r/r-rrrrrb*srbc@s eZdZdZdd�Zdd�ZdS)�SourcelessFileLoaderz-Loader which handles sourceless file imports.cCsD|�|�}|�|�}||d�}t|||�tt|�dd�||d�S)Nr�r�)r�r�)r�r0r�r�r:)r�r�rEr/r�rrrr![s

��zSourcelessFileLoader.get_codecCsdS)z'Return None as there is no source code.Nrr'rrrr2kszSourcelessFileLoader.get_sourceN)r�r�r�r�r!r2rrrrrkWsrkc@s\eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zedd��Z
dS)rQz]Loader for extension modules.

    The constructor is designed to work with FileFinder.

    cCs@||_t|�s6ztt��|�}Wntk
r4YnX||_dSrI)r�r[rGrrWrQrEr]rrrr|szExtensionFileLoader.__init__cCs|j|jko|j|jkSrIrDrFrrrrH�s
�zExtensionFileLoader.__eq__cCst|j�t|j�ASrIrIrKrrrrL�szExtensionFileLoader.__hash__cCs$t�tj|�}t�d|j|j�|S)z&Create an unitialized extension modulez&extension module {!r} loaded from {!r})r�r"r��create_dynamicr�r�rE)r�r�r$rrrr �s��z!ExtensionFileLoader.create_modulecCs$t�tj|�t�d|j|j�dS)zInitialize an extension modulez(extension module {!r} executed from {!r}N)r�r"r��exec_dynamicr�r�rErTrrrr%�s
�zExtensionFileLoader.exec_modulecs$t|j�d�t�fdd�tD��S)z1Return True if the extension module is a package.rc3s|]}�d|kVqdS)rNr�r	�suffix��	file_namerrr
�s�z1ExtensionFileLoader.is_package.<locals>.<genexpr>)rNrE�any�EXTENSION_SUFFIXESr'rrprr��s�zExtensionFileLoader.is_packagecCsdS)z?Return None as an extension module cannot create a code object.Nrr'rrrr!�szExtensionFileLoader.get_codecCsdS)z5Return None as extension modules have no source code.Nrr'rrrr2�szExtensionFileLoader.get_sourcecCs|jSrOrKr'rrrr��sz ExtensionFileLoader.get_filenameN)r�r�r�r�rrHrLr r%r�r!r2r�r�rrrrrQts	rQc@sheZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�ZdS)�_NamespacePatha&Represents a namespace package's path.  It uses the module name
    to find its parent module, and from there it looks up the parent's
    __path__.  When this changes, the module's own path is recomputed,
    using path_finder.  For top-level modules, the parent module's path
    is sys.path.cCs$||_||_t|���|_||_dSrI)�_name�_pathr��_get_parent_path�_last_parent_path�_path_finder�r�r�rE�path_finderrrrr�sz_NamespacePath.__init__cCs&|j�d�\}}}|dkrdS|dfS)z>Returns a tuple of (parent-module-name, parent-path-attr-name)ror)rrE�__path__)rurv)r�rj�dot�merrr�_find_parent_path_names�sz&_NamespacePath._find_parent_path_namescCs|��\}}ttj||�SrI)rr�r�modules)r��parent_module_name�path_attr_namerrrrw�sz_NamespacePath._get_parent_pathcCsPt|���}||jkrJ|�|j|�}|dk	rD|jdkrD|jrD|j|_||_|jSrI)r�rwrxryrur�r�rv)r��parent_pathr�rrr�_recalculate�s
z_NamespacePath._recalculatecCst|���SrI)r^r�rKrrr�__iter__�sz_NamespacePath.__iter__cCs|��|SrI�r�)r��indexrrr�__getitem__�sz_NamespacePath.__getitem__cCs||j|<dSrI)rv)r�r�rErrr�__setitem__�sz_NamespacePath.__setitem__cCst|���SrI)rr�rKrrr�__len__�sz_NamespacePath.__len__cCsd�|j�S)Nz_NamespacePath({!r}))r_rvrKrrr�__repr__�sz_NamespacePath.__repr__cCs||��kSrIr��r��itemrrr�__contains__�sz_NamespacePath.__contains__cCs|j�|�dSrI)rvrAr�rrrrA�sz_NamespacePath.appendN)r�r�r�r�rrrwr�r�r�r�r�r�r�rArrrrrt�s

rtc@sPeZdZdd�Zedd��Zdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�ZdS)�_NamespaceLoadercCst|||�|_dSrI)rtrvrzrrrr�sz_NamespaceLoader.__init__cCsd�|j�S)zsReturn repr for the module.

        The method is deprecated.  The import machinery does the job itself.

        z<module {!r} (namespace)>)r_r�)rr$rrr�module_repr�sz_NamespaceLoader.module_reprcCsdS)NTrr'rrrr��sz_NamespaceLoader.is_packagecCsdS)Nrrr'rrrr2�sz_NamespaceLoader.get_sourcecCstddddd�S)Nrz<string>r#T)r4)r5r'rrrr!sz_NamespaceLoader.get_codecCsdSrrrrrrr sz_NamespaceLoader.create_modulecCsdSrIrrTrrrr%sz_NamespaceLoader.exec_modulecCst�d|j�t�||�S)zbLoad a namespace module.

        This method is deprecated.  Use exec_module() instead.

        z&namespace module loaded with path {!r})r�r�rvr&r'rrrr(	s�z_NamespaceLoader.load_moduleN)r�r�r�rrr�r�r2r!r r%r(rrrrr��s
r�c@sveZdZdZedd��Zedd��Zedd��Zedd	��Zeddd��Z	edd
d��Z
eddd��Zedd��Zd
S)�
PathFinderz>Meta path finder for sys.path and package __path__ attributes.cCs@ttj���D],\}}|dkr(tj|=qt|d�r|��qdS)z}Call the invalidate_caches() method on all path entry finders
        stored in sys.path_importer_caches (where implemented).N�invalidate_caches)�listr�path_importer_cache�itemsr�r�)rr��finderrrrr�s


zPathFinder.invalidate_cachesc	CsTtjdk	rtjst�dt�tjD],}z||�WStk
rLYq"Yq"Xq"dS)z.Search sys.path_hooks for a finder for 'path'.Nzsys.path_hooks is empty)r�
path_hooksrqrrr�r�)rrE�hookrrr�_path_hooks%s
zPathFinder._path_hookscCsh|dkr,zt��}Wntk
r*YdSXztj|}Wn(tk
rb|�|�}|tj|<YnX|S)z�Get the finder for the path entry from sys.path_importer_cache.

        If the path entry is not in the cache, find the appropriate finder
        and cache it. If no finder is available, store None.

        rN)rrWr[rr��KeyErrorr�)rrEr�rrr�_path_importer_cache2s
zPathFinder._path_importer_cachecCsRt|d�r|�|�\}}n|�|�}g}|dk	r<t�||�St�|d�}||_|S)Nr�)r�r�rr�rr�r�)rr�r�r�r�r�rrr�_legacy_get_specHs

zPathFinder._legacy_get_specNc	Cs�g}|D]�}t|ttf�sq|�|�}|dk	rt|d�rF|�||�}n|�||�}|dkr\q|jdk	rn|S|j}|dkr�t	d��|�
|�qt�|d�}||_|S)z?Find the loader or namespace_path for this module/package name.Nrzspec missing loader)
r�r|�bytesr�r�rr�r�r�r�r�r�r�)	rr�rEr�namespace_path�entryr�r�r�rrr�	_get_specWs(


zPathFinder._get_speccCsd|dkrtj}|�|||�}|dkr(dS|jdkr\|j}|rVd|_t|||j�|_|SdSn|SdS)z�Try to find a spec for 'fullname' on sys.path or 'path'.

        The search is based on sys.path_hooks and sys.path_importer_cache.
        N)rrEr�r�r�r�rt)rr�rErr�r�rrrrws
zPathFinder.find_speccCs|�||�}|dkrdS|jS)z�find the module on sys.path or 'path' based on sys.path_hooks and
        sys.path_importer_cache.

        This method is deprecated.  Use find_spec() instead.

        Nrrrrrr�szPathFinder.find_modulecOsddlm}|j||�S)a 
        Find distributions.

        Return an iterable of all Distribution instances capable of
        loading the metadata for packages matching ``context.name``
        (or all names if ``None`` indicated) along the paths in the list
        of directories ``context.path``.
        r)�MetadataPathFinder)�importlib.metadatar��find_distributions)rr�r�r�rrrr��s
zPathFinder.find_distributions)N)NN)N)
r�r�r�r�rr�r�r�r�r�rrr�rrrrr�s"
	


r�c@sZeZdZdZdd�Zdd�ZeZdd�Zdd	�Z	ddd�Z
d
d�Zedd��Z
dd�Zd
S)�
FileFinderz�File-based finder.

    Interactions with the file system are cached for performance, being
    refreshed when the directory the finder is handling has been modified.

    cspg}|D] \�}|��fdd�|D��q||_|p6d|_t|j�sVtt��|j�|_d|_t�|_	t�|_
dS)z�Initialize with the path to search on and a variable number of
        2-tuples containing the loader and the file suffixes the loader
        recognizes.c3s|]}|�fVqdSrIrrn�r�rrr
�sz&FileFinder.__init__.<locals>.<genexpr>ror�N)r��_loadersrEr[rGrrW�_path_mtime�set�_path_cache�_relaxed_path_cache)r�rE�loader_details�loadersr�rr�rr�s

zFileFinder.__init__cCs
d|_dS)zInvalidate the directory mtime.r�N)r�rKrrrr��szFileFinder.invalidate_cachescCs*|�|�}|dkrdgfS|j|jp&gfS)z�Try to find a loader for the specified module, or the namespace
        package portions. Returns (loader, list-of-portions).

        This method is deprecated.  Use find_spec() instead.

        N)rr�r�)r�r�r�rrrr��s
zFileFinder.find_loadercCs|||�}t||||d�S)Nr�)r)r�r�r�rE�smslrr�rrrr��s
�zFileFinder._get_specNc	Cs�d}|�d�d}zt|jp"t���j}Wntk
rBd}YnX||jkr\|��||_t	�rr|j
}|��}n
|j}|}||kr�t
|j|�}|jD]:\}	}
d|	}t
||�}t|�r�|�|
|||g|�Sq�t|�}|jD]r\}	}
zt
|j||	�}Wntk
�rYdSXtjd|dd�||	|kr�t|�r�|�|
||d|�Sq�|�r~t�d	|�t�|d�}
|g|
_|
SdS)
zoTry to find a spec for the specified module.

        Returns the matching spec, or None if not found.
        Fror1r�rNz	trying {})�	verbosityzpossible namespace for {})rvrPrErrWrcrQr��_fill_cacherr�r�r�rGr�rVr�rXr~r�r�r�r�)r�r�r�is_namespace�tail_moduler��cache�cache_module�	base_pathror��
init_filename�	full_pathr�rrrr�sP





�
zFileFinder.find_specc	
Cs�|j}zt�|pt���}Wntttfk
r:g}YnXtj�	d�sTt
|�|_nJt
�}|D]8}|�d�\}}}|r�d�
||���}n|}|�|�q^||_tj�	t�r�dd�|D�|_dS)zDFill the cache of potential modules and packages for this directory.rror]cSsh|]}|���qSr)r�)r	�fnrrrr*sz)FileFinder._fill_cache.<locals>.<setcomp>N)rErr_rWr[�PermissionError�NotADirectoryErrorrrr r�r�r�r_r��addr!r�)	r�rEr`�lower_suffix_contentsr�r�r}ro�new_namerrrr�
s"
zFileFinder._fill_cachecs��fdd�}|S)aA class method which returns a closure to use on sys.path_hook
        which will return an instance using the specified loaders and the path
        called on the closure.

        If the path called on the closure is not a directory, ImportError is
        raised.

        cs"t|�std|d���|f���S)z-Path hook for importlib.machinery.FileFinder.zonly directories are supportedrK)rXr�rK�rr�rr�path_hook_for_FileFinder6sz6FileFinder.path_hook.<locals>.path_hook_for_FileFinderr)rr�r�rr�r�	path_hook,s
zFileFinder.path_hookcCsd�|j�S)NzFileFinder({!r}))r_rErKrrrr�>szFileFinder.__repr__)N)r�r�r�r�rr�r�rr�r�rr�rr�r�rrrrr��s
3
r�cCs�|�d�}|�d�}|sB|r$|j}n||kr8t||�}n
t||�}|sTt|||d�}z$||d<||d<||d<||d<Wntk
r�YnXdS)N�
__loader__�__spec__r��__file__�
__cached__)�getr�rkrbr�	Exception)�nsr��pathname�	cpathnamer�r�rrr�_fix_up_moduleDs"


r�cCs*ttt���f}ttf}ttf}|||gS)z_Returns a list of file-based module loaders.

    Each item is a tuple (loader, suffixes).
    )rQ�_alternative_architecturesr��extension_suffixesrbr�rkr�)�
extensions�source�bytecoderrrr�[sr�c	Cs�|atjatjatjt}dD]0}|tjkr8t�|�}n
tj|}t|||�qddgfdddgff}|D]n\}}tdd�|D��s�t�|d}|tjkr�tj|}q�qjzt�|�}Wq�Wqjt	k
r�YqjYqjXqjt	d	��t|d
|�t|d|�t|dd
�
|��t|ddd�|D��t�d�}	t|d|	�t�d�}
t|d|
�|dk�rnt�d�}t|d|�t|dt��t�
tt����|dk�r�t�d�dtk�r�dt_dS)z�Setup the path-based importers for importlib by importing needed
    built-in modules and injecting them into the global namespace.

    Other components are extracted from the core bootstrap module.

    )rerq�builtinsr��posixr�ntrcss|]}t|�dkVqdSrrrrrrr
sz_setup.<locals>.<genexpr>rzimportlib requires posix or ntrr?r6r�_pathseps_with_coloncSsh|]}d|���qSrrrrrrr�sz_setup.<locals>.<setcomp>�_thread�_weakref�winregrrz.pywz_d.pydTN)r�rr�r�r��_builtin_from_namer��allr,r�rBr#rsr�r�r�r�rArr
)�_bootstrap_module�self_module�builtin_name�builtin_module�
os_details�
builtin_osr6r?�	os_module�
thread_module�weakref_module�
winreg_modulerrr�_setupfsN













r�cCs2t|�t�}tj�tj|�g�tj�t	�dS)z)Install the path-based import components.N)
r�r�rr�r�r�r��	meta_pathrAr�)r��supported_loadersrrr�_install�sr��-arm-linux-gnueabihf.�-armeb-linux-gnueabihf.�-mips64-linux-gnuabi64.�-mips64el-linux-gnuabi64.�-powerpc-linux-gnu.�-powerpc-linux-gnuspe.�-powerpc64-linux-gnu.�-powerpc64le-linux-gnu.�-arm-linux-gnueabi.�-armeb-linux-gnueabi.�-mips64-linux-gnu.�-mips64el-linux-gnu.�-ppc-linux-gnu.�-ppc-linux-gnuspe.�-ppc64-linux-gnu.�-ppc64le-linux-gnu.)r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�cCsF|D]<}t��D].\}}||kr|�|�||��|Sqq|S)z�Add a suffix with an alternative architecture name
    to the list of suffixes so an extension built with
    the default (upstream) setting is loadable with our Pythons
    )�	_ARCH_MAPr�rArZ)r�ro�original�alternativerrrr��sr�)r\)N)NNN)rr)T)N)N)Tr�r�rerrqr�r�_MS_WINDOWSr�rr�r�r6r�r,r?r�r=rBr�r"�%_CASE_INSENSITIVE_PLATFORMS_BYTES_KEYr!r#r*r0r2rGrNrPrUrVrXr[rl�type�__code__r�r(r�r'r-r<r�rr�r��DEBUG_BYTECODE_SUFFIXES�OPTIMIZED_BYTECODE_SUFFIXESr�r�r�r�r�r�r�r�r�r�r�r�r�r��objectr�rrrr)rCrbrkrsrQrtr�r�r�r�r�r�r�r�r�rrrr�<module>s�



�

	



G(!



�D@H-:?*
A	�__pycache__/util.cpython-38.pyc000064400000022116150327175520012372 0ustar00U

e5d7,�@s,dZddlmZddlmZddlmZddlmZddlmZddlm	Z	ddlm
Z
dd	lmZdd
lmZddlm
Z
ddlmZd
dlmZd
dlZd
dlZd
dlZd
dlZd
dlZdd�Zdd�Zd$dd�Zd%dd�Zedd��Zdd�Zdd�Zdd�ZGd d!�d!ej�ZGd"d#�d#ej �Z!dS)&z-Utility code for constructing importers, etc.�)�abc)�module_from_spec)�
_resolve_name)�spec_from_loader)�
_find_spec)�MAGIC_NUMBER)�_RAW_MAGIC_NUMBER)�cache_from_source)�
decode_source)�source_from_cache)�spec_from_file_location�)�contextmanagerNcCst�t|�S)zBReturn the hash of *source_bytes* as used in hash-based pyc files.)�_imp�source_hashr)�source_bytes�r�&/usr/lib64/python3.8/importlib/util.pyrsrcCs\|�d�s|S|s&tdt|��d���d}|D]}|dkr>qH|d7}q.t||d�||�S)z2Resolve a relative module name to an absolute one.�.zno package specified for z% (required for relative module names)r
rN)�
startswith�
ValueError�reprr)�name�package�level�	characterrrr�resolve_names

rcCsx|tjkrt||�Stj|}|dkr*dSz
|j}Wn$tk
rXtd�|��d�YnX|dkrptd�|���|SdS)a�Return the spec for the specified module.

    First, sys.modules is checked to see if the module was already imported. If
    so, then sys.modules[name].__spec__ is returned. If that happens to be
    set to None, then ValueError is raised. If the module is not in
    sys.modules, then sys.meta_path is searched for a suitable spec with the
    value of 'path' given to the finders. None is returned if no spec could
    be found.

    Dotted names do not have their parent packages implicitly imported. You will
    most likely need to explicitly import all parent packages in the proper
    order for a submodule to get the correct spec.

    N�{}.__spec__ is not set�{}.__spec__ is None)�sys�modulesr�__spec__�AttributeErrorr�format)r�path�module�specrrr�_find_spec_from_path*s



r'c	
Cs�|�d�rt||�n|}|tjkr�|�d�d}|r�t|dgd�}z
|j}Wq�tk
r�}ztd|�d|��|d�|�W5d}~XYq�Xnd}t	||�Stj|}|dkr�dSz
|j
}Wn$tk
r�td	�|��d�YnX|dkr�td
�|���|SdS)a�Return the spec for the specified module.

    First, sys.modules is checked to see if the module was already imported. If
    so, then sys.modules[name].__spec__ is returned. If that happens to be
    set to None, then ValueError is raised. If the module is not in
    sys.modules, then sys.meta_path is searched for a suitable spec with the
    value of 'path' given to the finders. None is returned if no spec could
    be found.

    If the name is for submodule (contains a dot), the parent module is
    automatically imported.

    The name and package arguments work the same as importlib.import_module().
    In other words, relative module names (with leading dots) work.

    rr
�__path__)�fromlistz __path__ attribute not found on z while trying to find )rNrr)
rrrr �
rpartition�
__import__r(r"�ModuleNotFoundErrorrr!rr#)	rr�fullname�parent_name�parent�parent_path�er%r&rrr�	find_specIs4

��


r2ccs�|tjk}tj�|�}|s6tt�|�}d|_|tj|<zJz
|VWn:tk
r||sxztj|=Wntk
rvYnXYnXW5d|_XdS)NTF)rr �get�type�__initializing__�	Exception�KeyError)r�	is_reloadr%rrr�_module_to_loadvs


r9cst����fdd��}|S)zOSet __package__ on the returned module.

    This function is deprecated.

    csRtjdtdd��||�}t|dd�dkrN|j|_t|d�sN|j�d�d|_|S)N�7The import system now takes care of this automatically.���
stacklevel�__package__r(rr
)�warnings�warn�DeprecationWarning�getattr�__name__r>�hasattrr*)�args�kwargsr%��fxnrr�set_package_wrapper�s�

z(set_package.<locals>.set_package_wrapper��	functools�wraps)rHrIrrGr�set_package�s	rMcst����fdd��}|S)zNSet __loader__ on the returned module.

    This function is deprecated.

    cs:tjdtdd��|f|�|�}t|dd�dkr6||_|S)Nr:r;r<�
__loader__)r?r@rArBrN)�selfrErFr%rGrr�set_loader_wrapper�s�z&set_loader.<locals>.set_loader_wrapperrJ)rHrPrrGr�
set_loader�srQcs*tjdtdd�t����fdd��}|S)a*Decorator to handle selecting the proper module for loaders.

    The decorated function is passed the module to use instead of the module
    name. The module passed in to the function is either from sys.modules if
    it already exists or is a new module. If the module is new, then __name__
    is set the first argument to the method, __loader__ is set to self, and
    __package__ is set accordingly (if self.is_package() is defined) will be set
    before it is passed to the decorated function (if self.is_package() does
    not work for the module it will be set post-load).

    If an exception is raised and the decorator created the module it is
    subsequently removed from sys.modules.

    The decorator assumes that the decorated function takes the module name as
    the second argument.

    r:r;r<c
s|t|��j}||_z|�|�}Wnttfk
r6YnX|rD||_n|�d�d|_�||f|�|�W5QR�SQRXdS)Nrr
)r9rN�
is_package�ImportErrorr"r>r*)rOr-rErFr%rRrGrr�module_for_loader_wrapper�s
z4module_for_loader.<locals>.module_for_loader_wrapper)r?r@rArKrL)rHrTrrGr�module_for_loader�s�rUc@s eZdZdZdd�Zdd�ZdS)�_LazyModulezKA subclass of the module type which triggers loading upon attribute access.c	Cs�tj|_|jj}|jjd}|jjd}|j}i}|��D]:\}}||krT|||<q:t||�t||�kr:|||<q:|jj	�
|�|tjkr�t|�ttj|�kr�t
d|�d���|j�|�t||�S)z8Trigger the load of the module and return the attribute.�__dict__�	__class__zmodule object for z. substituted in sys.modules during a lazy load)�types�
ModuleTyperXr!r�loader_staterW�items�id�loader�exec_modulerr r�updaterB)	rO�attr�
original_name�
attrs_then�
original_type�	attrs_now�
attrs_updated�key�valuerrr�__getattribute__�s"


z_LazyModule.__getattribute__cCs|�|�t||�dS)z/Trigger the load and then perform the deletion.N)ri�delattr)rOrarrr�__delattr__s
z_LazyModule.__delattr__N)rC�
__module__�__qualname__�__doc__rirkrrrrrV�s#rVc@s@eZdZdZedd��Zedd��Zdd�Zdd	�Z	d
d�Z
dS)
�
LazyLoaderzKA loader that creates a module which defers loading until attribute access.cCst|d�std��dS)Nr_z loader must define exec_module())rD�	TypeError)r^rrr�__check_eager_loaders
zLazyLoader.__check_eager_loadercs������fdd�S)z>Construct a callable which returns the eager loader made lazy.cs��||��S�Nr)rErF��clsr^rr�<lambda>�z$LazyLoader.factory.<locals>.<lambda>)�_LazyLoader__check_eager_loaderrsrrsr�factorys
zLazyLoader.factorycCs|�|�||_dSrr)rwr^)rOr^rrr�__init__s
zLazyLoader.__init__cCs|j�|�Srr)r^�
create_module)rOr&rrrrzszLazyLoader.create_modulecCs@|j|j_|j|_i}|j��|d<|j|d<||j_t|_dS)zMake the module load lazily.rWrXN)r^r!rNrW�copyrXr[rV)rOr%r[rrrr_ s

zLazyLoader.exec_moduleN)rCrlrmrn�staticmethodrw�classmethodrxryrzr_rrrrro
s

ro)N)N)"rn�r�
_bootstraprrrr�_bootstrap_externalrrr	r
rr�
contextlibrrrKrrYr?rrr'r2r9rMrQrUrZrV�Loaderrorrrr�<module>s8

-
'/__pycache__/machinery.cpython-38.opt-2.pyc000064400000001470150327175520014334 0ustar00U

e5dL�@s�ddlZddlmZddlmZddlmZddlmZmZmZm	Z	m
Z
ddlmZddlmZdd	lm
Z
dd
lmZddlmZddlmZd
d�ZdS)�N�)�
ModuleSpec)�BuiltinImporter)�FrozenImporter)�SOURCE_SUFFIXES�DEBUG_BYTECODE_SUFFIXES�OPTIMIZED_BYTECODE_SUFFIXES�BYTECODE_SUFFIXES�EXTENSION_SUFFIXES)�WindowsRegistryFinder)�
PathFinder)�
FileFinder)�SourceFileLoader)�SourcelessFileLoader)�ExtensionFileLoadercCstttS)N)rr	r
�rr�+/usr/lib64/python3.8/importlib/machinery.py�all_suffixessr)�_imp�
_bootstraprrr�_bootstrap_externalrrrr	r
rrr
rrrrrrrr�<module>s__pycache__/metadata.cpython-38.pyc000064400000050620150327175520013176 0ustar00U

e5d�D�
@s�ddlZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlmZddlmZddlmZddlmZddlmZddd	d
ddd
dddg
ZGdd	�d	e�ZGdd�de
�dd��ZGdd�dej�ZGdd�d�ZGdd�d�ZGdd�de�Z Gdd�d�Z!Gdd�d�Z"Gd d!�d!e �Z#Gd"d#�d#e�Z$d$d
�Z%d%d�Z&d&d�Z'd'd�Z(d(d�Z)d)d
�Z*d*d�Z+dS)+�N)�ConfigParser)�suppress)�
import_module)�MetaPathFinder)�starmap�Distribution�DistributionFinder�PackageNotFoundError�distribution�
distributions�entry_points�files�metadata�requires�versionc@seZdZdZdS)r	zThe package was not found.N)�__name__�
__module__�__qualname__�__doc__�rr�*/usr/lib64/python3.8/importlib/metadata.pyr	%sc@sVeZdZdZe�d�Zdd�Zedd��Z	e
dd��Ze
d	d
��Zdd�Z
d
d�ZdS)�
EntryPointz�An entry point as defined by Python packaging conventions.

    See `the packaging docs on entry points
    <https://packaging.python.org/specifications/entry-points/>`_
    for more information.
    zH(?P<module>[\w.]+)\s*(:\s*(?P<attr>[\w.]+)\s*)?((?P<extras>\[.*\])\s*)?$cCsD|j�|j�}t|�d��}td|�d�p,d�d��}t�t	||�S)z�Load the entry point from its definition. If only a module
        is indicated by the value, return that module. Otherwise,
        return the named object.
        �moduleN�attr��.)
�pattern�match�valuer�group�filter�split�	functools�reduce�getattr)�selfrr�attrsrrr�loadGszEntryPoint.loadcCs(|j�|j�}tt�d|�d�p"d��S)Nz\w+�extrasr)rrr�list�re�finditerr)r%rrrrr(QszEntryPoint.extrascs��fdd����D�S)Ncs,g|]$}��|�D]\}}�|||��qqSr��items)�.0r�namer��cls�configrr�
<listcomp>Xs�z+EntryPoint._from_config.<locals>.<listcomp>)�sectionsr0rr0r�_from_configVs�zEntryPoint._from_configcCsNtdd�}t|_z|�|�Wn$tk
rB|�t�|��YnXt�	|�S)N�=)Z
delimiters)
r�strZoptionxformZread_string�AttributeErrorZreadfp�io�StringIOrr5)r1�textr2rrr�
_from_text^s
zEntryPoint._from_textcCst|j|f�S)zO
        Supply iter so one may construct dicts of EntryPoints easily.
        )�iterr/�r%rrr�__iter__jszEntryPoint.__iter__cCs|j|j|j|jffS�N)�	__class__r/rrr>rrr�
__reduce__ps�zEntryPoint.__reduce__N)rrrrr*�compilerr'�propertyr(�classmethodr5r<r?rBrrrrr)s�



rZEntryPointBasezname value groupc@s*eZdZdZd
dd�Zdd�Zdd�Zd	S)�PackagePathz"A reference to a path in a package�utf-8c
Cs0|��j|d��}|��W5QR�SQRXdS)N��encoding��locate�open�read)r%rI�streamrrr�	read_textzszPackagePath.read_textc
Cs.|���d��}|��W5QR�SQRXdS)N�rbrJ)r%rNrrr�read_binary~szPackagePath.read_binarycCs|j�|�S)z'Return a path-like object for this path)�dist�locate_filer>rrrrK�szPackagePath.locateN)rG)rrrrrOrQrKrrrrrFws
rFc@seZdZdd�Zdd�ZdS)�FileHashcCs|�d�\|_}|_dS)Nr6)�	partition�moder)r%�spec�_rrr�__init__�szFileHash.__init__cCsd�|j|j�S)Nz<FileHash mode: {} value: {}>)�formatrVrr>rrr�__repr__�szFileHash.__repr__N)rrrrYr[rrrrrT�srTc@s�eZdZdZejdd��Zejdd��Zedd��Z	edd	��Z
ed
d��Zedd
��Z
edd��Zedd��Zedd��Zedd��Zdd�Zdd�Zedd��Zdd�Zdd�Zed d!��Zed"d#��Zed$d%��Zd&S)'rzA Python distribution package.cCsdS)z�Attempt to load metadata file given by the name.

        :param filename: The name of the file in the distribution info.
        :return: The text if found, otherwise None.
        Nr�r%�filenamerrrrO�szDistribution.read_textcCsdS)z[
        Given a path to a file in this distribution, return a path
        to it.
        Nr�r%�pathrrrrS�szDistribution.locate_filecCsD|��D].}|tj|d��}t|d�}|dk	r|Sqt|��dS)afReturn the Distribution for the given package name.

        :param name: The name of the distribution package to search for.
        :return: The Distribution instance (or subclass thereof) for the named
            package, if found.
        :raises PackageNotFoundError: When the named package's distribution
            metadata cannot be found.
        �r/N)�_discover_resolversr�Context�nextr	)r1r/�resolverZdistsrRrrr�	from_name�s


zDistribution.from_namecsJ|�dd���r|rtd���p*tjf|��tj��fdd�|��D��S)aReturn an iterable of Distribution objects for all packages.

        Pass a ``context`` or pass keyword arguments for constructing
        a context.

        :context: A ``DistributionFinder.Context`` object.
        :return: Iterable of Distribution objects for all packages.
        �contextNz cannot accept context and kwargsc3s|]}|��VqdSr@r)r.rd�rfrr�	<genexpr>�s�z(Distribution.discover.<locals>.<genexpr>)�pop�
ValueErrorrrb�	itertools�chain�
from_iterablera)r1�kwargsrrgr�discover�s
�zDistribution.discovercCstt�|��S)z�Return a Distribution for the indicated metadata path

        :param path: a string or path-like object
        :return: a concrete Distribution instance for the path
        )�PathDistribution�pathlib�Path)r_rrr�at�szDistribution.atcCsdd�tjD�}td|�S)z#Search the meta_path for resolvers.css|]}t|dd�VqdS)�find_distributionsN)r$)r.�finderrrrrh�s�z3Distribution._discover_resolvers.<locals>.<genexpr>N)�sys�	meta_pathr )Zdeclaredrrrra�s�z Distribution._discover_resolverscCs(|�d�p|�d�p|�d�}t�|�S)z�Return the parsed metadata for this Distribution.

        The returned object will have keys that name the various bits of
        metadata.  See PEP 566 for details.
        ZMETADATAzPKG-INFOr)rO�emailZmessage_from_string�r%r;rrrr�s
��zDistribution.metadatacCs
|jdS)z;Return the 'Version' metadata for the distribution package.ZVersion)rr>rrrr�szDistribution.versioncCst�|�d��S)Nzentry_points.txt)rr<rOr>rrrr�szDistribution.entry_pointscs6���p���}d�fdd�	}|o4tt|t�|���S)aBFiles in this distribution.

        :return: List of PackagePath for this distribution or None

        Result is `None` if the metadata file that enumerates files
        (i.e. RECORD for dist-info or SOURCES.txt for egg-info) is
        missing.
        Result may be empty if the metadata exists but is empty.
        Ncs6t|�}|rt|�nd|_|r&t|�nd|_�|_|Sr@)rFrT�hash�int�sizerR)r/rzZsize_str�resultr>rr�	make_file�s
z%Distribution.files.<locals>.make_file)NN)�_read_files_distinfo�_read_files_egginfor)r�csv�reader)r%Z
file_linesr~rr>rr
�szDistribution.filescCs|�d�}|o|��S)z*
        Read the lines of RECORD
        ZRECORD)rO�
splitlinesryrrrrs
z!Distribution._read_files_distinfocCs|�d�}|otdj|���S)z`
        SOURCES.txt might contain literal commas, so wrap each line
        in quotes.
        zSOURCES.txtz"{}")rO�maprZr�ryrrrr�s
z Distribution._read_files_egginfocCs|��p|��}|ot|�S)z6Generated requirements specified for this Distribution)�_read_dist_info_reqs�_read_egg_info_reqsr))r%ZreqsrrrrszDistribution.requirescCs|j�d�S)Nz
Requires-Dist)rZget_allr>rrrr�sz!Distribution._read_dist_info_reqscCs|�d�}|o|�|�S)Nzrequires.txt)rO�_deps_from_requires_text)r%�sourcerrrr� s
z Distribution._read_egg_info_reqscCs4|�|���}dd�t�|t�d��D�}|�|�S)NcSs&i|]\}}|ttt�d�|���qS)�line)r)r��operator�
itemgetter)r.�sectionZresultsrrr�
<dictcomp>'s�z9Distribution._deps_from_requires_text.<locals>.<dictcomp>r�)�_read_sectionsr�rk�groupbyr�r��%_convert_egg_info_reqs_to_simple_reqs)r1r�Z
section_pairsr4rrrr�$s
�z%Distribution._deps_from_requires_textccs<d}td|�D](}t�d|�}|r.|�d�}qt�VqdS)Nz	\[(.*)\]$�)r r*rr�locals)�linesr�r�Z
section_matchrrrr�.s
zDistribution._read_sectionsc#sBdd���fdd�}|��D] \}}|D]}|||�Vq(qdS)a�
        Historically, setuptools would solicit and store 'extra'
        requirements, including those with environment markers,
        in separate sections. More modern tools expect each
        dependency to be defined separately, with any relevant
        extras and environment markers attached directly to that
        requirement. This method converts the former to the
        latter. See _test_deps_from_requires_text for an example.
        cSs|odj|d�S)Nzextra == "{name}"r`)rZr`rrr�make_conditionCszJDistribution._convert_egg_info_reqs_to_simple_reqs.<locals>.make_conditioncsX|pd}|�d�\}}}|r,|r,dj|d�}ttd|�|�g��}|rTdd�|�SdS)Nr�:z({markers}))�markersz; z and )rUrZr)r �join)r�Zextra�sepr�Z
conditions�r�rr�parse_conditionFszKDistribution._convert_egg_info_reqs_to_simple_reqs.<locals>.parse_conditionNr,)r4r�r�ZdepsZdeprr�rr�8s
z2Distribution._convert_egg_info_reqs_to_simple_reqsN)rrrr�abc�abstractmethodrOrSrErero�staticmethodrsrarDrrrr
rr�rr�r�r�r�r�rrrrr�sB











	
	c@s2eZdZdZGdd�d�Zeje�fdd��ZdS)rzJ
    A MetaPathFinder capable of discovering installed distributions.
    c@s(eZdZdZdZdd�Zedd��ZdS)zDistributionFinder.Contextaw
        Keyword arguments presented by the caller to
        ``distributions()`` or ``Distribution.discover()``
        to narrow the scope of a search for distributions
        in all DistributionFinders.

        Each DistributionFinder may expect any parameters
        and should attempt to honor the canonical
        parameters defined below when appropriate.
        NcKst|��|�dSr@)�vars�update)r%rnrrrrYjsz#DistributionFinder.Context.__init__cCst|��dtj�S)z�
            The path that a distribution finder should search.

            Typically refers to Python package paths and defaults
            to ``sys.path``.
            r_)r��getrvr_r>rrrr_mszDistributionFinder.Context.path)rrrrr/rYrDr_rrrrrbXs
rbcCsdS)z�
        Find distributions.

        Return an iterable of all Distribution instances capable of
        loading the metadata for packages matching the ``context``,
        a DistributionFinder.Context instance.
        Nr)r%rfrrrrtwsz%DistributionFinder.find_distributionsN)rrrrrbr�r�rtrrrrrSsc@s@eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dS)�FastPathzF
    Micro-optimized class for searching a path for
    children.
    cCs||_tj�|���|_dSr@)�root�osr_�basename�lower�base)r%r�rrrrY�szFastPath.__init__cCst�|j|�Sr@)rqrrr�)r%�childrrr�joinpath�szFastPath.joinpathc
CsTtt��t�|jpd�W5QR�SQRXtt��|��W5QR�SQRXgS)Nr)r�	Exceptionr��listdirr��zip_childrenr>rrr�children�s

"
zFastPath.childrencCs2t�|j�}|j��}|j|_t�dd�|D��S)Ncss |]}|�tjd�dVqdS)r�rN)r!�	posixpathr�)r.r�rrrrh�s�z(FastPath.zip_children.<locals>.<genexpr>)�zipfilerrr�Znamelistr��dict�fromkeys)r%Zzip_path�namesrrrr��s

�zFastPath.zip_childrencCs&|j}||jkp$|�|j�o$|�d�S)N�.egg)r��versionless_egg_name�
startswith�prefix�endswith)r%�searchr�rrr�is_egg�s

�zFastPath.is_eggccsZ|��D]L}|��}||jksH|�|j�r6|�|j�sH|�|�r|dkr|�|�VqdS)Nzegg-info)	r�r��
exact_matchesr�r�r��suffixesr�r�)r%r/r�Zn_lowrrrr��s

�
���zFastPath.searchN)
rrrrrYr�r�r�r�r�rrrrr��s
r�c@s6eZdZdZdZdZdZdgdd�ZdZdd�Z	dS)�PreparedzE
    A prepared search for metadata on a possibly-named package.
    r)z
.dist-infoz	.egg-infoNrcsV|�_|dkrdS|���dd��_�jd�_�fdd��jD��_�jd�_dS)N�-rXcsg|]}�j|�qSr)�
normalized)r.�suffixr>rrr3�sz%Prepared.__init__.<locals>.<listcomp>r�)r/r��replacer�r�r�r�r�)r%r/rr>rrY�s
�zPrepared.__init__)
rrrrr�r�r�r�r�rYrrrrr��sr�c@s,eZdZee��fdd��Zedd��ZdS)�MetadataPathFindercCs|�|j|j�}tt|�S)a 
        Find distributions.

        Return an iterable of all Distribution instances capable of
        loading the metadata for packages matching ``context.name``
        (or all names if ``None`` indicated) along the paths in the list
        of directories ``context.path``.
        )�
_search_pathsr/r_r�rp)r1rf�foundrrrrt�s
z%MetadataPathFinder.find_distributionscs tj��fdd�tt|�D��S)z1Find metadata directories in paths heuristically.c3s|]}|�t���VqdSr@)r�r�)r.r_r`rrrh�s�z3MetadataPathFinder._search_paths.<locals>.<genexpr>)rkrlrmr�r�)r1r/�pathsrr`rr��s�z MetadataPathFinder._search_pathsN)rrrrErrbrtr�rrrrr��sr�c@s.eZdZdd�Zdd�Zejje_dd�ZdS)rpcCs
||_dS)z�Construct a distribution from a path to the metadata directory.

        :param path: A pathlib.Path or similar object supporting
                     .joinpath(), __div__, .parent, and .read_text().
        N)�_pathr^rrrrY�szPathDistribution.__init__c
Cs<tttttt��"|j�|�jdd�W5QR�SQRXdS)NrGrH)	r�FileNotFoundError�IsADirectoryError�KeyError�NotADirectoryError�PermissionErrorr�r�rOr\rrrrO�s
�zPathDistribution.read_textcCs|jj|Sr@)r��parentr^rrrrS�szPathDistribution.locate_fileN)rrrrYrOrrrSrrrrrp�s
rpcCs
t�|�S)z�Get the ``Distribution`` instance for the named package.

    :param distribution_name: The name of the distribution package as a string.
    :return: A ``Distribution`` instance (or subclass thereof).
    )rre�Zdistribution_namerrrr
�scKstjf|�S)z|Get all ``Distribution`` instances in the current environment.

    :return: An iterable of ``Distribution`` instances.
    )rro)rnrrrr�scCst�|�jS)z�Get the metadata for the named package.

    :param distribution_name: The name of the distribution package to query.
    :return: An email.Message containing the parsed metadata.
    )rrerr�rrrrscCs
t|�jS)z�Get the version string for the named package.

    :param distribution_name: The name of the distribution package to query.
    :return: The version string for the package as defined in the package's
        "Version" metadata key.
    )r
rr�rrrrscCsHtj�dd�t�D��}t�d�}t||d�}t�||�}dd�|D�S)zwReturn EntryPoint objects for all installed packages.

    :return: EntryPoint objects for all installed packages.
    css|]}|jVqdSr@)r)r.rRrrrrhszentry_points.<locals>.<genexpr>r)�keycSsi|]\}}|t|��qSr)�tuple)r.r�epsrrrr�s�z entry_points.<locals>.<dictcomp>)rkrlrmrr��
attrgetter�sortedr�)r�Zby_groupZorderedZgroupedrrrrs�
�cCs
t|�jS)z�Return a list of files for the named package.

    :param distribution_name: The name of the distribution package to query.
    :return: List of files composing the distribution.
    )r
r
r�rrrr
%scCs
t|�jS)z�
    Return a list of requirements for the named package.

    :return: An iterator of requirements, suitable for
    packaging.requirement.Requirement.
    )r
rr�rrrr.s),r9r�r*r�r�rvrxrqr�r�r"rkr��collectionsZconfigparserr�
contextlibr�	importlibr�
importlib.abcrr�__all__�ModuleNotFoundErrorr	�
namedtuplerZ
PurePosixPathrFrTrrr�r�r�rpr
rrrrr
rrrrr�<module>sb�

�NE/0		
	__pycache__/_bootstrap.cpython-38.pyc000064400000067677150327175520013616 0ustar00U

e5dܚ�@s�dZdadd�Zdd�ZiZiZGdd�de�ZGdd	�d	�ZGd
d�d�Z	Gdd
�d
�Z
dd�Zdd�Zdd�Z
dd�dd�Zdd�Zdd�Zdd�Zdd�ZGd d!�d!�Zddd"�d#d$�Zd^d%d&�Zd'd(�d)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�ZGd7d8�d8�ZGd9d:�d:�ZGd;d<�d<�Zd=d>�Z d?d@�Z!d_dAdB�Z"dCdD�Z#dEZ$e$dFZ%dGdH�Z&e'�Z(dIdJ�Z)d`dLdM�Z*d'dN�dOdP�Z+dQdR�Z,dadTdU�Z-dVdW�Z.dXdY�Z/dZd[�Z0d\d]�Z1dS)baSCore implementation of import.

This module is NOT meant to be directly imported! It has been designed such
that it can be bootstrapped into Python as the implementation of import. As
such it requires the injection of specific modules and attributes in order to
work. One should use importlib as the public-facing version of this module.

NcCs8dD] }t||�rt||t||��q|j�|j�dS)z/Simple substitute for functools.update_wrapper.)�
__module__�__name__�__qualname__�__doc__N)�hasattr�setattr�getattr�__dict__�update)�new�old�replace�r
�,/usr/lib64/python3.8/importlib/_bootstrap.py�_wraps
rcCstt�|�S�N)�type�sys��namer
r
r�_new_module#src@seZdZdS)�_DeadlockErrorN)rrrr
r
r
rr0src@s8eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
�_ModuleLockz�A recursive lock implementation which is able to detect deadlocks
    (e.g. thread 1 trying to take locks A then B, and thread 2 trying to
    take locks B then A).
    cCs0t��|_t��|_||_d|_d|_d|_dS�N�)�_thread�
allocate_lock�lock�wakeupr�owner�count�waiters��selfrr
r
r�__init__:s

z_ModuleLock.__init__cCs<t��}|j}t�|�}|dkr$dS|j}||krdSqdS)NFT)r�	get_identr�_blocking_on�get)r"�me�tidrr
r
r�has_deadlockBs
z_ModuleLock.has_deadlockc	Cs�t��}|t|<z�|j�n|jdks.|j|krT||_|jd7_W5QR�W�VdS|��rhtd|��|j�	d�r�|j
d7_
W5QRX|j�	�|j��qW5t|=XdS)z�
        Acquire the module lock.  If a potential deadlock is detected,
        a _DeadlockError is raised.
        Otherwise, the lock is always acquired and True is returned.
        r�Tzdeadlock detected by %rFN)rr$r%rrrr)rr�acquirer �release�r"r(r
r
rr+Ns
z_ModuleLock.acquirec	Cszt��}|j�b|j|kr"td��|jdks0t�|jd8_|jdkrld|_|jrl|jd8_|j�	�W5QRXdS)N�cannot release un-acquired lockrr*)
rr$rr�RuntimeErrorr�AssertionErrorr rr,r-r
r
rr,gs

z_ModuleLock.releasecCsd�|jt|��S)Nz_ModuleLock({!r}) at {}��formatr�id�r"r
r
r�__repr__tsz_ModuleLock.__repr__N)	rrrrr#r)r+r,r5r
r
r
rr4s
rc@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�_DummyModuleLockzVA simple _ModuleLock equivalent for Python builds without
    multi-threading support.cCs||_d|_dSr)rrr!r
r
rr#|sz_DummyModuleLock.__init__cCs|jd7_dS)Nr*T)rr4r
r
rr+�sz_DummyModuleLock.acquirecCs$|jdkrtd��|jd8_dS)Nrr.r*)rr/r4r
r
rr,�s
z_DummyModuleLock.releasecCsd�|jt|��S)Nz_DummyModuleLock({!r}) at {}r1r4r
r
rr5�sz_DummyModuleLock.__repr__N)rrrrr#r+r,r5r
r
r
rr6xs
r6c@s$eZdZdd�Zdd�Zdd�ZdS)�_ModuleLockManagercCs||_d|_dSr)�_name�_lockr!r
r
rr#�sz_ModuleLockManager.__init__cCst|j�|_|j��dSr)�_get_module_lockr8r9r+r4r
r
r�	__enter__�sz_ModuleLockManager.__enter__cOs|j��dSr)r9r,)r"�args�kwargsr
r
r�__exit__�sz_ModuleLockManager.__exit__N)rrrr#r;r>r
r
r
rr7�sr7cCs�t��zjzt|�}Wntk
r0d}YnX|dkrptdkrLt|�}nt|�}|fdd�}t�	||�t|<W5t��X|S)z�Get or create the module lock for a given module name.

    Acquire/release internally the global import lock to protect
    _module_locks.NcSs0t��zt�|�|krt|=W5t��XdSr)�_imp�acquire_lock�release_lock�
_module_locksr&)�refrr
r
r�cb�s

z_get_module_lock.<locals>.cb)
r?r@rArB�KeyErrorrr6r�_weakrefrC)rrrDr
r
rr:�s


r:cCs6t|�}z|��Wntk
r(Yn
X|��dS)z�Acquires then releases the module lock for a given module name.

    This is used to ensure a module is completely initialized, in the
    event it is being imported by another thread.
    N)r:r+rr,)rrr
r
r�_lock_unlock_module�srGcOs
|||�S)a.remove_importlib_frames in import.c will always remove sequences
    of importlib frames that end with a call to this function

    Use it instead of a normal call in places where including the importlib
    frames introduces unwanted noise into the traceback (e.g. when executing
    module code)
    r
)�fr<�kwdsr
r
r�_call_with_frames_removed�srJr*)�	verbositycGs6tjj|kr2|�d�sd|}t|j|�tjd�dS)z=Print the message to stderr if -v/PYTHONVERBOSE is turned on.)�#zimport z# )�fileN)r�flags�verbose�
startswith�printr2�stderr)�messagerKr<r
r
r�_verbose_message�s
rTcs�fdd�}t|��|S)z1Decorator to verify the named module is built-in.cs&|tjkrtd�|�|d���||�S)N�{!r} is not a built-in moduler)r�builtin_module_names�ImportErrorr2�r"�fullname��fxnr
r�_requires_builtin_wrapper�s


�z4_requires_builtin.<locals>._requires_builtin_wrapper�r)r[r\r
rZr�_requires_builtin�s
r^cs�fdd�}t|��|S)z/Decorator to verify the named module is frozen.cs&t�|�std�|�|d���||�S�Nz{!r} is not a frozen moduler)r?�	is_frozenrWr2rXrZr
r�_requires_frozen_wrapper�s


�z2_requires_frozen.<locals>._requires_frozen_wrapperr])r[rar
rZr�_requires_frozen�s
rbcCs>t||�}|tjkr2tj|}t||�tj|St|�SdS)z�Load the specified module into sys.modules and return it.

    This method is deprecated.  Use loader.exec_module instead.

    N)�spec_from_loaderr�modules�_exec�_load)r"rY�spec�moduler
r
r�_load_module_shim�s




ricCs�t|dd�}t|d�r8z|�|�WStk
r6YnXz
|j}Wntk
rVYnX|dk	rht|�Sz
|j}Wntk
r�d}YnXz
|j}Wn:tk
r�|dkr�d�	|�YSd�	||�YSYnXd�	||�SdS)N�
__loader__�module_repr�?�
<module {!r}>�<module {!r} ({!r})>�<module {!r} from {!r}>)
rrrk�	Exception�__spec__�AttributeError�_module_repr_from_specr�__file__r2)rh�loaderrgr�filenamer
r
r�_module_repr
s.




rwc@sreZdZdZdddd�dd�Zdd�Zdd	�Zed
d��Zej	dd��Zed
d��Z
edd��Zej	dd��ZdS)�
ModuleSpeca�The specification for a module, used for loading.

    A module's spec is the source for information about the module.  For
    data associated with the module, including source, use the spec's
    loader.

    `name` is the absolute name of the module.  `loader` is the loader
    to use when loading the module.  `parent` is the name of the
    package the module is in.  The parent is derived from the name.

    `is_package` determines if the module is considered a package or
    not.  On modules this is reflected by the `__path__` attribute.

    `origin` is the specific location used by the loader from which to
    load the module, if that information is available.  When filename is
    set, origin will match.

    `has_location` indicates that a spec's "origin" reflects a location.
    When this is True, `__file__` attribute of the module is set.

    `cached` is the location of the cached bytecode file, if any.  It
    corresponds to the `__cached__` attribute.

    `submodule_search_locations` is the sequence of path entries to
    search when importing submodules.  If set, is_package should be
    True--and False otherwise.

    Packages are simply modules that (may) have submodules.  If a spec
    has a non-None value in `submodule_search_locations`, the import
    system will consider modules loaded from the spec as packages.

    Only finders (see importlib.abc.MetaPathFinder and
    importlib.abc.PathEntryFinder) should modify ModuleSpec instances.

    N)�origin�loader_state�
is_packagecCs6||_||_||_||_|r gnd|_d|_d|_dS�NF)rruryrz�submodule_search_locations�
_set_fileattr�_cached)r"rruryrzr{r
r
rr#VszModuleSpec.__init__cCsfd�|j�d�|j�g}|jdk	r4|�d�|j��|jdk	rP|�d�|j��d�|jjd�|��S)Nz	name={!r}zloader={!r}zorigin={!r}zsubmodule_search_locations={}z{}({})z, )	r2rrury�appendr}�	__class__r�join)r"r<r
r
rr5bs

�

�zModuleSpec.__repr__cCsj|j}zH|j|jkoL|j|jkoL|j|jkoL||jkoL|j|jkoL|j|jkWStk
rdYdSXdSr|)r}rrury�cached�has_locationrr)r"�other�smslr
r
r�__eq__ls
�
��
�
�zModuleSpec.__eq__cCs:|jdkr4|jdk	r4|jr4tdkr&t�t�|j�|_|jSr)rryr~�_bootstrap_external�NotImplementedError�_get_cachedr4r
r
rr�xs
zModuleSpec.cachedcCs
||_dSr)r)r"r�r
r
rr��scCs$|jdkr|j�d�dS|jSdS)z The name of the module's parent.N�.r)r}r�
rpartitionr4r
r
r�parent�s
zModuleSpec.parentcCs|jSr)r~r4r
r
rr��szModuleSpec.has_locationcCst|�|_dSr)�boolr~)r"�valuer
r
rr��s)rrrrr#r5r��propertyr��setterr�r�r
r
r
rrx1s $�




rx�ryr{cCs�t|d�rJtdkrt�tj}|dkr0|||d�S|r8gnd}||||d�S|dkr�t|d�r�z|�|�}Wq�tk
r�d}Yq�Xnd}t||||d�S)z5Return a module spec based on various loader methods.�get_filenameN)ru)rur}r{Fr�)rr�r��spec_from_file_locationr{rWrx)rruryr{r��searchr
r
rrc�s$
�
rccCs8z
|j}Wntk
rYnX|dk	r,|S|j}|dkrZz
|j}Wntk
rXYnXz
|j}Wntk
r|d}YnX|dkr�|dkr�z
|j}Wq�tk
r�d}Yq�Xn|}z
|j}Wntk
r�d}YnXzt|j�}Wntk
�rd}YnXt	|||d�}|dk�r"dnd|_
||_||_|S)N�ryFT)
rqrrrrjrt�_ORIGIN�
__cached__�list�__path__rxr~r�r})rhruryrgr�locationr�r}r
r
r�_spec_from_module�sH







r�F��overridecCs�|st|dd�dkr6z|j|_Wntk
r4YnX|sJt|dd�dkr�|j}|dkr�|jdk	r�tdkrnt�tj}|�	|�}|j|_
||_d|_z
||_Wntk
r�YnX|s�t|dd�dkr�z|j
|_Wntk
r�YnXz
||_Wntk
�rYnX|�s"t|dd�dk�rR|jdk	�rRz|j|_Wntk
�rPYnX|j�r�|�srt|dd�dk�r�z|j|_Wntk
�r�YnX|�s�t|dd�dk�r�|jdk	�r�z|j|_Wntk
�r�YnX|S)Nrrj�__package__r�rtr�)rrrrrrur}r�r��_NamespaceLoader�__new__�_pathrtrjr�r�rqr�r�ryr�r�)rgrhr�rur�r
r
r�_init_module_attrs�s`



r�cCsRd}t|jd�r|j�|�}nt|jd�r2td��|dkrDt|j�}t||�|S)z+Create a module based on the provided spec.N�
create_module�exec_modulezBloaders that define exec_module() must also define create_module())rrur�rWrrr��rgrhr
r
r�module_from_spec%s

r�cCsj|jdkrdn|j}|jdkrB|jdkr2d�|�Sd�||j�Sn$|jrVd�||j�Sd�|j|j�SdS)z&Return the repr to use for the module.Nrlrmrnro�<module {!r} ({})>)rryrur2r�)rgrr
r
rrs6s


rsc
Cs�|j}t|���tj�|�|k	r6d�|�}t||d��zj|jdkrj|j	dkrZtd|jd��t
||dd�n4t
||dd�t|jd�s�|j�|�n|j�
|�W5tj�|j�}|tj|j<XW5QRX|S)zFExecute the spec's specified module in an existing module's namespace.zmodule {!r} not in sys.modulesrN�missing loaderTr�r�)rr7rrdr&r2rW�poprur}r�r�load_moduler�)rgrhr�msgr
r
rreGs"



recCsz|j�|j�Wn4|jtjkr@tj�|j�}|tj|j<�YnXtj�|j�}|tj|j<t|dd�dkr�z|j|_Wntk
r�YnXt|dd�dkr�z(|j	|_
t|d�s�|j�d�d|_
Wntk
r�YnXt|dd�dk�rz
||_
Wntk
�rYnX|S)Nrjr�r�r�rrq)rur�rrrdr�rrjrrrr�rr�rqr�r
r
r�_load_backward_compatiblees6

r�cCs�|jdk	rt|jd�st|�St|�}d|_z�|tj|j<z4|jdkr`|jdkrlt	d|jd��n|j�
|�Wn2ztj|j=Wntk
r�YnX�YnXtj�|j�}|tj|j<t
d|j|j�W5d|_X|S)Nr�TFr�rzimport {!r} # {!r})rurr�r��
_initializingrrdrr}rWr�rEr�rTr�r
r
r�_load_unlocked�s.


r�c
Cs*t|j��t|�W5QR�SQRXdS)z�Return a new module object, loaded by the spec's loader.

    The module is not added to its parent.

    If a module is already in sys.modules, that existing module gets
    clobbered.

    N)r7rr�)rgr
r
rrf�s	rfc@s�eZdZdZedd��Zeddd��Zeddd��Zed	d
��Z	edd��Z
eed
d���Zeedd���Z
eedd���Zee�ZdS)�BuiltinImporterz�Meta path import for built-in modules.

    All methods are either class or static methods to avoid the need to
    instantiate the class.

    cCsd�|j�S)�sReturn repr for the module.

        The method is deprecated.  The import machinery does the job itself.

        z<module {!r} (built-in)>)r2r)rhr
r
rrk�szBuiltinImporter.module_reprNcCs,|dk	rdSt�|�r$t||dd�SdSdS)Nzbuilt-inr�)r?�
is_builtinrc��clsrY�path�targetr
r
r�	find_spec�s

zBuiltinImporter.find_speccCs|�||�}|dk	r|jSdS)z�Find the built-in module.

        If 'path' is ever specified then the search is considered a failure.

        This method is deprecated.  Use find_spec() instead.

        N)r�ru)r�rYr�rgr
r
r�find_module�s	zBuiltinImporter.find_modulecCs.|jtjkr"td�|j�|jd��ttj|�S)zCreate a built-in modulerUr)rrrVrWr2rJr?�create_builtin)r"rgr
r
rr��s
�zBuiltinImporter.create_modulecCsttj|�dS)zExec a built-in moduleN)rJr?�exec_builtin)r"rhr
r
rr��szBuiltinImporter.exec_modulecCsdS)z9Return None as built-in modules do not have code objects.Nr
�r�rYr
r
r�get_code�szBuiltinImporter.get_codecCsdS)z8Return None as built-in modules do not have source code.Nr
r�r
r
r�
get_source�szBuiltinImporter.get_sourcecCsdS)z4Return False as built-in modules are never packages.Fr
r�r
r
rr{szBuiltinImporter.is_package)NN)N)rrrr�staticmethodrk�classmethodr�r�r�r�r^r�r�r{rir�r
r
r
rr��s*


r�c@s�eZdZdZdZedd��Zeddd��Zeddd	��Z	ed
d��Z
edd
��Zedd��Zee
dd���Zee
dd���Zee
dd���ZdS)�FrozenImporterz�Meta path import for frozen modules.

    All methods are either class or static methods to avoid the need to
    instantiate the class.

    �frozencCsd�|jtj�S)r�r�)r2rr�r�)�mr
r
rrkszFrozenImporter.module_reprNcCs"t�|�rt|||jd�SdSdS)Nr�)r?r`rcr�r�r
r
rr� s
zFrozenImporter.find_speccCst�|�r|SdS)z]Find a frozen module.

        This method is deprecated.  Use find_spec() instead.

        N)r?r`)r�rYr�r
r
rr�'szFrozenImporter.find_modulecCsdS)z*Use default semantics for module creation.Nr
)r�rgr
r
rr�0szFrozenImporter.create_modulecCs@|jj}t�|�s$td�|�|d��ttj|�}t||j	�dSr_)
rqrr?r`rWr2rJ�get_frozen_object�execr)rhr�coder
r
rr�4s

�zFrozenImporter.exec_modulecCs
t||�S)z_Load a frozen module.

        This method is deprecated.  Use exec_module() instead.

        )rir�r
r
rr�=szFrozenImporter.load_modulecCs
t�|�S)z-Return the code object for the frozen module.)r?r�r�r
r
rr�FszFrozenImporter.get_codecCsdS)z6Return None as frozen modules do not have source code.Nr
r�r
r
rr�LszFrozenImporter.get_sourcecCs
t�|�S)z.Return True if the frozen module is a package.)r?�is_frozen_packager�r
r
rr{RszFrozenImporter.is_package)NN)N)rrrrr�r�rkr�r�r�r�r�r�rbr�r�r{r
r
r
rr�s.



r�c@s eZdZdZdd�Zdd�ZdS)�_ImportLockContextz$Context manager for the import lock.cCst��dS)zAcquire the import lock.N)r?r@r4r
r
rr;_sz_ImportLockContext.__enter__cCst��dS)z<Release the import lock regardless of any raised exceptions.N)r?rA)r"�exc_type�	exc_value�
exc_tracebackr
r
rr>csz_ImportLockContext.__exit__N)rrrrr;r>r
r
r
rr�[sr�cCs@|�d|d�}t|�|kr$td��|d}|r<d�||�S|S)z2Resolve a relative module name to an absolute one.r�r*z2attempted relative import beyond top-level packager�{}.{})�rsplit�len�
ValueErrorr2)r�package�level�bits�baser
r
r�
_resolve_namehs
r�cCs"|�||�}|dkrdSt||�Sr)r�rc)�finderrr�rur
r
r�_find_spec_legacyqsr�c

Cstj}|dkrtd��|s&t�dt�|tjk}|D]�}t��Tz
|j}Wn6t	k
r�t
|||�}|dkr|YW5QR�q4YnX||||�}W5QRX|dk	r4|�s�|tjk�r�tj|}z
|j}	Wnt	k
r�|YSX|	dkr�|S|	Sq4|Sq4dS)zFind a module's spec.Nz5sys.meta_path is None, Python is likely shutting downzsys.meta_path is empty)r�	meta_pathrW�	_warnings�warn�
ImportWarningrdr�r�rrr�rq)
rr�r�r��	is_reloadr�r�rgrhrqr
r
r�
_find_speczs6





r�cCslt|t�std�t|����|dkr,td��|dkrTt|t�sHtd��n|sTtd��|sh|dkrhtd��dS)zVerify arguments are "sane".zmodule name must be str, not {}rzlevel must be >= 0z__package__ not set to a stringz6attempted relative import with no known parent packagezEmpty module nameN)�
isinstance�str�	TypeErrorr2rr�rW�rr�r�r
r
r�
_sanity_check�s


r�zNo module named z{!r}cCs�d}|�d�d}|r�|tjkr*t||�|tjkr>tj|Stj|}z
|j}Wn2tk
r�td�||�}t||d�d�YnXt	||�}|dkr�tt�|�|d��nt
|�}|r�tj|}t||�d�d|�|S)Nr�rz; {!r} is not a packager�)r�rrdrJr�rr�_ERR_MSGr2�ModuleNotFoundErrorr�r�r)r�import_r�r��
parent_moduler�rgrhr
r
r�_find_and_load_unlocked�s*







r�c
Csjt|��2tj�|t�}|tkr6t||�W5QR�SW5QRX|dkr^d�|�}t||d��t|�|S)zFind and load the module.Nz(import of {} halted; None in sys.modulesr)	r7rrdr&�_NEEDS_LOADINGr�r2r�rG)rr�rhrSr
r
r�_find_and_load�s
 �r�rcCs*t|||�|dkr t|||�}t|t�S)a2Import and return the module based on its name, the package the call is
    being made from, and the level adjustment.

    This function represents the greatest common denominator of functionality
    between import_module and __import__. This includes setting __package__ if
    the loader did not.

    r)r�r�r��_gcd_importr�r
r
rr��s	r���	recursivecCs�|D]�}t|t�sB|r"|jd}nd}td|�dt|�j����q|dkrl|s�t|d�r�t||j|dd�qt||�sd	�|j|�}zt	||�Wqt
k
r�}z*|j|kr�tj
�|t�d
k	r�WY�q�W5d
}~XYqXq|S)z�Figure out what __import__ should return.

    The import_ parameter is a callable which takes the name of module to
    import. It is required to decouple the function from assuming importlib's
    import implementation is desired.

    z.__all__z
``from list''zItem in z must be str, not �*�__all__Tr�r�N)r�r�rr�rr�_handle_fromlistr�r2rJr�rrrdr&r�)rh�fromlistr�r��x�where�	from_name�excr
r
rr��s,


�

�r�cCs�|�d�}|�d�}|dk	rR|dk	rN||jkrNtjd|�d|j�d�tdd�|S|dk	r`|jStjd	tdd�|d
}d|kr�|�d�d
}|S)z�Calculate what __package__ should be.

    __package__ is not guaranteed to be defined or could be set to None
    to represent that its proper value is unknown.

    r�rqNz __package__ != __spec__.parent (z != �)�)�
stacklevelzYcan't resolve package from __spec__ or __package__, falling back on __name__ and __path__rr�r�r)r&r�r�r�r�r�)�globalsr�rgr
r
r�_calc___package__s&

��r�r
c	Cs�|dkrt|�}n$|dk	r|ni}t|�}t|||�}|s�|dkrTt|�d�d�S|s\|St|�t|�d�d�}tj|jdt|j�|�Snt|d�r�t||t�S|SdS)a�Import a module.

    The 'globals' argument is used to infer where the import is occurring from
    to handle relative imports. The 'locals' argument is ignored. The
    'fromlist' argument specifies what should exist as attributes on the module
    being imported (e.g. ``from module import <fromlist>``).  The 'level'
    argument represents the package location to import from in a relative
    import (e.g. ``from ..pkg import mod`` would have a 'level' of 2).

    rNr�r�)	r�r��	partitionr�rrdrrr�)	rr��localsr�r�rh�globals_r��cut_offr
r
r�
__import__9s
 
r�cCs&t�|�}|dkrtd|��t|�S)Nzno built-in module named )r�r�rWr�)rrgr
r
r�_builtin_from_name^s
r�c
Cs�|a|att�}tj��D]H\}}t||�r|tjkr<t}nt�|�rt	}nqt
||�}t||�qtjt}dD].}|tjkr�t
|�}	n
tj|}	t|||	�qrdS)z�Setup importlib by importing needed built-in modules and injecting them
    into the global namespace.

    As sys is needed for sys.modules access and _imp is needed to load built-in
    modules, those two modules must be explicitly passed in.

    )rr�rFN)r?rrrd�itemsr�rVr�r`r�r�r�rr�r)
�
sys_module�_imp_module�module_typerrhrurg�self_module�builtin_name�builtin_moduler
r
r�_setupes$	







rcCs&t||�tj�t�tj�t�dS)z0Install importers for builtin and frozen modulesN)rrr�r�r�r�)rrr
r
r�_install�s
rcCs ddl}|a|�tjt�dS)z9Install importers that require external filesystem accessrN)�_frozen_importlib_externalr�rrrdr)rr
r
r�_install_external_importers�sr	)NN)N)Nr)NNr
r)2rr�rrrBr%r/rrr6r7r:rGrJrTr^rbrirwrxrcr�r�r�rsrer�r�rfr�r�r�r�r�r�r��_ERR_MSG_PREFIXr�r��objectr�r�r�r�r�r�r�rrr	r
r
r
r�<module>s^D%$e
-H%*IO
		
/
%
%#__pycache__/__init__.cpython-38.opt-1.pyc000064400000007260150327175520014116 0ustar00U

e5d��@sjdZddddgZddlZddlZzddlZWn,ek
rXddlmZe�ee�Yn@Xd	e_	d
e_
ze�dd�e_Wne
k
r�YnXeejd	<zddlZWn0ek
r�dd
lmZe�e�ee_YnBXde_	d
e_
ze�dd�e_Wne
k
�r
YnXeejd<ejZejZddlZddlZddlmZdd�Zddd�Zddd�ZiZdd�ZdS)z'A pure Python implementation of import.�
__import__�
import_module�invalidate_caches�reload�N�)�
_bootstrapzimportlib._bootstrap�	importlibz__init__.pyz
_bootstrap.py)�_bootstrap_externalzimportlib._bootstrap_externalz_bootstrap_external.py)rcCs"tjD]}t|d�r|��qdS)zmCall the invalidate_caches() method on all meta path finders stored in
    sys.meta_path (where implemented).rN)�sys�	meta_path�hasattrr)�finder�r�*/usr/lib64/python3.8/importlib/__init__.pyrBs

cCs�tjdtdd�z.tj|j}|dkr6td�|���n|WSWn6tk
rRYn$t	k
rttd�|��d�YnXt
�||�}|dkr�dS|jdkr�|j
dkr�td�|�|d��td	|d��|jS)
z�Return the loader for the specified module.

    This is a backward-compatible wrapper around find_spec().

    This function is deprecated in favor of importlib.util.find_spec().

    zDDeprecated since Python 3.4. Use importlib.util.find_spec() instead.�)�
stacklevelNz{}.__loader__ is Nonez{}.__loader__ is not setzspec for {} missing loader��namez&namespace packages do not have loaders)�warnings�warn�DeprecationWarningr
�modules�
__loader__�
ValueError�format�KeyError�AttributeErrorr�
_find_spec�loader�submodule_search_locations�ImportError)r�pathr�specrrr�find_loaderJs2�



��r#cCsXd}|�d�rB|s$d}t|�|���|D]}|dkr8qB|d7}q(t�||d�||�S)z�Import a module.

    The 'package' argument is required when performing a relative import. It
    specifies the package to use as the anchor point from which to resolve the
    relative import to an absolute import.

    r�.zHthe 'package' argument is required to perform a relative import for {!r}rN)�
startswith�	TypeErrorrr�_gcd_import)r�package�level�msg�	characterrrrrms

cCsP|rt|tj�std��z|jj}Wntk
r>|j}YnXtj	�
|�|k	rfd}t|�|�|d��|t
krvt
|S|t
|<z�|�d�d}|r�ztj	|}Wn,tk
r�d}t|�|�|d�d�Yq�X|j}nd}|}t�|||�}|_|dk�rtd|��|d��t�||�tj	|W�Sz
t
|=Wntk
�rHYnXXdS)	zcReload the module and return it.

    The module must have been successfully imported before.

    z"reload() argument must be a modulezmodule {} not in sys.modulesrr$rzparent {!r} not in sys.modulesNzspec not found for the module )�
isinstance�types�
ModuleTyper&�__spec__rr�__name__r
r�getr r�
_RELOADINGr�
rpartition�__path__rr�ModuleNotFoundError�_exec)�modulerr*�parent_name�parent�pkgpath�targetr"rrrr�sH
��

)N)N)�__doc__�__all__�_impr
�_frozen_importlibrr ��_setupr0�__package__�__file__�replace�	NameErrorr�_frozen_importlib_externalr	�_pack_uint32�_unpack_uint32r-rrrr#rr2rrrrr�<module>sL




#
__pycache__/__init__.cpython-38.opt-2.pyc000064400000006011150327175520014110 0ustar00U

e5d��@sfddddgZddlZddlZzddlZWn,ek
rTddlmZe�ee�Yn@Xde_d	e_	ze
�d
d�e_
Wnek
r�YnXeej
d<zddlZWn0ek
r�ddlmZe�e�ee_YnBXd
e_d	e_	ze
�d
d�e_
Wnek
�rYnXeej
d
<ejZejZddlZddlZddlmZdd�Zddd�Zddd�ZiZdd�ZdS)�
__import__�
import_module�invalidate_caches�reload�N�)�
_bootstrapzimportlib._bootstrap�	importlibz__init__.pyz
_bootstrap.py)�_bootstrap_externalzimportlib._bootstrap_externalz_bootstrap_external.py)rcCs"tjD]}t|d�r|��qdS)Nr)�sys�	meta_path�hasattrr)�finder�r�*/usr/lib64/python3.8/importlib/__init__.pyrBs

cCs�tjdtdd�z.tj|j}|dkr6td�|���n|WSWn6tk
rRYn$t	k
rttd�|��d�YnXt
�||�}|dkr�dS|jdkr�|j
dkr�td�|�|d��td|d��|jS)	NzDDeprecated since Python 3.4. Use importlib.util.find_spec() instead.�)�
stacklevelz{}.__loader__ is Nonez{}.__loader__ is not setzspec for {} missing loader��namez&namespace packages do not have loaders)�warnings�warn�DeprecationWarningr
�modules�
__loader__�
ValueError�format�KeyError�AttributeErrorr�
_find_spec�loader�submodule_search_locations�ImportError)r�pathr�specrrr�find_loaderJs2�



��r#cCsXd}|�d�rB|s$d}t|�|���|D]}|dkr8qB|d7}q(t�||d�||�S)Nr�.zHthe 'package' argument is required to perform a relative import for {!r}r)�
startswith�	TypeErrorrr�_gcd_import)r�package�level�msg�	characterrrrrms

cCsP|rt|tj�std��z|jj}Wntk
r>|j}YnXtj	�
|�|k	rfd}t|�|�|d��|t
krvt
|S|t
|<z�|�d�d}|r�ztj	|}Wn,tk
r�d}t|�|�|d�d�Yq�X|j}nd}|}t�|||�}|_|dk�rtd|��|d��t�||�tj	|W�Sz
t
|=Wntk
�rHYnXXdS)Nz"reload() argument must be a modulezmodule {} not in sys.modulesrr$rzparent {!r} not in sys.moduleszspec not found for the module )�
isinstance�types�
ModuleTyper&�__spec__rr�__name__r
r�getr r�
_RELOADINGr�
rpartition�__path__rr�ModuleNotFoundError�_exec)�modulerr*�parent_name�parent�pkgpath�targetr"rrrr�sH
��

)N)N)�__all__�_impr
�_frozen_importlibrr ��_setupr0�__package__�__file__�replace�	NameErrorr�_frozen_importlib_externalr	�_pack_uint32�_unpack_uint32r-rrrr#rr2rrrrr�<module>sJ




#
__pycache__/_bootstrap.cpython-38.opt-2.pyc000064400000052470150327175520014537 0ustar00U

e5dܚ�@s�dadd�Zdd�ZiZiZGdd�de�ZGdd�d�ZGd	d
�d
�ZGdd�d�Z	d
d�Z
dd�Zdd�Zdd�dd�Z
dd�Zdd�Zdd�Zdd�ZGdd �d �Zddd!�d"d#�Zd]d$d%�Zd&d'�d(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�ZGd6d7�d7�ZGd8d9�d9�ZGd:d;�d;�Zd<d=�Zd>d?�Z d^d@dA�Z!dBdC�Z"dDZ#e#dEZ$dFdG�Z%e&�Z'dHdI�Z(d_dKdL�Z)d&dM�dNdO�Z*dPdQ�Z+d`dSdT�Z,dUdV�Z-dWdX�Z.dYdZ�Z/d[d\�Z0dS)aNcCs8dD] }t||�rt||t||��q|j�|j�dS)N)�
__module__�__name__�__qualname__�__doc__)�hasattr�setattr�getattr�__dict__�update)�new�old�replace�r
�,/usr/lib64/python3.8/importlib/_bootstrap.py�_wraps
rcCstt�|�S�N)�type�sys��namer
r
r�_new_module#src@seZdZdS)�_DeadlockErrorN)rrrr
r
r
rr0src@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�_ModuleLockcCs0t��|_t��|_||_d|_d|_d|_dS�N�)�_thread�
allocate_lock�lock�wakeupr�owner�count�waiters��selfrr
r
r�__init__:s

z_ModuleLock.__init__cCs<t��}|j}t�|�}|dkr$dS|j}||krdSqdS)NFT)r�	get_identr�_blocking_on�get)r"�me�tidrr
r
r�has_deadlockBs
z_ModuleLock.has_deadlockc	Cs�t��}|t|<z�|j�n|jdks.|j|krT||_|jd7_W5QR�W�VdS|��rhtd|��|j�	d�r�|j
d7_
W5QRX|j�	�|j��qW5t|=XdS)Nr�Tzdeadlock detected by %rF)rr$r%rrrr)rr�acquirer �release�r"r(r
r
rr+Ns
z_ModuleLock.acquirec	Cslt��}|j�T|j|kr"td��|jd8_|jdkr^d|_|jr^|jd8_|j��W5QRXdS)N�cannot release un-acquired lockr*r)	rr$rr�RuntimeErrorrr rr,r-r
r
rr,gs

z_ModuleLock.releasecCsd�|jt|��S)Nz_ModuleLock({!r}) at {}��formatr�id�r"r
r
r�__repr__tsz_ModuleLock.__repr__N)rrrr#r)r+r,r4r
r
r
rr4s

rc@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�_DummyModuleLockcCs||_d|_dSr)rrr!r
r
rr#|sz_DummyModuleLock.__init__cCs|jd7_dS)Nr*T)rr3r
r
rr+�sz_DummyModuleLock.acquirecCs$|jdkrtd��|jd8_dS)Nrr.r*)rr/r3r
r
rr,�s
z_DummyModuleLock.releasecCsd�|jt|��S)Nz_DummyModuleLock({!r}) at {}r0r3r
r
rr4�sz_DummyModuleLock.__repr__N)rrrr#r+r,r4r
r
r
rr5xsr5c@s$eZdZdd�Zdd�Zdd�ZdS)�_ModuleLockManagercCs||_d|_dSr)�_name�_lockr!r
r
rr#�sz_ModuleLockManager.__init__cCst|j�|_|j��dSr)�_get_module_lockr7r8r+r3r
r
r�	__enter__�sz_ModuleLockManager.__enter__cOs|j��dSr)r8r,)r"�args�kwargsr
r
r�__exit__�sz_ModuleLockManager.__exit__N)rrrr#r:r=r
r
r
rr6�sr6cCs�t��zjzt|�}Wntk
r0d}YnX|dkrptdkrLt|�}nt|�}|fdd�}t�	||�t|<W5t��X|S)NcSs0t��zt�|�|krt|=W5t��XdSr)�_imp�acquire_lock�release_lock�
_module_locksr&)�refrr
r
r�cb�s

z_get_module_lock.<locals>.cb)
r>r?r@rA�KeyErrorrr5r�_weakrefrB)rrrCr
r
rr9�s


r9cCs6t|�}z|��Wntk
r(Yn
X|��dSr)r9r+rr,)rrr
r
r�_lock_unlock_module�srFcOs
|||�Srr
)�fr;�kwdsr
r
r�_call_with_frames_removed�srIr*)�	verbositycGs6tjj|kr2|�d�sd|}t|j|�tjd�dS)N)�#zimport z# )�file)r�flags�verbose�
startswith�printr1�stderr)�messagerJr;r
r
r�_verbose_message�s
rScs�fdd�}t|��|S)Ncs&|tjkrtd�|�|d���||�S�Nz{!r} is not a built-in moduler)r�builtin_module_names�ImportErrorr1�r"�fullname��fxnr
r�_requires_builtin_wrapper�s


�z4_requires_builtin.<locals>._requires_builtin_wrapper�r)rZr[r
rYr�_requires_builtin�s
r]cs�fdd�}t|��|S)Ncs&t�|�std�|�|d���||�S�Nz{!r} is not a frozen moduler)r>�	is_frozenrVr1rWrYr
r�_requires_frozen_wrapper�s


�z2_requires_frozen.<locals>._requires_frozen_wrapperr\)rZr`r
rYr�_requires_frozen�s
racCs>t||�}|tjkr2tj|}t||�tj|St|�SdSr)�spec_from_loaderr�modules�_exec�_load)r"rX�spec�moduler
r
r�_load_module_shim�s




rhcCs�t|dd�}t|d�r8z|�|�WStk
r6YnXz
|j}Wntk
rVYnX|dk	rht|�Sz
|j}Wntk
r�d}YnXz
|j}Wn:tk
r�|dkr�d�	|�YSd�	||�YSYnXd�	||�SdS)N�
__loader__�module_repr�?�
<module {!r}>�<module {!r} ({!r})>�<module {!r} from {!r}>)
rrrj�	Exception�__spec__�AttributeError�_module_repr_from_specr�__file__r1)rg�loaderrfr�filenamer
r
r�_module_repr
s.




rvc@sneZdZdddd�dd�Zdd�Zdd�Zed	d
��Zejdd
��Zedd
��Z	edd��Z
e
jdd��Z
dS)�
ModuleSpecN)�origin�loader_state�
is_packagecCs6||_||_||_||_|r gnd|_d|_d|_dS�NF)rrtrxry�submodule_search_locations�
_set_fileattr�_cached)r"rrtrxryrzr
r
rr#VszModuleSpec.__init__cCsfd�|j�d�|j�g}|jdk	r4|�d�|j��|jdk	rP|�d�|j��d�|jjd�|��S)Nz	name={!r}zloader={!r}zorigin={!r}zsubmodule_search_locations={}z{}({})z, )	r1rrtrx�appendr|�	__class__r�join)r"r;r
r
rr4bs

�

�zModuleSpec.__repr__cCsj|j}zH|j|jkoL|j|jkoL|j|jkoL||jkoL|j|jkoL|j|jkWStk
rdYdSXdSr{)r|rrtrx�cached�has_locationrq)r"�other�smslr
r
r�__eq__ls
�
��
�
�zModuleSpec.__eq__cCs:|jdkr4|jdk	r4|jr4tdkr&t�t�|j�|_|jSr)r~rxr}�_bootstrap_external�NotImplementedError�_get_cachedr3r
r
rr�xs
zModuleSpec.cachedcCs
||_dSr)r~)r"r�r
r
rr��scCs$|jdkr|j�d�dS|jSdS)N�.r)r|r�
rpartitionr3r
r
r�parent�s
zModuleSpec.parentcCs|jSr)r}r3r
r
rr��szModuleSpec.has_locationcCst|�|_dSr)�boolr})r"�valuer
r
rr��s)rrrr#r4r��propertyr��setterr�r�r
r
r
rrw1s%�




rw�rxrzcCs�t|d�rJtdkrt�tj}|dkr0|||d�S|r8gnd}||||d�S|dkr�t|d�r�z|�|�}Wq�tk
r�d}Yq�Xnd}t||||d�S)N�get_filename)rt)rtr|rzFr�)rr�r��spec_from_file_locationrzrVrw)rrtrxrzr��searchr
r
rrb�s$
�
rbcCs8z
|j}Wntk
rYnX|dk	r,|S|j}|dkrZz
|j}Wntk
rXYnXz
|j}Wntk
r|d}YnX|dkr�|dkr�z
|j}Wq�tk
r�d}Yq�Xn|}z
|j}Wntk
r�d}YnXzt|j�}Wntk
�rd}YnXt	|||d�}|dk�r"dnd|_
||_||_|S)N�rxFT)
rprqrrirs�_ORIGIN�
__cached__�list�__path__rwr}r�r|)rgrtrxrfr�locationr�r|r
r
r�_spec_from_module�sH







r�F��overridecCs�|st|dd�dkr6z|j|_Wntk
r4YnX|sJt|dd�dkr�|j}|dkr�|jdk	r�tdkrnt�tj}|�	|�}|j|_
||_d|_z
||_Wntk
r�YnX|s�t|dd�dkr�z|j
|_Wntk
r�YnXz
||_Wntk
�rYnX|�s"t|dd�dk�rR|jdk	�rRz|j|_Wntk
�rPYnX|j�r�|�srt|dd�dk�r�z|j|_Wntk
�r�YnX|�s�t|dd�dk�r�|jdk	�r�z|j|_Wntk
�r�YnX|S)Nrri�__package__r�rsr�)rrrrqrtr|r�r��_NamespaceLoader�__new__�_pathrsrir�r�rpr�r�rxr�r�)rfrgr�rtr�r
r
r�_init_module_attrs�s`



r�cCsRd}t|jd�r|j�|�}nt|jd�r2td��|dkrDt|j�}t||�|S)N�
create_module�exec_modulezBloaders that define exec_module() must also define create_module())rrtr�rVrrr��rfrgr
r
r�module_from_spec%s

r�cCsj|jdkrdn|j}|jdkrB|jdkr2d�|�Sd�||j�Sn$|jrVd�||j�Sd�|j|j�SdS)Nrkrlrmrn�<module {!r} ({})>)rrxrtr1r�)rfrr
r
rrr6s


rrc
Cs�|j}t|���tj�|�|k	r6d�|�}t||d��zj|jdkrj|j	dkrZtd|jd��t
||dd�n4t
||dd�t|jd�s�|j�|�n|j�
|�W5tj�|j�}|tj|j<XW5QRX|S)Nzmodule {!r} not in sys.modulesr�missing loaderTr�r�)rr6rrcr&r1rV�poprtr|r�r�load_moduler�)rfrgr�msgr
r
rrdGs"



rdcCsz|j�|j�Wn4|jtjkr@tj�|j�}|tj|j<�YnXtj�|j�}|tj|j<t|dd�dkr�z|j|_Wntk
r�YnXt|dd�dkr�z(|j	|_
t|d�s�|j�d�d|_
Wntk
r�YnXt|dd�dk�rz
||_
Wntk
�rYnX|S)Nrir�r�r�rrp)rtr�rrrcr�rrirqrr�rr�rpr�r
r
r�_load_backward_compatiblees6

r�cCs�|jdk	rt|jd�st|�St|�}d|_z�|tj|j<z4|jdkr`|jdkrlt	d|jd��n|j�
|�Wn2ztj|j=Wntk
r�YnX�YnXtj�|j�}|tj|j<t
d|j|j�W5d|_X|S)Nr�TFr�rzimport {!r} # {!r})rtrr�r��
_initializingrrcrr|rVr�rDr�rSr�r
r
r�_load_unlocked�s.


r�c
Cs*t|j��t|�W5QR�SQRXdSr)r6rr�)rfr
r
rre�s	rec@s�eZdZedd��Zeddd��Zeddd��Zedd	��Zed
d��Z	ee
dd
���Zee
dd���Zee
dd���Z
ee�ZdS)�BuiltinImportercCsd�|j�S)Nz<module {!r} (built-in)>)r1r)rgr
r
rrj�szBuiltinImporter.module_reprNcCs,|dk	rdSt�|�r$t||dd�SdSdS)Nzbuilt-inr�)r>�
is_builtinrb��clsrX�path�targetr
r
r�	find_spec�s

zBuiltinImporter.find_speccCs|�||�}|dk	r|jSdSr)r�rt)r�rXr�rfr
r
r�find_module�s	zBuiltinImporter.find_modulecCs.|jtjkr"td�|j�|jd��ttj|�SrT)rrrUrVr1rIr>�create_builtin)r"rfr
r
rr��s
�zBuiltinImporter.create_modulecCsttj|�dSr)rIr>�exec_builtin)r"rgr
r
rr��szBuiltinImporter.exec_modulecCsdSrr
�r�rXr
r
r�get_code�szBuiltinImporter.get_codecCsdSrr
r�r
r
r�
get_source�szBuiltinImporter.get_sourcecCsdSr{r
r�r
r
rrzszBuiltinImporter.is_package)NN)N)rrr�staticmethodrj�classmethodr�r�r�r�r]r�r�rzrhr�r
r
r
rr��s(	


r�c@s�eZdZdZedd��Zeddd��Zeddd��Zed	d
��Z	edd��Z
ed
d��Zeedd���Z
eedd���Zeedd���ZdS)�FrozenImporter�frozencCsd�|jtj�S)Nr�)r1rr�r�)�mr
r
rrjszFrozenImporter.module_reprNcCs"t�|�rt|||jd�SdSdS)Nr�)r>r_rbr�r�r
r
rr� s
zFrozenImporter.find_speccCst�|�r|SdSr)r>r_)r�rXr�r
r
rr�'szFrozenImporter.find_modulecCsdSrr
)r�rfr
r
rr�0szFrozenImporter.create_modulecCs@|jj}t�|�s$td�|�|d��ttj|�}t||j	�dSr^)
rprr>r_rVr1rI�get_frozen_object�execr)rgr�coder
r
rr�4s

�zFrozenImporter.exec_modulecCs
t||�Sr)rhr�r
r
rr�=szFrozenImporter.load_modulecCs
t�|�Sr)r>r�r�r
r
rr�FszFrozenImporter.get_codecCsdSrr
r�r
r
rr�LszFrozenImporter.get_sourcecCs
t�|�Sr)r>�is_frozen_packager�r
r
rrzRszFrozenImporter.is_package)NN)N)rrrr�r�rjr�r�r�r�r�r�rar�r�rzr
r
r
rr�s,	



r�c@seZdZdd�Zdd�ZdS)�_ImportLockContextcCst��dSr)r>r?r3r
r
rr:_sz_ImportLockContext.__enter__cCst��dSr)r>r@)r"�exc_type�	exc_value�
exc_tracebackr
r
rr=csz_ImportLockContext.__exit__N)rrrr:r=r
r
r
rr�[sr�cCs@|�d|d�}t|�|kr$td��|d}|r<d�||�S|S)Nr�r*z2attempted relative import beyond top-level packager�{}.{})�rsplit�len�
ValueErrorr1)r�package�level�bits�baser
r
r�
_resolve_namehs
r�cCs"|�||�}|dkrdSt||�Sr)r�rb)�finderrr�rtr
r
r�_find_spec_legacyqsr�c

Cstj}|dkrtd��|s&t�dt�|tjk}|D]�}t��Tz
|j}Wn6t	k
r�t
|||�}|dkr|YW5QR�q4YnX||||�}W5QRX|dk	r4|�s�|tjk�r�tj|}z
|j}	Wnt	k
r�|YSX|	dkr�|S|	Sq4|Sq4dS)Nz5sys.meta_path is None, Python is likely shutting downzsys.meta_path is empty)r�	meta_pathrV�	_warnings�warn�
ImportWarningrcr�r�rqr�rp)
rr�r�r��	is_reloadr�r�rfrgrpr
r
r�
_find_speczs6





r�cCslt|t�std�t|����|dkr,td��|dkrTt|t�sHtd��n|sTtd��|sh|dkrhtd��dS)Nzmodule name must be str, not {}rzlevel must be >= 0z__package__ not set to a stringz6attempted relative import with no known parent packagezEmpty module name)�
isinstance�str�	TypeErrorr1rr�rV�rr�r�r
r
r�
_sanity_check�s


r�zNo module named z{!r}cCs�d}|�d�d}|r�|tjkr*t||�|tjkr>tj|Stj|}z
|j}Wn2tk
r�td�||�}t||d�d�YnXt	||�}|dkr�tt�|�|d��nt
|�}|r�tj|}t||�d�d|�|S)Nr�rz; {!r} is not a packager�)r�rrcrIr�rq�_ERR_MSGr1�ModuleNotFoundErrorr�r�r)r�import_r�r��
parent_moduler�rfrgr
r
r�_find_and_load_unlocked�s*







r�c
Csjt|��2tj�|t�}|tkr6t||�W5QR�SW5QRX|dkr^d�|�}t||d��t|�|S)Nz(import of {} halted; None in sys.modulesr)	r6rrcr&�_NEEDS_LOADINGr�r1r�rF)rr�rgrRr
r
r�_find_and_load�s
 �r�rcCs*t|||�|dkr t|||�}t|t�Sr)r�r�r��_gcd_importr�r
r
rr��s	r���	recursivecCs�|D]�}t|t�sB|r"|jd}nd}td|�dt|�j����q|dkrl|s�t|d�r�t||j|dd�qt||�sd	�|j|�}zt	||�Wqt
k
r�}z*|j|kr�tj
�|t�dk	r�WY�q�W5d}~XYqXq|S)
Nz.__all__z
``from list''zItem in z must be str, not �*�__all__Tr�r�)r�r�rr�rr�_handle_fromlistr�r1rIr�rrrcr&r�)rg�fromlistr�r��x�where�	from_name�excr
r
rr��s,


�

�r�cCs�|�d�}|�d�}|dk	rR|dk	rN||jkrNtjd|�d|j�d�tdd�|S|dk	r`|jStjdtdd�|d	}d
|kr�|�d�d}|S)
Nr�rpz __package__ != __spec__.parent (z != �)�)�
stacklevelzYcan't resolve package from __spec__ or __package__, falling back on __name__ and __path__rr�r�r)r&r�r�r�r�r�)�globalsr�rfr
r
r�_calc___package__s&

��r�r
c	Cs�|dkrt|�}n$|dk	r|ni}t|�}t|||�}|s�|dkrTt|�d�d�S|s\|St|�t|�d�d�}tj|jdt|j�|�Snt|d�r�t||t�S|SdS)Nrr�r�)	r�r��	partitionr�rrcrrr�)	rr��localsr�r�rg�globals_r��cut_offr
r
r�
__import__9s
 
r�cCs&t�|�}|dkrtd|��t|�S)Nzno built-in module named )r�r�rVr�)rrfr
r
r�_builtin_from_name^s
r�c
Cs�|a|att�}tj��D]H\}}t||�r|tjkr<t}nt�|�rt	}nqt
||�}t||�qtjt}dD].}|tjkr�t
|�}	n
tj|}	t|||	�qrdS)N)rr�rE)r>rrrc�itemsr�rUr�r_r�r�r�rr�r)
�
sys_module�_imp_module�module_typerrgrtrf�self_module�builtin_name�builtin_moduler
r
r�_setupes$	







rcCs&t||�tj�t�tj�t�dSr)rrr�rr�r�)r�r�r
r
r�_install�s
rcCs ddl}|a|�tjt�dSr)�_frozen_importlib_externalr�rrrcr)rr
r
r�_install_external_importers�sr)NN)N)Nr)NNr
r)1r�rrrAr%r/rrr5r6r9rFrIrSr]rarhrvrwrbr�r�r�rrrdr�r�rer�r�r�r�r�r�r��_ERR_MSG_PREFIXr�r��objectr�r�r�r�r�r�r�rrrr
r
r
r�<module>s\D%$e
-H%*IO
		
/
%
%#__pycache__/_bootstrap_external.cpython-38.opt-1.pyc000064400000131204150327175520016431 0ustar00U

&�.e��@s�dZddladdlZddladdlZddlZtjdkZerLddlZ	ddl
Z
nddlZ	erbddgZndgZedZ
ee�Zd�e�Zdd�eD�Zd	Zd
ZeeZdd�Zd
d�Zdd�Zdd�Zer�dd�Zndd�Zdd�Zdd�Zdd�Zdd�Zdd�Ze�rd d!�Znd"d!�Zd�d$d%�Z e!e j"�Z#d&�$d'd(�d)Z%e&�'e%d(�Z(d*Z)d+Z*d,gZ+d-gZ,e,Z-Z.d�dd.�d/d0�Z/d1d2�Z0d3d4�Z1d5d6�Z2d7d8�Z3d9d:�Z4d;d<�Z5d=d>�Z6d?d@�Z7dAdB�Z8d�dCdD�Z9d�dEdF�Z:d�dHdI�Z;dJdK�Z<e=�Z>d�de>dL�dMdN�Z?GdOdP�dP�Z@GdQdR�dR�ZAGdSdT�dTeA�ZBGdUdV�dV�ZCGdWdX�dXeCeB�ZDGdYdZ�dZeCeA�ZEgZFGd[d\�d\eCeA�ZGGd]d^�d^�ZHGd_d`�d`�ZIGdadb�db�ZJGdcdd�dd�ZKd�dedf�ZLdgdh�ZMdidj�ZNdkdl�ZOdmdndodpdqdrdsdtdudvdwdxdydzd{d|d}�ZPd~d�ZQdS)�a^Core implementation of path-based import.

This module is NOT meant to be directly imported! It has been designed such
that it can be bootstrapped into Python as the implementation of import. As
such it requires the injection of specific modules and attributes in order to
work. One should use importlib as the public-facing version of this module.

�NZwin32�\�/�cCsh|]}d|���qS��:���.0�srr�5/usr/lib64/python3.8/importlib/_bootstrap_external.py�	<setcomp>/sr)�win)�cygwin�darwincs<tj�t�r0tj�t�rd�nd��fdd�}ndd�}|S)N�PYTHONCASEOKsPYTHONCASEOKcs
�tjkS)�5True if filenames must be checked case-insensitively.)�_os�environr��keyrr�_relax_case@sz%_make_relax_case.<locals>._relax_casecSsdS)rFrrrrrrDs)�sys�platform�
startswith�_CASE_INSENSITIVE_PLATFORMS�#_CASE_INSENSITIVE_PLATFORMS_STR_KEY)rrrr�_make_relax_case9srcCst|�d@�dd�S)z*Convert a 32-bit integer to little-endian.�����little)�int�to_bytes)�xrrr�_pack_uint32Jsr#cCst�|d�S)z/Convert 4 bytes in little-endian to an integer.r�r �
from_bytes��datarrr�_unpack_uint32Osr(cCst�|d�S)z/Convert 2 bytes in little-endian to an integer.rr$r&rrr�_unpack_uint16Tsr)cGs�|sdSt|�dkr|dSd}g}ttj|�D]z\}}|�t�sL|�t�rf|�t�pX|}t	|g}q0|�d�r�|�
�|�
�kr�|}|g}q�|�|�q0|p�|}|�|�q0dd�|D�}t|�dkr�|ds�|t	S|t	�|�S)�Replacement for os.path.join().r�rrcSsg|]}|r|�t��qSr��rstrip�path_separators�r	�prrr�
<listcomp>rs�_path_join.<locals>.<listcomp>)
�len�mapr�_path_splitrootr�path_sep_tuple�endswithr-r.�path_sep�casefold�append�join)�
path_parts�root�pathZnew_root�tailrrr�
_path_join[s*
r@cGst�dd�|D��S)r*cSsg|]}|r|�t��qSrr,)r	�partrrrr1{s�r2)r8r;)r<rrrr@ys
�csBt�fdd�tD��}|dkr&d�fS�d|��|dd�fS)z Replacement for os.path.split().c3s|]}��|�VqdS�N)�rfindr/�r>rr�	<genexpr>�sz_path_split.<locals>.<genexpr>rrNr+)�maxr.)r>�irrDr�_path_splitsrHcCs
t�|�S)z~Stat the path.

    Made a separate function to make it easier to override in experiments
    (e.g. cache stat results).

    )r�statrDrrr�
_path_stat�srJcCs2zt|�}Wntk
r"YdSX|jd@|kS)z1Test whether the path is the specified mode type.Fi�)rJ�OSError�st_mode)r>�mode�	stat_inforrr�_path_is_mode_type�s
rOcCs
t|d�S)zReplacement for os.path.isfile.i�)rOrDrrr�_path_isfile�srPcCs|st��}t|d�S)zReplacement for os.path.isdir.i@)r�getcwdrOrDrrr�_path_isdir�srRcCs>|sdSt�|�d�dd�}t|�dko<|�d�p<|�d�S)�Replacement for os.path.isabs.Frrrr+z\\)rr5�replacer3rr7)r>r=rrr�_path_isabs�srUcCs
|�t�S)rS)rr.rDrrrrU�s�cCs�d�|t|��}t�|tjtjBtjB|d@�}z2t�|d��}|�	|�W5QRXt�
||�Wn:tk
r�zt�|�Wntk
r�YnX�YnXdS)z�Best-effort function to write data to a path atomically.
    Be prepared to handle a FileExistsError if concurrent writing of the
    temporary file is attempted.�{}.{}rV�wbN)
�format�idr�open�O_EXCL�O_CREAT�O_WRONLY�_io�FileIO�writerTrK�unlink)r>r'rM�path_tmp�fd�filerrr�
_write_atomic�s�rfiU
�rs
�__pycache__zopt-z.pyz.pyc)�optimizationcCsX|dk	r4t�dt�|dk	r(d}t|��|r0dnd}t�|�}t|�\}}|�d�\}}}tj	j
}	|	dkrrtd��d�|r~|n|||	g�}
|dkr�tj
jdkr�d}ntj
j}t|�}|dkr�|��s�td	�|���d
�|
t|�}
|
td}tjdk	�rLt|��stt��|�}|ddk�r8|dtk�r8|dd�}ttj|�t�|�St|t|�S)
a�Given the path to a .py file, return the path to its .pyc file.

    The .py file does not need to exist; this simply returns the path to the
    .pyc file calculated as if the .py file were imported.

    The 'optimization' parameter controls the presumed optimization level of
    the bytecode file. If 'optimization' is not None, the string representation
    of the argument is taken and verified to be alphanumeric (else ValueError
    is raised).

    The debug_override parameter is deprecated. If debug_override is not None,
    a True value is the same as setting 'optimization' to the empty string
    while a False value is equivalent to setting 'optimization' to '1'.

    If sys.implementation.cache_tag is None then NotImplementedError is raised.

    NzFthe debug_override parameter is deprecated; use 'optimization' insteadz2debug_override or optimization must be set to Nonerr+�.�$sys.implementation.cache_tag is Nonerz{!r} is not alphanumericz{}.{}{}rrg)�	_warnings�warn�DeprecationWarning�	TypeErrorr�fspathrH�
rpartitionr�implementation�	cache_tag�NotImplementedErrorr;�flags�optimize�str�isalnum�
ValueErrorrY�_OPT�BYTECODE_SUFFIXES�pycache_prefixrUr@rQr.�lstrip�_PYCACHE)r>�debug_overrideri�message�headr?�base�sep�rest�tag�almost_filename�filenamerrr�cache_from_sourcebsH�
	
�r�c
Cs.tjjdkrtd��t�|�}t|�\}}d}tjdk	rftj�t	�}|�
|t�rf|t|�d�}d}|s�t|�\}}|t
kr�tt
�d|����|�d�}|dkr�td|����n\|d	k�r|�dd
�d}|�
t�s�tdt����|tt�d�}|���std
|�d���|�d�d}	t||	td�S)anGiven the path to a .pyc. file, return the path to its .py file.

    The .pyc file does not need to exist; this simply returns the path to
    the .py file calculated to correspond to the .pyc file.  If path does
    not conform to PEP 3147/488 format, ValueError will be raised. If
    sys.implementation.cache_tag is None then NotImplementedError is raised.

    NrkFTz not bottom-level directory in rj>rg�zexpected only 2 or 3 dots in r�rg���z5optimization portion of filename does not start with zoptimization level z is not an alphanumeric valuer)rrrrsrtrrprHr|r-r.rr8r3r~ry�count�rsplitrzrx�	partitionr@�SOURCE_SUFFIXES)
r>r��pycache_filename�found_in_pycache_prefix�
stripped_path�pycache�	dot_countri�	opt_level�
base_filenamerrr�source_from_cache�s4	





r�c	Cs~t|�dkrdS|�d�\}}}|r8|��dd�dkr<|Szt|�}Wn$ttfk
rl|dd�}YnXt|�rz|S|S)z�Convert a bytecode file path to a source path (if possible).

    This function exists purely for backwards-compatibility for
    PyImport_ExecCodeModuleWithFilenames() in the C API.

    rNrj�������py)r3rq�lowerr�rtryrP)�
bytecode_pathr��_�	extension�source_pathrrr�_get_sourcefile�sr�cCsJ|�tt��r0z
t|�WStk
r,YqFXn|�tt��rB|SdSdSrB)r7�tupler�r�rtr{)r�rrr�_get_cached�s
r�cCs4zt|�j}Wntk
r&d}YnX|dO}|S)z3Calculate the mode permissions for a bytecode file.rV�)rJrLrK)r>rMrrr�
_calc_mode�s
r�csDd�fdd�	}z
tj}Wntk
r4dd�}YnX||��|S)z�Decorator to verify that the module being requested matches the one the
    loader can handle.

    The first argument (self) must define _name which the second argument is
    compared against. If the comparison fails then ImportError is raised.

    NcsB|dkr|j}n |j|kr0td|j|f|d���||f|�|�S)Nzloader for %s cannot handle %s��name)r��ImportError)�selfr��args�kwargs��methodrr�_check_name_wrappers
��z(_check_name.<locals>._check_name_wrappercSs8dD] }t||�rt||t||��q|j�|j�dS)N)�
__module__�__name__�__qualname__�__doc__)�hasattr�setattr�getattr�__dict__�update)�new�oldrTrrr�_wraps
z_check_name.<locals>._wrap)N)�
_bootstrapr��	NameError)r�r�r�rr�r�_check_name�s

r�cCs<|�|�\}}|dkr8t|�r8d}t�|�|d�t�|S)z�Try to find a loader for the specified module by delegating to
    self.find_loader().

    This method is deprecated in favor of finder.find_spec().

    Nz,Not importing directory {}: missing __init__r)�find_loaderr3rlrmrY�
ImportWarning)r��fullname�loader�portions�msgrrr�_find_module_shims

r�cCs�|dd�}|tkr<d|�d|��}t�d|�t|f|��t|�dkrfd|��}t�d|�t|��t|dd��}|d	@r�d
|�d|��}t|f|��|S)aTPerform basic validity checking of a pyc header and return the flags field,
    which determines how the pyc should be further validated against the source.

    *data* is the contents of the pyc file. (Only the first 16 bytes are
    required, though.)

    *name* is the name of the module being imported. It is used for logging.

    *exc_details* is a dictionary passed to ImportError if it raised for
    improved debugging.

    ImportError is raised when the magic number is incorrect or when the flags
    field is invalid. EOFError is raised when the data is found to be truncated.

    Nrzbad magic number in z: �{}�z(reached EOF while reading pyc header of ����zinvalid flags z in )�MAGIC_NUMBERr��_verbose_messager�r3�EOFErrorr()r'r��exc_details�magicr�rurrr�
_classify_pyc)s
r�cCspt|dd��|d@kr:d|��}t�d|�t|f|��|dk	rlt|dd��|d@krltd|��f|��dS)aValidate a pyc against the source last-modified time.

    *data* is the contents of the pyc file. (Only the first 16 bytes are
    required.)

    *source_mtime* is the last modified timestamp of the source file.

    *source_size* is None or the size of the source file in bytes.

    *name* is the name of the module being imported. It is used for logging.

    *exc_details* is a dictionary passed to ImportError if it raised for
    improved debugging.

    An ImportError is raised if the bytecode is stale.

    r��rzbytecode is stale for r�Nr�)r(r�r�r�)r'�source_mtime�source_sizer�r�r�rrr�_validate_timestamp_pycJs
�r�cCs&|dd�|kr"td|��f|��dS)a�Validate a hash-based pyc by checking the real source hash against the one in
    the pyc header.

    *data* is the contents of the pyc file. (Only the first 16 bytes are
    required.)

    *source_hash* is the importlib.util.source_hash() of the source file.

    *name* is the name of the module being imported. It is used for logging.

    *exc_details* is a dictionary passed to ImportError if it raised for
    improved debugging.

    An ImportError is raised if the bytecode is stale.

    r�r�z.hash in bytecode doesn't match hash of source N)r�)r'�source_hashr�r�rrr�_validate_hash_pycfs��r�cCsPt�|�}t|t�r8t�d|�|dk	r4t�||�|Std�	|�||d��dS)z#Compile bytecode as found in a pyc.zcode object from {!r}NzNon-code object in {!r}�r�r>)
�marshal�loads�
isinstance�
_code_typer�r��_imp�_fix_co_filenamer�rY)r'r�r�r��coderrr�_compile_bytecode~s


�r�cCsFtt�}|�td��|�t|��|�t|��|�t�|��|S)z+Produce the data for a timestamp-based pyc.r��	bytearrayr��extendr#r��dumps)r��mtimer�r'rrr�_code_to_timestamp_pyc�sr�TcCs@tt�}d|d>B}|�t|��|�|�|�t�|��|S)z&Produce the data for a hash-based pyc.r+r�)r�r��checkedr'rurrr�_code_to_hash_pyc�s
r�cCs>ddl}t�|�j}|�|�}t�dd�}|�|�|d��S)zyDecode bytes representing source code and return the string.

    Universal newline support is used in the decoding.
    rNT)�tokenizer_�BytesIO�readline�detect_encoding�IncrementalNewlineDecoder�decode)�source_bytesr��source_bytes_readline�encoding�newline_decoderrrr�
decode_source�s

r��r��submodule_search_locationsc	Cs|dkr<d}t|d�rFz|�|�}WqFtk
r8YqFXn
t�|�}tj|||d�}d|_|dkr�t�D]*\}}|�	t
|��rj|||�}||_q�qjdS|tkr�t|d�r�z|�
|�}Wntk
r�Yq�X|r�g|_n||_|jgk�r|�rt|�d}|j�|�|S)a=Return a module spec based on a file location.

    To indicate that the module is a package, set
    submodule_search_locations to a list of directory paths.  An
    empty list is sufficient, though its not otherwise useful to the
    import system.

    The loader must take a spec as its only __init__() arg.

    Nz	<unknown>�get_filename��originT�
is_packager)r�r�r�rrpr��
ModuleSpec�
_set_fileattr�_get_supported_file_loadersr7r�r��	_POPULATEr�r�rHr:)	r��locationr�r��spec�loader_class�suffixesr��dirnamerrr�spec_from_file_location�s>



r�c@sPeZdZdZdZdZdZedd��Zedd��Z	edd
d��Z
eddd
��Zd	S)�WindowsRegistryFinderz>Meta path finder for modules declared in the Windows registry.z;Software\Python\PythonCore\{sys_version}\Modules\{fullname}zASoftware\Python\PythonCore\{sys_version}\Modules\{fullname}\DebugFcCs8zt�tj|�WStk
r2t�tj|�YSXdSrB)�_winreg�OpenKey�HKEY_CURRENT_USERrK�HKEY_LOCAL_MACHINE)�clsrrrr�_open_registrysz$WindowsRegistryFinder._open_registryc	Csr|jr|j}n|j}|j|dtjdd�d�}z&|�|��}t�|d�}W5QRXWnt	k
rlYdSX|S)Nz%d.%drg)r��sys_versionr)
�DEBUG_BUILD�REGISTRY_KEY_DEBUG�REGISTRY_KEYrYr�version_inforr�
QueryValuerK)rr��registry_keyr�hkey�filepathrrr�_search_registrys�z&WindowsRegistryFinder._search_registryNcCsz|�|�}|dkrdSzt|�Wntk
r8YdSXt�D]4\}}|�t|��r@tj||||�|d�}|Sq@dS)Nr�)rrJrKr�r7r�r��spec_from_loader)rr�r>�targetrr�r�r�rrr�	find_specs
�zWindowsRegistryFinder.find_speccCs"|�||�}|dk	r|jSdSdS)zlFind module named in the registry.

        This method is deprecated.  Use exec_module() instead.

        N�rr��rr�r>r�rrr�find_module'sz!WindowsRegistryFinder.find_module)NN)N)r�r�r�r�r	rr�classmethodrrrrrrrrr��s��

r�c@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�
_LoaderBasicszSBase class of common code needed by both SourceLoader and
    SourcelessFileLoader.cCs@t|�|��d}|�dd�d}|�d�d}|dko>|dkS)z�Concrete implementation of InspectLoader.is_package by checking if
        the path returned by get_filename has a filename of '__init__.py'.r+rjrrg�__init__)rHr�r�rq)r�r�r��
filename_base�	tail_namerrrr�:sz_LoaderBasics.is_packagecCsdS�z*Use default semantics for module creation.Nr�r�r�rrr�
create_moduleBsz_LoaderBasics.create_modulecCs8|�|j�}|dkr$td�|j���t�t||j�dS)zExecute the module.Nz4cannot load module {!r} when get_code() returns None)�get_coder�r�rYr��_call_with_frames_removed�execr�)r��moduler�rrr�exec_moduleEs�z_LoaderBasics.exec_modulecCst�||�S)zThis module is deprecated.)r��_load_module_shim�r�r�rrr�load_moduleMsz_LoaderBasics.load_moduleN)r�r�r�r�r�rr"r%rrrrr5s
rc@sJeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�d
d�Zdd�Z	dS)�SourceLoadercCst�dS)z�Optional method that returns the modification time (an int) for the
        specified path (a str).

        Raises OSError when the path cannot be handled.
        N)rK�r�r>rrr�
path_mtimeTszSourceLoader.path_mtimecCsd|�|�iS)a�Optional method returning a metadata dict for the specified
        path (a str).

        Possible keys:
        - 'mtime' (mandatory) is the numeric timestamp of last source
          code modification;
        - 'size' (optional) is the size in bytes of the source code.

        Implementing this method allows the loader to read bytecode files.
        Raises OSError when the path cannot be handled.
        r�)r(r'rrr�
path_stats\szSourceLoader.path_statscCs|�||�S)z�Optional method which writes data (bytes) to a file path (a str).

        Implementing this method allows for the writing of bytecode files.

        The source path is needed in order to correctly transfer permissions
        )�set_data)r�r��
cache_pathr'rrr�_cache_bytecodejszSourceLoader._cache_bytecodecCsdS)z�Optional method which writes data (bytes) to a file path (a str).

        Implementing this method allows for the writing of bytecode files.
        Nr)r�r>r'rrrr*tszSourceLoader.set_datac
CsR|�|�}z|�|�}Wn0tk
rH}ztd|d�|�W5d}~XYnXt|�S)z4Concrete implementation of InspectLoader.get_source.z'source not available through get_data()r�N)r��get_datarKr�r�)r�r�r>r��excrrr�
get_source{s
��zSourceLoader.get_sourcer�)�	_optimizecCstjt||dd|d�S)z�Return the code object compiled from source.

        The 'data' argument can be any object type that compile() supports.
        r T)�dont_inheritrv)r�r�compile)r�r'r>r0rrr�source_to_code�s�zSourceLoader.source_to_codec	Cs"|�|�}d}d}d}d}d}zt|�}Wntk
rDd}Y�n0Xz|�|�}	Wntk
rjY�n
Xt|	d�}z|�|�}
Wntk
r�Yn�X||d�}z�t|
||�}t|
�dd�}
|d@dk}|�r$|d	@dk}t	j
d
k�r8|s�t	j
dk�r8|�|�}t	�t|�}t
|
|||�nt|
||	d||�Wnttfk
�rTYn Xt�d
||�t|
|||d�S|dk�r�|�|�}|�||�}t�d|�tj�s|dk	�r|dk	�r|�r�|dk�r�t	�|�}t|||�}
nt||t|��}
z|�|||
�Wntk
�rYnX|S)z�Concrete implementation of InspectLoader.get_code.

        Reading of bytecode requires path_stats to be implemented. To write
        bytecode, set_data must also be implemented.

        NFTr�r�r�r+rrg�never�always�sizez
{} matches {})r�r�r�zcode object from {})r�r�rtr)rKr r-r��
memoryviewr��check_hash_based_pycsr��_RAW_MAGIC_NUMBERr�r�r�r�r�r�r�r3r�dont_write_bytecoder�r�r3r,)r�r�r�r�r�r��
hash_based�check_sourcer��str'r�ru�
bytes_data�code_objectrrrr�s�
���
�����

�

�zSourceLoader.get_codeN)
r�r�r�r(r)r,r*r/r3rrrrrr&Rs

r&cs|eZdZdZdd�Zdd�Zdd�Ze�fdd	��Zed
d��Z	dd
�Z
edd��Zdd�Zdd�Z
dd�Zdd�Z�ZS)�
FileLoaderzgBase file loader class which implements the loader protocol methods that
    require file system usage.cCs||_||_dS)zKCache the module name and the path to the file found by the
        finder.Nr�)r�r�r>rrrr�szFileLoader.__init__cCs|j|jko|j|jkSrB��	__class__r��r��otherrrr�__eq__�s
�zFileLoader.__eq__cCst|j�t|j�ASrB��hashr�r>�r�rrr�__hash__�szFileLoader.__hash__cstt|��|�S)zdLoad a module from a file.

        This method is deprecated.  Use exec_module() instead.

        )�superr@r%r$�rBrrr%�s
zFileLoader.load_modulecCs|jS�z:Return the path to the source file as found by the finder.rDr$rrrr�szFileLoader.get_filenamec
Csft|ttf�r:t�t|���}|��W5QR�SQRXn(t�|d��}|��W5QR�SQRXdS)z'Return the data from path as raw bytes.�rN)r�r&�ExtensionFileLoaderr_�	open_coderw�readr`)r�r>rerrrr-s
zFileLoader.get_datacCs|�|�r|SdSrB)r��r�r!rrr�get_resource_readers
zFileLoader.get_resource_readercCs tt|j�d|�}t�|d�S)NrrM)r@rHr>r_r`�r��resourcer>rrr�
open_resourceszFileLoader.open_resourcecCs&|�|�st�tt|j�d|�}|S�Nr)�is_resource�FileNotFoundErrorr@rHr>rSrrr�
resource_paths
zFileLoader.resource_pathcCs(t|krdStt|j�d|�}t|�S)NFr)r8r@rHr>rP�r�r�r>rrrrW szFileLoader.is_resourcecCstt�t|j�d��SrV)�iterr�listdirrHr>rHrrr�contents&szFileLoader.contents)r�r�r�r�rrErIr�r%r�r-rRrUrYrWr]�
__classcell__rrrKrr@�s

r@c@s.eZdZdZdd�Zdd�Zdd�dd	�Zd
S)�SourceFileLoaderz>Concrete implementation of SourceLoader using the file system.cCst|�}|j|jd�S)z!Return the metadata for the path.)r�r6)rJ�st_mtime�st_size)r�r>r=rrrr).szSourceFileLoader.path_statscCst|�}|j|||d�S)N��_mode)r�r*)r�r�r�r'rMrrrr,3sz SourceFileLoader._cache_bytecoderVrbc	Cs�t|�\}}g}|r4t|�s4t|�\}}|�|�qt|�D]l}t||�}zt�|�Wq<tk
rpYq<Yq<tk
r�}zt	�
d||�WY�dSd}~XYq<Xq<zt|||�t	�
d|�Wn0tk
r�}zt	�
d||�W5d}~XYnXdS)zWrite bytes data to a file.zcould not create {!r}: {!r}Nzcreated {!r})rHrRr:�reversedr@r�mkdir�FileExistsErrorrKr�r�rf)	r�r>r'rc�parentr�r<rAr.rrrr*8s0
��zSourceFileLoader.set_dataN)r�r�r�r�r)r,r*rrrrr_*sr_c@s eZdZdZdd�Zdd�ZdS)�SourcelessFileLoaderz-Loader which handles sourceless file imports.cCsD|�|�}|�|�}||d�}t|||�tt|�dd�||d�S)Nr�r�)r�r�)r�r-r�r�r7)r�r�r>r'r�rrrr[s

��zSourcelessFileLoader.get_codecCsdS)z'Return None as there is no source code.Nrr$rrrr/kszSourcelessFileLoader.get_sourceN)r�r�r�r�rr/rrrrrhWsrhc@s\eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zedd��Z
dS)rNz]Loader for extension modules.

    The constructor is designed to work with FileFinder.

    cCs@||_t|�s6ztt��|�}Wntk
r4YnX||_dSrB)r�rUr@rrQrKr>rZrrrr|szExtensionFileLoader.__init__cCs|j|jko|j|jkSrBrArCrrrrE�s
�zExtensionFileLoader.__eq__cCst|j�t|j�ASrBrFrHrrrrI�szExtensionFileLoader.__hash__cCs$t�tj|�}t�d|j|j�|S)z&Create an unitialized extension modulez&extension module {!r} loaded from {!r})r�rr��create_dynamicr�r�r>)r�r�r!rrrr�s��z!ExtensionFileLoader.create_modulecCs$t�tj|�t�d|j|j�dS)zInitialize an extension modulez(extension module {!r} executed from {!r}N)r�rr��exec_dynamicr�r�r>rQrrrr"�s
�zExtensionFileLoader.exec_modulecs$t|j�d�t�fdd�tD��S)z1Return True if the extension module is a package.r+c3s|]}�d|kVqdS)rNr�r	�suffix��	file_namerrrE�s�z1ExtensionFileLoader.is_package.<locals>.<genexpr>)rHr>�any�EXTENSION_SUFFIXESr$rrmrr��s�zExtensionFileLoader.is_packagecCsdS)z?Return None as an extension module cannot create a code object.Nrr$rrrr�szExtensionFileLoader.get_codecCsdS)z5Return None as extension modules have no source code.Nrr$rrrr/�szExtensionFileLoader.get_sourcecCs|jSrLrDr$rrrr��sz ExtensionFileLoader.get_filenameN)r�r�r�r�rrErIrr"r�rr/r�r�rrrrrNts	rNc@sheZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�ZdS)�_NamespacePatha&Represents a namespace package's path.  It uses the module name
    to find its parent module, and from there it looks up the parent's
    __path__.  When this changes, the module's own path is recomputed,
    using path_finder.  For top-level modules, the parent module's path
    is sys.path.cCs$||_||_t|���|_||_dSrB)�_name�_pathr��_get_parent_path�_last_parent_path�_path_finder�r�r�r>�path_finderrrrr�sz_NamespacePath.__init__cCs&|j�d�\}}}|dkrdS|dfS)z>Returns a tuple of (parent-module-name, parent-path-attr-name)rjr)rr>�__path__)rrrq)r�rg�dot�merrr�_find_parent_path_names�sz&_NamespacePath._find_parent_path_namescCs|��\}}ttj||�SrB)r|r�r�modules)r��parent_module_name�path_attr_namerrrrt�sz_NamespacePath._get_parent_pathcCsPt|���}||jkrJ|�|j|�}|dk	rD|jdkrD|jrD|j|_||_|jSrB)r�rtrurvrrr�r�rs)r��parent_pathr�rrr�_recalculate�s
z_NamespacePath._recalculatecCst|���SrB)r[r�rHrrr�__iter__�sz_NamespacePath.__iter__cCs|��|SrB�r�)r��indexrrr�__getitem__�sz_NamespacePath.__getitem__cCs||j|<dSrB)rs)r�r�r>rrr�__setitem__�sz_NamespacePath.__setitem__cCst|���SrB)r3r�rHrrr�__len__�sz_NamespacePath.__len__cCsd�|j�S)Nz_NamespacePath({!r}))rYrsrHrrr�__repr__�sz_NamespacePath.__repr__cCs||��kSrBr��r��itemrrr�__contains__�sz_NamespacePath.__contains__cCs|j�|�dSrB)rsr:r�rrrr:�sz_NamespacePath.appendN)r�r�r�r�rr|rtr�r�r�r�r�r�r�r:rrrrrq�s

rqc@sPeZdZdd�Zedd��Zdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�ZdS)�_NamespaceLoadercCst|||�|_dSrB)rqrsrwrrrr�sz_NamespaceLoader.__init__cCsd�|j�S)zsReturn repr for the module.

        The method is deprecated.  The import machinery does the job itself.

        z<module {!r} (namespace)>)rYr�)rr!rrr�module_repr�sz_NamespaceLoader.module_reprcCsdS)NTrr$rrrr��sz_NamespaceLoader.is_packagecCsdS)Nrrr$rrrr/�sz_NamespaceLoader.get_sourcecCstddddd�S)Nrz<string>r T)r1)r2r$rrrrsz_NamespaceLoader.get_codecCsdSrrrrrrrsz_NamespaceLoader.create_modulecCsdSrBrrQrrrr"sz_NamespaceLoader.exec_modulecCst�d|j�t�||�S)zbLoad a namespace module.

        This method is deprecated.  Use exec_module() instead.

        z&namespace module loaded with path {!r})r�r�rsr#r$rrrr%	s�z_NamespaceLoader.load_moduleN)r�r�r�rrr�r�r/rrr"r%rrrrr��s
r�c@sveZdZdZedd��Zedd��Zedd��Zedd	��Zeddd��Z	edd
d��Z
eddd��Zedd��Zd
S)�
PathFinderz>Meta path finder for sys.path and package __path__ attributes.cCs@ttj���D],\}}|dkr(tj|=qt|d�r|��qdS)z}Call the invalidate_caches() method on all path entry finders
        stored in sys.path_importer_caches (where implemented).N�invalidate_caches)�listr�path_importer_cache�itemsr�r�)rr��finderrrrr�s


zPathFinder.invalidate_cachesc	CsTtjdk	rtjst�dt�tjD],}z||�WStk
rLYq"Yq"Xq"dS)z.Search sys.path_hooks for a finder for 'path'.Nzsys.path_hooks is empty)r�
path_hooksrlrmr�r�)rr>�hookrrr�_path_hooks%s
zPathFinder._path_hookscCsh|dkr,zt��}Wntk
r*YdSXztj|}Wn(tk
rb|�|�}|tj|<YnX|S)z�Get the finder for the path entry from sys.path_importer_cache.

        If the path entry is not in the cache, find the appropriate finder
        and cache it. If no finder is available, store None.

        rN)rrQrXrr��KeyErrorr�)rr>r�rrr�_path_importer_cache2s
zPathFinder._path_importer_cachecCsRt|d�r|�|�\}}n|�|�}g}|dk	r<t�||�St�|d�}||_|S)Nr�)r�r�rr�rr�r�)rr�r�r�r�r�rrr�_legacy_get_specHs

zPathFinder._legacy_get_specNc	Cs�g}|D]�}t|ttf�sq|�|�}|dk	rt|d�rF|�||�}n|�||�}|dkr\q|jdk	rn|S|j}|dkr�t	d��|�
|�qt�|d�}||_|S)z?Find the loader or namespace_path for this module/package name.Nrzspec missing loader)
r�rw�bytesr�r�rr�r�r�r�r�r�r�)	rr�r>r�namespace_path�entryr�r�r�rrr�	_get_specWs(


zPathFinder._get_speccCsd|dkrtj}|�|||�}|dkr(dS|jdkr\|j}|rVd|_t|||j�|_|SdSn|SdS)z�Try to find a spec for 'fullname' on sys.path or 'path'.

        The search is based on sys.path_hooks and sys.path_importer_cache.
        N)rr>r�r�r�r�rq)rr�r>rr�r�rrrrws
zPathFinder.find_speccCs|�||�}|dkrdS|jS)z�find the module on sys.path or 'path' based on sys.path_hooks and
        sys.path_importer_cache.

        This method is deprecated.  Use find_spec() instead.

        Nrrrrrr�szPathFinder.find_modulecOsddlm}|j||�S)a 
        Find distributions.

        Return an iterable of all Distribution instances capable of
        loading the metadata for packages matching ``context.name``
        (or all names if ``None`` indicated) along the paths in the list
        of directories ``context.path``.
        r)�MetadataPathFinder)�importlib.metadatar��find_distributions)rr�r�r�rrrr��s
zPathFinder.find_distributions)N)NN)N)
r�r�r�r�rr�r�r�r�r�rrr�rrrrr�s"
	


r�c@sZeZdZdZdd�Zdd�ZeZdd�Zdd	�Z	ddd�Z
d
d�Zedd��Z
dd�Zd
S)�
FileFinderz�File-based finder.

    Interactions with the file system are cached for performance, being
    refreshed when the directory the finder is handling has been modified.

    cspg}|D] \�}|��fdd�|D��q||_|p6d|_t|j�sVtt��|j�|_d|_t�|_	t�|_
dS)z�Initialize with the path to search on and a variable number of
        2-tuples containing the loader and the file suffixes the loader
        recognizes.c3s|]}|�fVqdSrBrrk�r�rrrE�sz&FileFinder.__init__.<locals>.<genexpr>rjr�N)r��_loadersr>rUr@rrQ�_path_mtime�set�_path_cache�_relaxed_path_cache)r�r>�loader_details�loadersr�rr�rr�s

zFileFinder.__init__cCs
d|_dS)zInvalidate the directory mtime.r�N)r�rHrrrr��szFileFinder.invalidate_cachescCs*|�|�}|dkrdgfS|j|jp&gfS)z�Try to find a loader for the specified module, or the namespace
        package portions. Returns (loader, list-of-portions).

        This method is deprecated.  Use find_spec() instead.

        N)rr�r�)r�r�r�rrrr��s
zFileFinder.find_loadercCs|||�}t||||d�S)Nr�)r�)r�r�r�r>�smslrr�rrrr��s
�zFileFinder._get_specNc	Cs�d}|�d�d}zt|jp"t���j}Wntk
rBd}YnX||jkr\|��||_t	�rr|j
}|��}n
|j}|}||kr�t
|j|�}|jD]:\}	}
d|	}t
||�}t|�r�|�|
|||g|�Sq�t|�}|jD]r\}	}
zt
|j||	�}Wntk
�rYdSXtjd|dd�||	|kr�t|�r�|�|
||d|�Sq�|�r~t�d	|�t�|d�}
|g|
_|
SdS)
zoTry to find a spec for the specified module.

        Returns the matching spec, or None if not found.
        Frjrgr�rNz	trying {})�	verbosityzpossible namespace for {})rqrJr>rrQr`rKr��_fill_cacherr�r�r�r@r�rPr�rRryr�r�r�r�)r�r�r�is_namespace�tail_moduler��cache�cache_module�	base_pathrlr��
init_filename�	full_pathr�rrrr�sP





�
zFileFinder.find_specc	
Cs�|j}zt�|pt���}Wntttfk
r:g}YnXtj�	d�sTt
|�|_nJt
�}|D]8}|�d�\}}}|r�d�
||���}n|}|�|�q^||_tj�	t�r�dd�|D�|_dS)zDFill the cache of potential modules and packages for this directory.r
rjrWcSsh|]}|���qSr)r�)r	�fnrrrr*sz)FileFinder._fill_cache.<locals>.<setcomp>N)r>rr\rQrX�PermissionError�NotADirectoryErrorrrrr�r�r�rYr��addrr�)	r�r>r]�lower_suffix_contentsr�r�rzrl�new_namerrrr�
s"
zFileFinder._fill_cachecs��fdd�}|S)aA class method which returns a closure to use on sys.path_hook
        which will return an instance using the specified loaders and the path
        called on the closure.

        If the path called on the closure is not a directory, ImportError is
        raised.

        cs"t|�std|d���|f���S)z-Path hook for importlib.machinery.FileFinder.zonly directories are supportedrD)rRr�rD�rr�rr�path_hook_for_FileFinder6sz6FileFinder.path_hook.<locals>.path_hook_for_FileFinderr)rr�r�rr�r�	path_hook,s
zFileFinder.path_hookcCsd�|j�S)NzFileFinder({!r}))rYr>rHrrrr�>szFileFinder.__repr__)N)r�r�r�r�rr�r�rr�r�rr�rr�r�rrrrr��s
3
r�cCs�|�d�}|�d�}|sB|r$|j}n||kr8t||�}n
t||�}|sTt|||d�}z$||d<||d<||d<||d<Wntk
r�YnXdS)N�
__loader__�__spec__r��__file__�
__cached__)�getr�rhr_r��	Exception)�nsr��pathname�	cpathnamer�r�rrr�_fix_up_moduleDs"


r�cCs*ttt���f}ttf}ttf}|||gS)z_Returns a list of file-based module loaders.

    Each item is a tuple (loader, suffixes).
    )rN�_alternative_architecturesr��extension_suffixesr_r�rhr{)�
extensions�source�bytecoderrrr�[sr�c	Cs�|atjatjatjt}dD]0}|tjkr8t�|�}n
tj|}t|||�qddgfdddgff}|D]X\}}|d}|tjkr�tj|}q�qjzt�|�}Wq�Wqjtk
r�YqjYqjXqjtd��t|d|�t|d	|�t|d
d�|��t|dd
d�|D��t�d�}	t|d|	�t�d�}
t|d|
�|dk�rXt�d�}t|d|�t|dt	��t
�tt�
���|dk�r�t�d�dt
k�r�dt_dS)z�Setup the path-based importers for importlib by importing needed
    built-in modules and injecting them into the global namespace.

    Other components are extracted from the core bootstrap module.

    )r_rl�builtinsr��posixr�ntrrzimportlib requires posix or ntrr8r.r�_pathseps_with_coloncSsh|]}d|���qSrrrrrrr�sz_setup.<locals>.<setcomp>�_thread�_weakref�winregrrz.pywz_d.pydTN)r�rr�r}r��_builtin_from_namer�r�r;rrpr�r�r�r�r:r�r)�_bootstrap_module�self_module�builtin_name�builtin_module�
os_details�
builtin_osr.r8�	os_module�
thread_module�weakref_module�
winreg_modulerrr�_setupfsL













r�cCs2t|�t�}tj�tj|�g�tj�t	�dS)z)Install the path-based import components.N)
r�r�rr�r�r�r��	meta_pathr:r�)r��supported_loadersrrr�_install�sr��-arm-linux-gnueabihf.�-armeb-linux-gnueabihf.�-mips64-linux-gnuabi64.�-mips64el-linux-gnuabi64.�-powerpc-linux-gnu.�-powerpc-linux-gnuspe.�-powerpc64-linux-gnu.�-powerpc64le-linux-gnu.�-arm-linux-gnueabi.�-armeb-linux-gnueabi.�-mips64-linux-gnu.�-mips64el-linux-gnu.�-ppc-linux-gnu.�-ppc-linux-gnuspe.�-ppc64-linux-gnu.�-ppc64le-linux-gnu.)r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�cCsF|D]<}t��D].\}}||kr|�|�||��|Sqq|S)z�Add a suffix with an alternative architecture name
    to the list of suffixes so an extension built with
    the default (upstream) setting is loadable with our Pythons
    )�	_ARCH_MAPr�r:rT)r�rl�original�alternativerrrr��sr�)rV)N)NNN)rr)T)N)N)Rr�r�r_rrlr�r�_MS_WINDOWSr�rr�r�r.r8r�r6r;r�r�%_CASE_INSENSITIVE_PLATFORMS_BYTES_KEYrrr#r(r)r@rHrJrOrPrRrUrf�type�__code__r�r!r�r r%r9r~rzr�r{�DEBUG_BYTECODE_SUFFIXES�OPTIMIZED_BYTECODE_SUFFIXESr�r�r�r�r�r�r�r�r�r�r�r�r�r��objectr�r�r�rr&r@r_rhrprNrqr�r�r�r�r�r�r�r�r�rrrr�<module>s�



�

	



G(!



�D@H-:?*
A	�__pycache__/resources.cpython-38.opt-2.pyc000064400000012057150327175520014372 0ustar00U

e5d@%�	@s�ddlZddlZddlmZddlmZmZddlm	Z	ddl
mZddlm
Z
mZddlmZdd	lmZdd
lmZmZmZmZmZddlmZddlmZmZdd
lmZdddddddddg	Zee efZ!ee ej"fZ#ed�dd�Z$e d�dd�Z%eeej&d�dd�Z'dd �Z(e!e#ed!�d"d�Z)d-e!e#e e ed%�d&d�Z*e!e#e+d!�d'd�Z,d.e!e#e e e d%�d(d�Z-ee!e#eed!�d)d��Z.e!e e/d*�d+d�Z0e!ee d�d,d�Z1dS)/�N�)�abc)�contextmanager�suppress)�
import_module)�ResourceLoader)�BytesIO�
TextIOWrapper)�Path)�
ModuleType)�Iterable�Iterator�Optional�Set�Union)�cast)�BinaryIO�TextIO)�ZipImportError�Package�Resource�contents�is_resource�open_binary�	open_text�path�read_binary�	read_text)�returncCs\t|d�r0|jjdkr*td�|jj���qX|Sn(t|�}|jjdkrTtd�|���n|SdS)N�__spec__z{!r} is not a package)�hasattrr�submodule_search_locations�	TypeError�format�namer)�package�module�r'�+/usr/lib64/python3.8/importlib/resources.py�_get_package"s
�r)cCs,tj�|�\}}|r$td�|���n|SdS)Nz{!r} must be only a file name)�osr�split�
ValueErrorr#)r�parent�	file_namer'r'r(�_normalize_path6sr/)r%rcCs,|j}t|jd�r(ttj|j�|j��SdS)N�get_resource_reader)rr �loaderr�
resources_abc�ResourceReaderr0r$)r%�specr'r'r(�_get_resource_readerBs�r5cCs&|jjdks|jjs"td|����dS)NzPackage has no location )r�origin�has_location�FileNotFoundError)r%r'r'r(�_check_locationPsr9)r%�resourcerc
Cs�t|�}t|�}t|�}|dk	r*|�|�St|�tj�|jj	�}tj�
|�}tj�||�}zt|dd�WSt
k
r�tt|jj�}d}t|jjd�r�tt
��|�|�}W5QRX|dkr�|jj}d�||�}	t|	��nt|�YSYnXdS)N�rb)�mode�get_data�{!r} resource not found in {!r})r/r)r5�
open_resourcer9r*r�abspathrr6�dirname�join�open�OSErrorrrr1r rr=r$r#r8r)
r%r:�reader�absolute_package_path�package_path�	full_pathr1�data�package_name�messager'r'r(rUs2

�
�utf-8�strict)r%r:�encoding�errorsrcCs
t|�}t|�}t|�}|dk	r2t|�|�||�St|�tj�|j	j
�}tj�|�}tj�||�}zt
|d||d�WStk
�rtt|j	j�}d}	t|j	jd�r�tt��|�|�}	W5QRX|	dkr�|j	j}
d�||
�}t|��ntt|	�||�YSYnXdS)N�r)r<rNrOr=r>)r/r)r5r	r?r9r*rr@rr6rArBrCrDrrr1r rr=r$r#r8r)r%r:rNrOrErFrGrHr1rIrJrKr'r'r(rts2
�
c
Cs:t|�}t|�}t||��}|��W5QR�SQRXdS�N)r/r)r�read)r%r:�fpr'r'r(r�sc
Cs>t|�}t|�}t||||��}|��W5QR�SQRXdSrQ)r/r)rrR)r%r:rNrOrSr'r'r(r�s	c	cst|�}t|�}t|�}|dk	rNzt|�|��VWdStk
rJYqVXnt|�d}|jjdk	r|t|jj�j	}||}|dk	r�|�
�r�|Vnxt||��}|��}W5QRXt
��\}}z$t�||�t�|�t|�VW5zt�|�Wntk
�rYnXXdSrQ)r/r)r5r
�
resource_pathr8r9rr6r-�existsrrR�tempfileZmkstempr*�remove�write�close)	r%r:rEZ	file_path�package_directoryrSrI�fdZraw_pathr'r'r(r�s6

)r%r$rc	Cs|t|�}t|�t|�}|dk	r*|�|�Sztt|��}Wnttfk
rTYdSX||krbdSt|j	j
�j|}|��S)NF)
r)r/r5r�setr�NotADirectoryErrorr8r
rr6r-�is_file)r%r$rEZpackage_contentsrr'r'r(r�s
cCsTt|�}t|�}|dk	r |��S|jjdks4|jjs8dSt|jj�j}t�	|�SdS)Nr')
r)r5rrr6r7r
r-r*�listdir)r%rErZr'r'r(r�s)rLrM)rLrM)2r*rV�rr2�
contextlibrr�	importlibr�
importlib.abcr�iorr	�pathlibr
�typesr�typingrr
rrrrZ	typing.iorrZ	zipimportr�__all__�strr�PathLikerr)r/r3r5r9rr�bytesrrr�boolrrr'r'r'r(�<module>sh�

�!��"
��.__pycache__/machinery.cpython-38.opt-1.pyc000064400000001704150327175520014333 0ustar00U

e5dL�@s�dZddlZddlmZddlmZddlmZddlmZmZm	Z	m
Z
mZddlmZdd	lm
Z
dd
lmZddlmZddlmZdd
lmZdd�ZdS)z9The machinery of importlib: finders, loaders, hooks, etc.�N�)�
ModuleSpec)�BuiltinImporter)�FrozenImporter)�SOURCE_SUFFIXES�DEBUG_BYTECODE_SUFFIXES�OPTIMIZED_BYTECODE_SUFFIXES�BYTECODE_SUFFIXES�EXTENSION_SUFFIXES)�WindowsRegistryFinder)�
PathFinder)�
FileFinder)�SourceFileLoader)�SourcelessFileLoader)�ExtensionFileLoadercCstttS)zAReturns a list of all recognized module suffixes for this process)rr	r
�rr�+/usr/lib64/python3.8/importlib/machinery.py�all_suffixessr)�__doc__�_imp�
_bootstraprrr�_bootstrap_externalrrrr	r
rrr
rrrrrrrr�<module>s__pycache__/abc.cpython-38.opt-1.pyc000064400000032407150327175520013105 0ustar00U

e5dI2�
@s�dZddlmZddlmZddlmZzddlZWn2ek
rfZzejdkrR�dZW5dZ[XYnXzddl	Z	Wn&ek
r�ZzeZ	W5dZ[XYnXddl
Z
ddlZdd	�ZGd
d�de
j
d�ZGd
d�de�Zeeejejejej�Gdd�de�Zeeej�Gdd�de
j
d�ZGdd�de�ZGdd�de�Zeeejej�Gdd�de�Zeeej�Gdd�dejee�Zeeejej�Gdd�dejee�Zeeej�Gdd�de
j
d�Zeeej�dS)z(Abstract base classes related to import.�)�
_bootstrap)�_bootstrap_external)�	machinery�N�_frozen_importlibc	Gs\|D]R}|�|�tdk	rztt|j�}Wn tk
rJtt|j�}YnX|�|�qdS)N)�registerr�getattr�__name__�AttributeError�_frozen_importlib_external)�abstract_cls�classes�cls�
frozen_cls�r�%/usr/lib64/python3.8/importlib/abc.py�	_registers
rc@s eZdZdZejddd��ZdS)�Findera<Legacy abstract base class for import finders.

    It may be subclassed for compatibility with legacy third party
    reimplementations of the import system.  Otherwise, finder
    implementations should derive from the more specific MetaPathFinder
    or PathEntryFinder ABCs.

    Deprecated since Python 3.3
    NcCsdS)z�An abstract method that should find a module.
        The fullname is a str and the optional path is a str or None.
        Returns a Loader object or None.
        Nr)�self�fullname�pathrrr�find_module*szFinder.find_module)N)r	�
__module__�__qualname__�__doc__�abc�abstractmethodrrrrrrs
r)�	metaclassc@s eZdZdZdd�Zdd�ZdS)�MetaPathFinderz8Abstract base class for import finders on sys.meta_path.cCs<tjdtdd�t|d�sdS|�||�}|dk	r8|jSdS)a_Return a loader for the module.

        If no module is found, return None.  The fullname is a str and
        the path is a list of strings or None.

        This method is deprecated since Python 3.4 in favor of
        finder.find_spec(). If find_spec() exists then backwards-compatible
        functionality is provided for this method.

        zxMetaPathFinder.find_module() is deprecated since Python 3.4 in favor of MetaPathFinder.find_spec() (available since 3.4)���
stacklevel�	find_specN)�warnings�warn�DeprecationWarning�hasattrr"�loader)rrr�foundrrrr9s�
zMetaPathFinder.find_modulecCsdS)z�An optional method for clearing the finder's cache, if any.
        This method is used by importlib.invalidate_caches().
        Nr�rrrr�invalidate_cachesNsz MetaPathFinder.invalidate_cachesN)r	rrrrr*rrrrr2src@s&eZdZdZdd�ZejZdd�ZdS)�PathEntryFinderz>Abstract base class for path entry finders used by PathFinder.cCs\tjdtdd�t|d�s"dgfS|�|�}|dk	rP|js@g}n|j}|j|fSdgfSdS)a[Return (loader, namespace portion) for the path entry.

        The fullname is a str.  The namespace portion is a sequence of
        path entries contributing to part of a namespace package. The
        sequence may be empty.  If loader is not None, the portion will
        be ignored.

        The portion will be discarded if another path entry finder
        locates the module as a normal module or package.

        This method is deprecated since Python 3.4 in favor of
        finder.find_spec(). If find_spec() is provided than backwards-compatible
        functionality is provided.
        zzPathEntryFinder.find_loader() is deprecated since Python 3.4 in favor of PathEntryFinder.find_spec() (available since 3.4)rr r"N)r#r$r%r&r"�submodule_search_locationsr')rrr(�portionsrrr�find_loader^s�


zPathEntryFinder.find_loadercCsdS)z�An optional method for clearing the finder's cache, if any.
        This method is used by PathFinder.invalidate_caches().
        Nrr)rrrr*�sz!PathEntryFinder.invalidate_cachesN)	r	rrrr.r�_find_module_shimrr*rrrrr+Ws r+c@s(eZdZdZdd�Zdd�Zdd�ZdS)	�Loaderz'Abstract base class for import loaders.cCsdS)z�Return a module to initialize and into which to load.

        This method should raise ImportError if anything prevents it
        from creating a new module.  It may return None to indicate
        that the spec should create the new module.
        Nr)r�specrrr�
create_module�szLoader.create_modulecCst|d�st�t�||�S)a�Return the loaded module.

        The module must be added to sys.modules and have import-related
        attributes set properly.  The fullname is a str.

        ImportError is raised on failure.

        This method is deprecated in favor of loader.exec_module(). If
        exec_module() exists then it is used to provide a backwards-compatible
        functionality for this method.

        �exec_module)r&�ImportErrorr�_load_module_shim�rrrrr�load_module�s
zLoader.load_modulecCst�dS)z�Return a module's repr.

        Used by the module type when the method does not raise
        NotImplementedError.

        This method is deprecated.

        N)�NotImplementedError)r�modulerrr�module_repr�s
zLoader.module_reprN)r	rrrr2r7r:rrrrr0�s
r0c@seZdZdZejdd��ZdS)�ResourceLoaderz�Abstract base class for loaders which can return data from their
    back-end storage.

    This ABC represents one of the optional protocols specified by PEP 302.

    cCst�dS)zwAbstract method which when implemented should return the bytes for
        the specified path.  The path must be a str.N)�OSError�rrrrr�get_data�szResourceLoader.get_dataN)r	rrrrrr>rrrrr;�sr;c@sLeZdZdZdd�Zdd�Zejdd��Ze	dd	d
��Z
ejj
Z
ejjZdS)
�
InspectLoaderz�Abstract base class for loaders which support inspection about the
    modules they can load.

    This ABC represents one of the optional protocols specified by PEP 302.

    cCst�dS)z�Optional method which when implemented should return whether the
        module is a package.  The fullname is a str.  Returns a bool.

        Raises ImportError if the module cannot be found.
        N�r4r6rrr�
is_package�szInspectLoader.is_packagecCs |�|�}|dkrdS|�|�S)aMethod which returns the code object for the module.

        The fullname is a str.  Returns a types.CodeType if possible, else
        returns None if a code object does not make sense
        (e.g. built-in module). Raises ImportError if the module cannot be
        found.
        N)�
get_source�source_to_code)rr�sourcerrr�get_code�s
zInspectLoader.get_codecCst�dS)z�Abstract method which should return the source code for the
        module.  The fullname is a str.  Returns a str.

        Raises ImportError if the module cannot be found.
        Nr@r6rrrrB�szInspectLoader.get_source�<string>cCst||ddd�S)z�Compile 'data' into a code object.

        The 'data' argument can be anything that compile() can handle. The'path'
        argument should be where the data was retrieved (when applicable).�execT)�dont_inherit)�compile)�datarrrrrC�szInspectLoader.source_to_codeN)rF)r	rrrrArErrrB�staticmethodrCr�
_LoaderBasicsr3r7rrrrr?�s

r?c@s&eZdZdZejdd��Zdd�ZdS)�ExecutionLoaderz�Abstract base class for loaders that wish to support the execution of
    modules as scripts.

    This ABC represents one of the optional protocols specified in PEP 302.

    cCst�dS)z�Abstract method which should return the value that __file__ is to be
        set to.

        Raises ImportError if the module cannot be found.
        Nr@r6rrr�get_filenameszExecutionLoader.get_filenamecCsT|�|�}|dkrdSz|�|�}Wntk
rB|�|�YSX|�||�SdS)z�Method to return the code object for fullname.

        Should return None if not applicable (e.g. built-in module).
        Raise ImportError if the module cannot be found.
        N)rBrNr4rC)rrrDrrrrrEs
zExecutionLoader.get_codeN)r	rrrrrrNrErrrrrM�s
rMc@seZdZdZdS)�
FileLoaderz[Abstract base class partially implementing the ResourceLoader and
    ExecutionLoader ABCs.N)r	rrrrrrrrO!srOc@s(eZdZdZdd�Zdd�Zdd�ZdS)	�SourceLoadera�Abstract base class for loading source code (and optionally any
    corresponding bytecode).

    To support loading from source code, the abstractmethods inherited from
    ResourceLoader and ExecutionLoader need to be implemented. To also support
    loading from bytecode, the optional methods specified directly by this ABC
    is required.

    Inherited abstractmethods not implemented in this ABC:

        * ResourceLoader.get_data
        * ExecutionLoader.get_filename

    cCs$|jjtjkrt�t|�|�d�S)z6Return the (int) modification time for the path (str).�mtime)�
path_stats�__func__rPr<�intr=rrr�
path_mtime;szSourceLoader.path_mtimecCs |jjtjkrt�d|�|�iS)aReturn a metadata dict for the source pointed to by the path (str).
        Possible keys:
        - 'mtime' (mandatory) is the numeric timestamp of last source
          code modification;
        - 'size' (optional) is the size in bytes of the source code.
        rQ)rUrSrPr<r=rrrrRAszSourceLoader.path_statscCsdS)aWrite the bytes to the path (if possible).

        Accepts a str path and data as bytes.

        Any needed intermediary directories are to be created. If for some
        reason the file cannot be written because of permissions, fail
        silently.
        Nr)rrrJrrr�set_dataLszSourceLoader.set_dataN)r	rrrrUrRrVrrrrrP*srPc@sHeZdZdZejdd��Zejdd��Zejdd��Zejdd	��Z	d
S)�ResourceReaderz�Abstract base class to provide resource-reading support.

    Loaders that support resource reading are expected to implement
    the ``get_resource_reader(fullname)`` method and have it either return None
    or an object compatible with this ABC.
    cCst�dS)aReturn an opened, file-like object for binary reading.

        The 'resource' argument is expected to represent only a file name
        and thus not contain any subdirectory components.

        If the resource cannot be found, FileNotFoundError is raised.
        N��FileNotFoundError�r�resourcerrr�
open_resourcebs	zResourceReader.open_resourcecCst�dS)a!Return the file system path to the specified resource.

        The 'resource' argument is expected to represent only a file name
        and thus not contain any subdirectory components.

        If the resource does not exist on the file system, raise
        FileNotFoundError.
        NrXrZrrr�
resource_pathms
zResourceReader.resource_pathcCst�dS)z7Return True if the named 'name' is consider a resource.NrX)r�namerrr�is_resourceyszResourceReader.is_resourcecCsgS)z?Return an iterable of strings over the contents of the package.rr)rrr�contents~szResourceReader.contentsN)
r	rrrrrr\r]r_r`rrrrrWYs



rW) r�rrrrr4�excr^rrr#r�ABCMetarr�BuiltinImporter�FrozenImporter�
PathFinder�WindowsRegistryFinderr+�
FileFinderr0r;r?rM�ExtensionFileLoaderrO�SourceFileLoader�SourcelessFileLoaderrPrWrrrr�<module>sL
!�./2"�,+__pycache__/resources.cpython-38.pyc000064400000014560150327175520013433 0ustar00U

e5d@%�	@s�ddlZddlZddlmZddlmZmZddlm	Z	ddl
mZddlm
Z
mZddlmZdd	lmZdd
lmZmZmZmZmZddlmZddlmZmZdd
lmZdddddddddg	Zee efZ!ee ej"fZ#ed�dd�Z$e d�dd�Z%eeej&d�dd�Z'dd �Z(e!e#ed!�d"d�Z)d-e!e#e e ed%�d&d�Z*e!e#e+d!�d'd�Z,d.e!e#e e e d%�d(d�Z-ee!e#eed!�d)d��Z.e!e e/d*�d+d�Z0e!ee d�d,d�Z1dS)/�N�)�abc)�contextmanager�suppress)�
import_module)�ResourceLoader)�BytesIO�
TextIOWrapper)�Path)�
ModuleType)�Iterable�Iterator�Optional�Set�Union)�cast)�BinaryIO�TextIO)�ZipImportError�Package�Resource�contents�is_resource�open_binary�	open_text�path�read_binary�	read_text)�returncCs\t|d�r0|jjdkr*td�|jj���qX|Sn(t|�}|jjdkrTtd�|���n|SdS)z�Take a package name or module object and return the module.

    If a name, the module is imported.  If the passed or imported module
    object is not a package, raise an exception.
    �__spec__Nz{!r} is not a package)�hasattrr�submodule_search_locations�	TypeError�format�namer)�package�module�r'�+/usr/lib64/python3.8/importlib/resources.py�_get_package"s
�r)cCs,tj�|�\}}|r$td�|���n|SdS)z�Normalize a path by ensuring it is a string.

    If the resulting string contains path separators, an exception is raised.
    z{!r} must be only a file nameN)�osr�split�
ValueErrorr#)r�parent�	file_namer'r'r(�_normalize_path6sr/)r%rcCs,|j}t|jd�r(ttj|j�|j��SdS)N�get_resource_reader)rr �loaderr�
resources_abc�ResourceReaderr0r$)r%�specr'r'r(�_get_resource_readerBs�r5cCs&|jjdks|jjs"td|����dS)NzPackage has no location )r�origin�has_location�FileNotFoundError)r%r'r'r(�_check_locationPsr9)r%�resourcerc
Cs�t|�}t|�}t|�}|dk	r*|�|�St|�tj�|jj	�}tj�
|�}tj�||�}zt|dd�WSt
k
r�tt|jj�}d}t|jjd�r�tt
��|�|�}W5QRX|dkr�|jj}d�||�}	t|	��nt|�YSYnXdS)zDReturn a file-like object opened for binary reading of the resource.N�rb)�mode�get_data�{!r} resource not found in {!r})r/r)r5�
open_resourcer9r*r�abspathrr6�dirname�join�open�OSErrorrrr1r rr=r$r#r8r)
r%r:�reader�absolute_package_path�package_path�	full_pathr1�data�package_name�messager'r'r(rUs2

�
�utf-8�strict)r%r:�encoding�errorsrcCs
t|�}t|�}t|�}|dk	r2t|�|�||�St|�tj�|j	j
�}tj�|�}tj�||�}zt
|d||d�WStk
�rtt|j	j�}d}	t|j	jd�r�tt��|�|�}	W5QRX|	dkr�|j	j}
d�||
�}t|��ntt|	�||�YSYnXdS)zBReturn a file-like object opened for text reading of the resource.N�r)r<rNrOr=r>)r/r)r5r	r?r9r*rr@rr6rArBrCrDrrr1r rr=r$r#r8r)r%r:rNrOrErFrGrHr1rIrJrKr'r'r(rts2
�
c
Cs:t|�}t|�}t||��}|��W5QR�SQRXdS)z+Return the binary contents of the resource.N)r/r)r�read)r%r:�fpr'r'r(r�sc
Cs>t|�}t|�}t||||��}|��W5QR�SQRXdS)z�Return the decoded string of the resource.

    The decoding-related arguments have the same semantics as those of
    bytes.decode().
    N)r/r)rrQ)r%r:rNrOrRr'r'r(r�s	c	cst|�}t|�}t|�}|dk	rNzt|�|��VWdStk
rJYqVXnt|�d}|jjdk	r|t|jj�j	}||}|dk	r�|�
�r�|Vnxt||��}|��}W5QRXt
��\}}z$t�||�t�|�t|�VW5zt�|�Wntk
�rYnXXdS)akA context manager providing a file path object to the resource.

    If the resource does not already exist on its own on the file system,
    a temporary file will be created. If the file was created, the file
    will be deleted upon exiting the context manager (no exception is
    raised if the file was deleted prior to the context manager
    exiting).
    N)r/r)r5r
�
resource_pathr8r9rr6r-�existsrrQ�tempfileZmkstempr*�remove�write�close)	r%r:rEZ	file_path�package_directoryrRrI�fdZraw_pathr'r'r(r�s6

)r%r$rc	Cs|t|�}t|�t|�}|dk	r*|�|�Sztt|��}Wnttfk
rTYdSX||krbdSt|j	j
�j|}|��S)zYTrue if 'name' is a resource inside 'package'.

    Directories are *not* resources.
    NF)
r)r/r5r�setr�NotADirectoryErrorr8r
rr6r-�is_file)r%r$rEZpackage_contentsrr'r'r(r�s
cCsTt|�}t|�}|dk	r |��S|jjdks4|jjs8dSt|jj�j}t�	|�SdS)z�Return an iterable of entries in 'package'.

    Note that not all entries are resources.  Specifically, directories are
    not considered resources.  Use `is_resource()` on each entry returned here
    to check if it is a resource or not.
    Nr')
r)r5rrr6r7r
r-r*�listdir)r%rErYr'r'r(r�s)rLrM)rLrM)2r*rU�rr2�
contextlibrr�	importlibr�
importlib.abcr�iorr	�pathlibr
�typesr�typingrr
rrrrZ	typing.iorrZ	zipimportr�__all__�strr�PathLikerr)r/r3r5r9rr�bytesrrr�boolrrr'r'r'r(�<module>sh�

�!��"
��.__pycache__/util.cpython-38.opt-2.pyc000064400000014431150327175520013333 0ustar00U

e5d7,�@s(ddlmZddlmZddlmZddlmZddlmZddlmZddlm	Z	ddlm
Z
dd	lmZdd
lmZddlm
Z
dd
lmZddlZddlZddlZddlZddlZdd�Zdd�Zd#dd�Zd$dd�Zedd��Zdd�Zdd�Zdd�ZGdd �d ej�ZGd!d"�d"ej�Z dS)%�)�abc)�module_from_spec)�
_resolve_name)�spec_from_loader)�
_find_spec)�MAGIC_NUMBER)�_RAW_MAGIC_NUMBER)�cache_from_source)�
decode_source)�source_from_cache)�spec_from_file_location�)�contextmanagerNcCst�t|�S�N)�_imp�source_hashr)�source_bytes�r�&/usr/lib64/python3.8/importlib/util.pyrsrcCs\|�d�s|S|s&tdt|��d���d}|D]}|dkr>qH|d7}q.t||d�||�S)N�.zno package specified for z% (required for relative module names)r
r)�
startswith�
ValueError�reprr)�name�package�level�	characterrrr�resolve_names

rcCsx|tjkrt||�Stj|}|dkr*dSz
|j}Wn$tk
rXtd�|��d�YnX|dkrptd�|���|SdS)N�{}.__spec__ is not set�{}.__spec__ is None)�sys�modulesr�__spec__�AttributeErrorr�format)r�path�module�specrrr�_find_spec_from_path*s



r(c	
Cs�|�d�rt||�n|}|tjkr�|�d�d}|r�t|dgd�}z
|j}Wq�tk
r�}ztd|�d|��|d�|�W5d}~XYq�Xnd}t	||�Stj|}|dkr�dSz
|j
}Wn$tk
r�td�|��d�YnX|dkr�td	�|���|SdS)
Nrr
�__path__)�fromlistz __path__ attribute not found on z while trying to find )rrr)
rrr r!�
rpartition�
__import__r)r#�ModuleNotFoundErrorrr"rr$)	rr�fullname�parent_name�parent�parent_path�er&r'rrr�	find_specIs4

��


r3ccs�|tjk}tj�|�}|s6tt�|�}d|_|tj|<zJz
|VWn:tk
r||sxztj|=Wntk
rvYnXYnXW5d|_XdS)NTF)r r!�get�type�__initializing__�	Exception�KeyError)r�	is_reloadr&rrr�_module_to_loadvs


r:cst����fdd��}|S)NcsRtjdtdd��||�}t|dd�dkrN|j|_t|d�sN|j�d�d|_|S)N�7The import system now takes care of this automatically.���
stacklevel�__package__r)rr
)�warnings�warn�DeprecationWarning�getattr�__name__r?�hasattrr+)�args�kwargsr&��fxnrr�set_package_wrapper�s�

z(set_package.<locals>.set_package_wrapper��	functools�wraps)rIrJrrHr�set_package�s	rNcst����fdd��}|S)Ncs:tjdtdd��|f|�|�}t|dd�dkr6||_|S)Nr;r<r=�
__loader__)r@rArBrCrO)�selfrFrGr&rHrr�set_loader_wrapper�s�z&set_loader.<locals>.set_loader_wrapperrK)rIrQrrHr�
set_loader�srRcs*tjdtdd�t����fdd��}|S)Nr;r<r=c
s|t|��j}||_z|�|�}Wnttfk
r6YnX|rD||_n|�d�d|_�||f|�|�W5QR�SQRXdS)Nrr
)r:rO�
is_package�ImportErrorr#r?r+)rPr.rFrGr&rSrHrr�module_for_loader_wrapper�s
z4module_for_loader.<locals>.module_for_loader_wrapper)r@rArBrLrM)rIrUrrHr�module_for_loader�s�rVc@seZdZdd�Zdd�ZdS)�_LazyModulec	Cs�tj|_|jj}|jjd}|jjd}|j}i}|��D]:\}}||krT|||<q:t||�t||�kr:|||<q:|jj	�
|�|tjkr�t|�ttj|�kr�t
d|�d���|j�|�t||�S)N�__dict__�	__class__zmodule object for z. substituted in sys.modules during a lazy load)�types�
ModuleTyperYr"r�loader_staterX�items�id�loader�exec_moduler r!r�updaterC)	rP�attr�
original_name�
attrs_then�
original_type�	attrs_now�
attrs_updated�key�valuerrr�__getattribute__�s"


z_LazyModule.__getattribute__cCs|�|�t||�dSr)rj�delattr)rPrbrrr�__delattr__s
z_LazyModule.__delattr__N)rD�
__module__�__qualname__rjrlrrrrrW�s#rWc@s<eZdZedd��Zedd��Zdd�Zdd�Zd	d
�Z	dS)�
LazyLoadercCst|d�std��dS)Nr`z loader must define exec_module())rE�	TypeError)r_rrr�__check_eager_loaders
zLazyLoader.__check_eager_loadercs������fdd�S)Ncs��||��Srr)rFrG��clsr_rr�<lambda>�z$LazyLoader.factory.<locals>.<lambda>)�_LazyLoader__check_eager_loaderrrrrrr�factorys
zLazyLoader.factorycCs|�|�||_dSr)rvr_)rPr_rrr�__init__s
zLazyLoader.__init__cCs|j�|�Sr)r_�
create_module)rPr'rrrryszLazyLoader.create_modulecCs@|j|j_|j|_i}|j��|d<|j|d<||j_t|_dS)NrXrY)r_r"rOrX�copyrYr\rW)rPr&r\rrrr` s

zLazyLoader.exec_moduleN)
rDrmrn�staticmethodrv�classmethodrwrxryr`rrrrro
s

ro)N)N)!�r�
_bootstraprrrr�_bootstrap_externalrrr	r
rr�
contextlibrrrLr rZr@rrr(r3r:rNrRrVr[rW�Loaderrorrrr�<module>s6

-
'/__pycache__/abc.cpython-38.pyc000064400000032407150327175520012146 0ustar00U

e5dI2�
@s�dZddlmZddlmZddlmZzddlZWn2ek
rfZzejdkrR�dZW5dZ[XYnXzddl	Z	Wn&ek
r�ZzeZ	W5dZ[XYnXddl
Z
ddlZdd	�ZGd
d�de
j
d�ZGd
d�de�Zeeejejejej�Gdd�de�Zeeej�Gdd�de
j
d�ZGdd�de�ZGdd�de�Zeeejej�Gdd�de�Zeeej�Gdd�dejee�Zeeejej�Gdd�dejee�Zeeej�Gdd�de
j
d�Zeeej�dS)z(Abstract base classes related to import.�)�
_bootstrap)�_bootstrap_external)�	machinery�N�_frozen_importlibc	Gs\|D]R}|�|�tdk	rztt|j�}Wn tk
rJtt|j�}YnX|�|�qdS)N)�registerr�getattr�__name__�AttributeError�_frozen_importlib_external)�abstract_cls�classes�cls�
frozen_cls�r�%/usr/lib64/python3.8/importlib/abc.py�	_registers
rc@s eZdZdZejddd��ZdS)�Findera<Legacy abstract base class for import finders.

    It may be subclassed for compatibility with legacy third party
    reimplementations of the import system.  Otherwise, finder
    implementations should derive from the more specific MetaPathFinder
    or PathEntryFinder ABCs.

    Deprecated since Python 3.3
    NcCsdS)z�An abstract method that should find a module.
        The fullname is a str and the optional path is a str or None.
        Returns a Loader object or None.
        Nr)�self�fullname�pathrrr�find_module*szFinder.find_module)N)r	�
__module__�__qualname__�__doc__�abc�abstractmethodrrrrrrs
r)�	metaclassc@s eZdZdZdd�Zdd�ZdS)�MetaPathFinderz8Abstract base class for import finders on sys.meta_path.cCs<tjdtdd�t|d�sdS|�||�}|dk	r8|jSdS)a_Return a loader for the module.

        If no module is found, return None.  The fullname is a str and
        the path is a list of strings or None.

        This method is deprecated since Python 3.4 in favor of
        finder.find_spec(). If find_spec() exists then backwards-compatible
        functionality is provided for this method.

        zxMetaPathFinder.find_module() is deprecated since Python 3.4 in favor of MetaPathFinder.find_spec() (available since 3.4)���
stacklevel�	find_specN)�warnings�warn�DeprecationWarning�hasattrr"�loader)rrr�foundrrrr9s�
zMetaPathFinder.find_modulecCsdS)z�An optional method for clearing the finder's cache, if any.
        This method is used by importlib.invalidate_caches().
        Nr�rrrr�invalidate_cachesNsz MetaPathFinder.invalidate_cachesN)r	rrrrr*rrrrr2src@s&eZdZdZdd�ZejZdd�ZdS)�PathEntryFinderz>Abstract base class for path entry finders used by PathFinder.cCs\tjdtdd�t|d�s"dgfS|�|�}|dk	rP|js@g}n|j}|j|fSdgfSdS)a[Return (loader, namespace portion) for the path entry.

        The fullname is a str.  The namespace portion is a sequence of
        path entries contributing to part of a namespace package. The
        sequence may be empty.  If loader is not None, the portion will
        be ignored.

        The portion will be discarded if another path entry finder
        locates the module as a normal module or package.

        This method is deprecated since Python 3.4 in favor of
        finder.find_spec(). If find_spec() is provided than backwards-compatible
        functionality is provided.
        zzPathEntryFinder.find_loader() is deprecated since Python 3.4 in favor of PathEntryFinder.find_spec() (available since 3.4)rr r"N)r#r$r%r&r"�submodule_search_locationsr')rrr(�portionsrrr�find_loader^s�


zPathEntryFinder.find_loadercCsdS)z�An optional method for clearing the finder's cache, if any.
        This method is used by PathFinder.invalidate_caches().
        Nrr)rrrr*�sz!PathEntryFinder.invalidate_cachesN)	r	rrrr.r�_find_module_shimrr*rrrrr+Ws r+c@s(eZdZdZdd�Zdd�Zdd�ZdS)	�Loaderz'Abstract base class for import loaders.cCsdS)z�Return a module to initialize and into which to load.

        This method should raise ImportError if anything prevents it
        from creating a new module.  It may return None to indicate
        that the spec should create the new module.
        Nr)r�specrrr�
create_module�szLoader.create_modulecCst|d�st�t�||�S)a�Return the loaded module.

        The module must be added to sys.modules and have import-related
        attributes set properly.  The fullname is a str.

        ImportError is raised on failure.

        This method is deprecated in favor of loader.exec_module(). If
        exec_module() exists then it is used to provide a backwards-compatible
        functionality for this method.

        �exec_module)r&�ImportErrorr�_load_module_shim�rrrrr�load_module�s
zLoader.load_modulecCst�dS)z�Return a module's repr.

        Used by the module type when the method does not raise
        NotImplementedError.

        This method is deprecated.

        N)�NotImplementedError)r�modulerrr�module_repr�s
zLoader.module_reprN)r	rrrr2r7r:rrrrr0�s
r0c@seZdZdZejdd��ZdS)�ResourceLoaderz�Abstract base class for loaders which can return data from their
    back-end storage.

    This ABC represents one of the optional protocols specified by PEP 302.

    cCst�dS)zwAbstract method which when implemented should return the bytes for
        the specified path.  The path must be a str.N)�OSError�rrrrr�get_data�szResourceLoader.get_dataN)r	rrrrrr>rrrrr;�sr;c@sLeZdZdZdd�Zdd�Zejdd��Ze	dd	d
��Z
ejj
Z
ejjZdS)
�
InspectLoaderz�Abstract base class for loaders which support inspection about the
    modules they can load.

    This ABC represents one of the optional protocols specified by PEP 302.

    cCst�dS)z�Optional method which when implemented should return whether the
        module is a package.  The fullname is a str.  Returns a bool.

        Raises ImportError if the module cannot be found.
        N�r4r6rrr�
is_package�szInspectLoader.is_packagecCs |�|�}|dkrdS|�|�S)aMethod which returns the code object for the module.

        The fullname is a str.  Returns a types.CodeType if possible, else
        returns None if a code object does not make sense
        (e.g. built-in module). Raises ImportError if the module cannot be
        found.
        N)�
get_source�source_to_code)rr�sourcerrr�get_code�s
zInspectLoader.get_codecCst�dS)z�Abstract method which should return the source code for the
        module.  The fullname is a str.  Returns a str.

        Raises ImportError if the module cannot be found.
        Nr@r6rrrrB�szInspectLoader.get_source�<string>cCst||ddd�S)z�Compile 'data' into a code object.

        The 'data' argument can be anything that compile() can handle. The'path'
        argument should be where the data was retrieved (when applicable).�execT)�dont_inherit)�compile)�datarrrrrC�szInspectLoader.source_to_codeN)rF)r	rrrrArErrrB�staticmethodrCr�
_LoaderBasicsr3r7rrrrr?�s

r?c@s&eZdZdZejdd��Zdd�ZdS)�ExecutionLoaderz�Abstract base class for loaders that wish to support the execution of
    modules as scripts.

    This ABC represents one of the optional protocols specified in PEP 302.

    cCst�dS)z�Abstract method which should return the value that __file__ is to be
        set to.

        Raises ImportError if the module cannot be found.
        Nr@r6rrr�get_filenameszExecutionLoader.get_filenamecCsT|�|�}|dkrdSz|�|�}Wntk
rB|�|�YSX|�||�SdS)z�Method to return the code object for fullname.

        Should return None if not applicable (e.g. built-in module).
        Raise ImportError if the module cannot be found.
        N)rBrNr4rC)rrrDrrrrrEs
zExecutionLoader.get_codeN)r	rrrrrrNrErrrrrM�s
rMc@seZdZdZdS)�
FileLoaderz[Abstract base class partially implementing the ResourceLoader and
    ExecutionLoader ABCs.N)r	rrrrrrrrO!srOc@s(eZdZdZdd�Zdd�Zdd�ZdS)	�SourceLoadera�Abstract base class for loading source code (and optionally any
    corresponding bytecode).

    To support loading from source code, the abstractmethods inherited from
    ResourceLoader and ExecutionLoader need to be implemented. To also support
    loading from bytecode, the optional methods specified directly by this ABC
    is required.

    Inherited abstractmethods not implemented in this ABC:

        * ResourceLoader.get_data
        * ExecutionLoader.get_filename

    cCs$|jjtjkrt�t|�|�d�S)z6Return the (int) modification time for the path (str).�mtime)�
path_stats�__func__rPr<�intr=rrr�
path_mtime;szSourceLoader.path_mtimecCs |jjtjkrt�d|�|�iS)aReturn a metadata dict for the source pointed to by the path (str).
        Possible keys:
        - 'mtime' (mandatory) is the numeric timestamp of last source
          code modification;
        - 'size' (optional) is the size in bytes of the source code.
        rQ)rUrSrPr<r=rrrrRAszSourceLoader.path_statscCsdS)aWrite the bytes to the path (if possible).

        Accepts a str path and data as bytes.

        Any needed intermediary directories are to be created. If for some
        reason the file cannot be written because of permissions, fail
        silently.
        Nr)rrrJrrr�set_dataLszSourceLoader.set_dataN)r	rrrrUrRrVrrrrrP*srPc@sHeZdZdZejdd��Zejdd��Zejdd��Zejdd	��Z	d
S)�ResourceReaderz�Abstract base class to provide resource-reading support.

    Loaders that support resource reading are expected to implement
    the ``get_resource_reader(fullname)`` method and have it either return None
    or an object compatible with this ABC.
    cCst�dS)aReturn an opened, file-like object for binary reading.

        The 'resource' argument is expected to represent only a file name
        and thus not contain any subdirectory components.

        If the resource cannot be found, FileNotFoundError is raised.
        N��FileNotFoundError�r�resourcerrr�
open_resourcebs	zResourceReader.open_resourcecCst�dS)a!Return the file system path to the specified resource.

        The 'resource' argument is expected to represent only a file name
        and thus not contain any subdirectory components.

        If the resource does not exist on the file system, raise
        FileNotFoundError.
        NrXrZrrr�
resource_pathms
zResourceReader.resource_pathcCst�dS)z7Return True if the named 'name' is consider a resource.NrX)r�namerrr�is_resourceyszResourceReader.is_resourcecCsgS)z?Return an iterable of strings over the contents of the package.rr)rrr�contents~szResourceReader.contentsN)
r	rrrrrr\r]r_r`rrrrrWYs



rW) r�rrrrr4�excr^rrr#r�ABCMetarr�BuiltinImporter�FrozenImporter�
PathFinder�WindowsRegistryFinderr+�
FileFinderr0r;r?rM�ExtensionFileLoaderrO�SourceFileLoader�SourcelessFileLoaderrPrWrrrr�<module>sL
!�./2"�,+__pycache__/resources.cpython-38.opt-1.pyc000064400000014560150327175520014372 0ustar00U

e5d@%�	@s�ddlZddlZddlmZddlmZmZddlm	Z	ddl
mZddlm
Z
mZddlmZdd	lmZdd
lmZmZmZmZmZddlmZddlmZmZdd
lmZdddddddddg	Zee efZ!ee ej"fZ#ed�dd�Z$e d�dd�Z%eeej&d�dd�Z'dd �Z(e!e#ed!�d"d�Z)d-e!e#e e ed%�d&d�Z*e!e#e+d!�d'd�Z,d.e!e#e e e d%�d(d�Z-ee!e#eed!�d)d��Z.e!e e/d*�d+d�Z0e!ee d�d,d�Z1dS)/�N�)�abc)�contextmanager�suppress)�
import_module)�ResourceLoader)�BytesIO�
TextIOWrapper)�Path)�
ModuleType)�Iterable�Iterator�Optional�Set�Union)�cast)�BinaryIO�TextIO)�ZipImportError�Package�Resource�contents�is_resource�open_binary�	open_text�path�read_binary�	read_text)�returncCs\t|d�r0|jjdkr*td�|jj���qX|Sn(t|�}|jjdkrTtd�|���n|SdS)z�Take a package name or module object and return the module.

    If a name, the module is imported.  If the passed or imported module
    object is not a package, raise an exception.
    �__spec__Nz{!r} is not a package)�hasattrr�submodule_search_locations�	TypeError�format�namer)�package�module�r'�+/usr/lib64/python3.8/importlib/resources.py�_get_package"s
�r)cCs,tj�|�\}}|r$td�|���n|SdS)z�Normalize a path by ensuring it is a string.

    If the resulting string contains path separators, an exception is raised.
    z{!r} must be only a file nameN)�osr�split�
ValueErrorr#)r�parent�	file_namer'r'r(�_normalize_path6sr/)r%rcCs,|j}t|jd�r(ttj|j�|j��SdS)N�get_resource_reader)rr �loaderr�
resources_abc�ResourceReaderr0r$)r%�specr'r'r(�_get_resource_readerBs�r5cCs&|jjdks|jjs"td|����dS)NzPackage has no location )r�origin�has_location�FileNotFoundError)r%r'r'r(�_check_locationPsr9)r%�resourcerc
Cs�t|�}t|�}t|�}|dk	r*|�|�St|�tj�|jj	�}tj�
|�}tj�||�}zt|dd�WSt
k
r�tt|jj�}d}t|jjd�r�tt
��|�|�}W5QRX|dkr�|jj}d�||�}	t|	��nt|�YSYnXdS)zDReturn a file-like object opened for binary reading of the resource.N�rb)�mode�get_data�{!r} resource not found in {!r})r/r)r5�
open_resourcer9r*r�abspathrr6�dirname�join�open�OSErrorrrr1r rr=r$r#r8r)
r%r:�reader�absolute_package_path�package_path�	full_pathr1�data�package_name�messager'r'r(rUs2

�
�utf-8�strict)r%r:�encoding�errorsrcCs
t|�}t|�}t|�}|dk	r2t|�|�||�St|�tj�|j	j
�}tj�|�}tj�||�}zt
|d||d�WStk
�rtt|j	j�}d}	t|j	jd�r�tt��|�|�}	W5QRX|	dkr�|j	j}
d�||
�}t|��ntt|	�||�YSYnXdS)zBReturn a file-like object opened for text reading of the resource.N�r)r<rNrOr=r>)r/r)r5r	r?r9r*rr@rr6rArBrCrDrrr1r rr=r$r#r8r)r%r:rNrOrErFrGrHr1rIrJrKr'r'r(rts2
�
c
Cs:t|�}t|�}t||��}|��W5QR�SQRXdS)z+Return the binary contents of the resource.N)r/r)r�read)r%r:�fpr'r'r(r�sc
Cs>t|�}t|�}t||||��}|��W5QR�SQRXdS)z�Return the decoded string of the resource.

    The decoding-related arguments have the same semantics as those of
    bytes.decode().
    N)r/r)rrQ)r%r:rNrOrRr'r'r(r�s	c	cst|�}t|�}t|�}|dk	rNzt|�|��VWdStk
rJYqVXnt|�d}|jjdk	r|t|jj�j	}||}|dk	r�|�
�r�|Vnxt||��}|��}W5QRXt
��\}}z$t�||�t�|�t|�VW5zt�|�Wntk
�rYnXXdS)akA context manager providing a file path object to the resource.

    If the resource does not already exist on its own on the file system,
    a temporary file will be created. If the file was created, the file
    will be deleted upon exiting the context manager (no exception is
    raised if the file was deleted prior to the context manager
    exiting).
    N)r/r)r5r
�
resource_pathr8r9rr6r-�existsrrQ�tempfileZmkstempr*�remove�write�close)	r%r:rEZ	file_path�package_directoryrRrI�fdZraw_pathr'r'r(r�s6

)r%r$rc	Cs|t|�}t|�t|�}|dk	r*|�|�Sztt|��}Wnttfk
rTYdSX||krbdSt|j	j
�j|}|��S)zYTrue if 'name' is a resource inside 'package'.

    Directories are *not* resources.
    NF)
r)r/r5r�setr�NotADirectoryErrorr8r
rr6r-�is_file)r%r$rEZpackage_contentsrr'r'r(r�s
cCsTt|�}t|�}|dk	r |��S|jjdks4|jjs8dSt|jj�j}t�	|�SdS)z�Return an iterable of entries in 'package'.

    Note that not all entries are resources.  Specifically, directories are
    not considered resources.  Use `is_resource()` on each entry returned here
    to check if it is a resource or not.
    Nr')
r)r5rrr6r7r
r-r*�listdir)r%rErYr'r'r(r�s)rLrM)rLrM)2r*rU�rr2�
contextlibrr�	importlibr�
importlib.abcr�iorr	�pathlibr
�typesr�typingrr
rrrrZ	typing.iorrZ	zipimportr�__all__�strr�PathLikerr)r/r3r5r9rr�bytesrrr�boolrrr'r'r'r(�<module>sh�

�!��"
��.__pycache__/machinery.cpython-38.pyc000064400000001704150327175520013374 0ustar00U

e5dL�@s�dZddlZddlmZddlmZddlmZddlmZmZm	Z	m
Z
mZddlmZdd	lm
Z
dd
lmZddlmZddlmZdd
lmZdd�ZdS)z9The machinery of importlib: finders, loaders, hooks, etc.�N�)�
ModuleSpec)�BuiltinImporter)�FrozenImporter)�SOURCE_SUFFIXES�DEBUG_BYTECODE_SUFFIXES�OPTIMIZED_BYTECODE_SUFFIXES�BYTECODE_SUFFIXES�EXTENSION_SUFFIXES)�WindowsRegistryFinder)�
PathFinder)�
FileFinder)�SourceFileLoader)�SourcelessFileLoader)�ExtensionFileLoadercCstttS)zAReturns a list of all recognized module suffixes for this process)rr	r
�rr�+/usr/lib64/python3.8/importlib/machinery.py�all_suffixessr)�__doc__�_imp�
_bootstraprrr�_bootstrap_externalrrrr	r
rrr
rrrrrrrr�<module>s__pycache__/metadata.cpython-38.opt-1.pyc000064400000050620150327175520014135 0ustar00U

e5d�D�
@s�ddlZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlmZddlmZddlmZddlmZddlmZddd	d
ddd
dddg
ZGdd	�d	e�ZGdd�de
�dd��ZGdd�dej�ZGdd�d�ZGdd�d�ZGdd�de�Z Gdd�d�Z!Gdd�d�Z"Gd d!�d!e �Z#Gd"d#�d#e�Z$d$d
�Z%d%d�Z&d&d�Z'd'd�Z(d(d�Z)d)d
�Z*d*d�Z+dS)+�N)�ConfigParser)�suppress)�
import_module)�MetaPathFinder)�starmap�Distribution�DistributionFinder�PackageNotFoundError�distribution�
distributions�entry_points�files�metadata�requires�versionc@seZdZdZdS)r	zThe package was not found.N)�__name__�
__module__�__qualname__�__doc__�rr�*/usr/lib64/python3.8/importlib/metadata.pyr	%sc@sVeZdZdZe�d�Zdd�Zedd��Z	e
dd��Ze
d	d
��Zdd�Z
d
d�ZdS)�
EntryPointz�An entry point as defined by Python packaging conventions.

    See `the packaging docs on entry points
    <https://packaging.python.org/specifications/entry-points/>`_
    for more information.
    zH(?P<module>[\w.]+)\s*(:\s*(?P<attr>[\w.]+)\s*)?((?P<extras>\[.*\])\s*)?$cCsD|j�|j�}t|�d��}td|�d�p,d�d��}t�t	||�S)z�Load the entry point from its definition. If only a module
        is indicated by the value, return that module. Otherwise,
        return the named object.
        �moduleN�attr��.)
�pattern�match�valuer�group�filter�split�	functools�reduce�getattr)�selfrrZattrsrrr�loadGszEntryPoint.loadcCs(|j�|j�}tt�d|�d�p"d��S)Nz\w+�extrasr)rrr�list�re�finditerr)r%rrrrr'QszEntryPoint.extrascs��fdd����D�S)Ncs,g|]$}��|�D]\}}�|||��qqSr��items)�.0r�namer��cls�configrr�
<listcomp>Xs�z+EntryPoint._from_config.<locals>.<listcomp>)�sectionsr/rr/r�_from_configVs�zEntryPoint._from_configcCsNtdd�}t|_z|�|�Wn$tk
rB|�t�|��YnXt�	|�S)N�=)Z
delimiters)
r�strZoptionxformZread_string�AttributeErrorZreadfp�io�StringIOrr4)r0�textr1rrr�
_from_text^s
zEntryPoint._from_textcCst|j|f�S)zO
        Supply iter so one may construct dicts of EntryPoints easily.
        )�iterr.�r%rrr�__iter__jszEntryPoint.__iter__cCs|j|j|j|jffS�N)�	__class__r.rrr=rrr�
__reduce__ps�zEntryPoint.__reduce__N)rrrrr)�compilerr&�propertyr'�classmethodr4r;r>rArrrrr)s�



rZEntryPointBasezname value groupc@s*eZdZdZd
dd�Zdd�Zdd�Zd	S)�PackagePathz"A reference to a path in a package�utf-8c
Cs0|��j|d��}|��W5QR�SQRXdS)N��encoding��locate�open�read)r%rH�streamrrr�	read_textzszPackagePath.read_textc
Cs.|���d��}|��W5QR�SQRXdS)N�rbrI)r%rMrrr�read_binary~szPackagePath.read_binarycCs|j�|�S)z'Return a path-like object for this path)�dist�locate_filer=rrrrJ�szPackagePath.locateN)rF)rrrrrNrPrJrrrrrEws
rEc@seZdZdd�Zdd�ZdS)�FileHashcCs|�d�\|_}|_dS)Nr5)�	partition�moder)r%�spec�_rrr�__init__�szFileHash.__init__cCsd�|j|j�S)Nz<FileHash mode: {} value: {}>)�formatrUrr=rrr�__repr__�szFileHash.__repr__N)rrrrXrZrrrrrS�srSc@s�eZdZdZejdd��Zejdd��Zedd��Z	edd	��Z
ed
d��Zedd
��Z
edd��Zedd��Zedd��Zedd��Zdd�Zdd�Zedd��Zdd�Zdd�Zed d!��Zed"d#��Zed$d%��Zd&S)'rzA Python distribution package.cCsdS)z�Attempt to load metadata file given by the name.

        :param filename: The name of the file in the distribution info.
        :return: The text if found, otherwise None.
        Nr�r%�filenamerrrrN�szDistribution.read_textcCsdS)z[
        Given a path to a file in this distribution, return a path
        to it.
        Nr�r%�pathrrrrR�szDistribution.locate_filecCsD|��D].}|tj|d��}t|d�}|dk	r|Sqt|��dS)afReturn the Distribution for the given package name.

        :param name: The name of the distribution package to search for.
        :return: The Distribution instance (or subclass thereof) for the named
            package, if found.
        :raises PackageNotFoundError: When the named package's distribution
            metadata cannot be found.
        �r.N)�_discover_resolversr�Context�nextr	)r0r.�resolverZdistsrQrrr�	from_name�s


zDistribution.from_namecsJ|�dd���r|rtd���p*tjf|��tj��fdd�|��D��S)aReturn an iterable of Distribution objects for all packages.

        Pass a ``context`` or pass keyword arguments for constructing
        a context.

        :context: A ``DistributionFinder.Context`` object.
        :return: Iterable of Distribution objects for all packages.
        �contextNz cannot accept context and kwargsc3s|]}|��VqdSr?r)r-rc�rerr�	<genexpr>�s�z(Distribution.discover.<locals>.<genexpr>)�pop�
ValueErrorrra�	itertools�chain�
from_iterabler`)r0�kwargsrrfr�discover�s
�zDistribution.discovercCstt�|��S)z�Return a Distribution for the indicated metadata path

        :param path: a string or path-like object
        :return: a concrete Distribution instance for the path
        )�PathDistribution�pathlib�Path)r^rrr�at�szDistribution.atcCsdd�tjD�}td|�S)z#Search the meta_path for resolvers.css|]}t|dd�VqdS)�find_distributionsN)r$)r-�finderrrrrg�s�z3Distribution._discover_resolvers.<locals>.<genexpr>N)�sys�	meta_pathr )Zdeclaredrrrr`�s�z Distribution._discover_resolverscCs(|�d�p|�d�p|�d�}t�|�S)z�Return the parsed metadata for this Distribution.

        The returned object will have keys that name the various bits of
        metadata.  See PEP 566 for details.
        ZMETADATAzPKG-INFOr)rN�emailZmessage_from_string�r%r:rrrr�s
��zDistribution.metadatacCs
|jdS)z;Return the 'Version' metadata for the distribution package.ZVersion)rr=rrrr�szDistribution.versioncCst�|�d��S)Nzentry_points.txt)rr;rNr=rrrr�szDistribution.entry_pointscs6���p���}d�fdd�	}|o4tt|t�|���S)aBFiles in this distribution.

        :return: List of PackagePath for this distribution or None

        Result is `None` if the metadata file that enumerates files
        (i.e. RECORD for dist-info or SOURCES.txt for egg-info) is
        missing.
        Result may be empty if the metadata exists but is empty.
        Ncs6t|�}|rt|�nd|_|r&t|�nd|_�|_|Sr?)rErS�hash�int�sizerQ)r.ryZsize_str�resultr=rr�	make_file�s
z%Distribution.files.<locals>.make_file)NN)�_read_files_distinfo�_read_files_egginfor(r�csv�reader)r%Z
file_linesr}rr=rr
�szDistribution.filescCs|�d�}|o|��S)z*
        Read the lines of RECORD
        ZRECORD)rN�
splitlinesrxrrrr~s
z!Distribution._read_files_distinfocCs|�d�}|otdj|���S)z`
        SOURCES.txt might contain literal commas, so wrap each line
        in quotes.
        zSOURCES.txtz"{}")rN�maprYr�rxrrrrs
z Distribution._read_files_egginfocCs|��p|��}|ot|�S)z6Generated requirements specified for this Distribution)�_read_dist_info_reqs�_read_egg_info_reqsr()r%ZreqsrrrrszDistribution.requirescCs|j�d�S)Nz
Requires-Dist)rZget_allr=rrrr�sz!Distribution._read_dist_info_reqscCs|�d�}|o|�|�S)Nzrequires.txt)rN�_deps_from_requires_text)r%�sourcerrrr� s
z Distribution._read_egg_info_reqscCs4|�|���}dd�t�|t�d��D�}|�|�S)NcSs&i|]\}}|ttt�d�|���qS)�line)r(r��operator�
itemgetter)r-�sectionZresultsrrr�
<dictcomp>'s�z9Distribution._deps_from_requires_text.<locals>.<dictcomp>r�)�_read_sectionsr�rj�groupbyr�r��%_convert_egg_info_reqs_to_simple_reqs)r0r�Z
section_pairsr3rrrr�$s
�z%Distribution._deps_from_requires_textccs<d}td|�D](}t�d|�}|r.|�d�}qt�VqdS)Nz	\[(.*)\]$�)r r)rr�locals)�linesr�r�Z
section_matchrrrr�.s
zDistribution._read_sectionsc#sBdd���fdd�}|��D] \}}|D]}|||�Vq(qdS)a�
        Historically, setuptools would solicit and store 'extra'
        requirements, including those with environment markers,
        in separate sections. More modern tools expect each
        dependency to be defined separately, with any relevant
        extras and environment markers attached directly to that
        requirement. This method converts the former to the
        latter. See _test_deps_from_requires_text for an example.
        cSs|odj|d�S)Nzextra == "{name}"r_)rYr_rrr�make_conditionCszJDistribution._convert_egg_info_reqs_to_simple_reqs.<locals>.make_conditioncsX|pd}|�d�\}}}|r,|r,dj|d�}ttd|�|�g��}|rTdd�|�SdS)Nr�:z({markers}))�markersz; z and )rTrYr(r �join)r�Zextra�sepr�Z
conditions�r�rr�parse_conditionFszKDistribution._convert_egg_info_reqs_to_simple_reqs.<locals>.parse_conditionNr+)r3r�r�ZdepsZdeprr�rr�8s
z2Distribution._convert_egg_info_reqs_to_simple_reqsN)rrrr�abc�abstractmethodrNrRrDrdrn�staticmethodrrr`rCrrrr
r~rrr�r�r�r�r�rrrrr�sB











	
	c@s2eZdZdZGdd�d�Zeje�fdd��ZdS)rzJ
    A MetaPathFinder capable of discovering installed distributions.
    c@s(eZdZdZdZdd�Zedd��ZdS)zDistributionFinder.Contextaw
        Keyword arguments presented by the caller to
        ``distributions()`` or ``Distribution.discover()``
        to narrow the scope of a search for distributions
        in all DistributionFinders.

        Each DistributionFinder may expect any parameters
        and should attempt to honor the canonical
        parameters defined below when appropriate.
        NcKst|��|�dSr?)�vars�update)r%rmrrrrXjsz#DistributionFinder.Context.__init__cCst|��dtj�S)z�
            The path that a distribution finder should search.

            Typically refers to Python package paths and defaults
            to ``sys.path``.
            r^)r��getrur^r=rrrr^mszDistributionFinder.Context.path)rrrrr.rXrCr^rrrrraXs
racCsdS)z�
        Find distributions.

        Return an iterable of all Distribution instances capable of
        loading the metadata for packages matching the ``context``,
        a DistributionFinder.Context instance.
        Nr)r%rerrrrswsz%DistributionFinder.find_distributionsN)rrrrrar�r�rsrrrrrSsc@s@eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dS)�FastPathzF
    Micro-optimized class for searching a path for
    children.
    cCs||_tj�|���|_dSr?)�root�osr^�basename�lower�base)r%r�rrrrX�szFastPath.__init__cCst�|j|�Sr?)rprqr�)r%�childrrr�joinpath�szFastPath.joinpathc
CsTtt��t�|jpd�W5QR�SQRXtt��|��W5QR�SQRXgS)Nr)r�	Exceptionr��listdirr��zip_childrenr=rrr�children�s

"
zFastPath.childrencCs2t�|j�}|j��}|j|_t�dd�|D��S)Ncss |]}|�tjd�dVqdS)r�rN)r!�	posixpathr�)r-r�rrrrg�s�z(FastPath.zip_children.<locals>.<genexpr>)�zipfilerqr�Znamelistr��dict�fromkeys)r%Zzip_path�namesrrrr��s

�zFastPath.zip_childrencCs&|j}||jkp$|�|j�o$|�d�S)N�.egg)r��versionless_egg_name�
startswith�prefix�endswith)r%�searchr�rrr�is_egg�s

�zFastPath.is_eggccsZ|��D]L}|��}||jksH|�|j�r6|�|j�sH|�|�r|dkr|�|�VqdS)Nzegg-info)	r�r��
exact_matchesr�r�r��suffixesr�r�)r%r.r�Zn_lowrrrr��s

�
���zFastPath.searchN)
rrrrrXr�r�r�r�r�rrrrr��s
r�c@s6eZdZdZdZdZdZdgdd�ZdZdd�Z	dS)�PreparedzE
    A prepared search for metadata on a possibly-named package.
    r)z
.dist-infoz	.egg-infoNrcsV|�_|dkrdS|���dd��_�jd�_�fdd��jD��_�jd�_dS)N�-rWcsg|]}�j|�qSr)�
normalized)r-�suffixr=rrr2�sz%Prepared.__init__.<locals>.<listcomp>r�)r.r��replacer�r�r�r�r�)r%r.rr=rrX�s
�zPrepared.__init__)
rrrrr�r�r�r�r�rXrrrrr��sr�c@s,eZdZee��fdd��Zedd��ZdS)�MetadataPathFindercCs|�|j|j�}tt|�S)a 
        Find distributions.

        Return an iterable of all Distribution instances capable of
        loading the metadata for packages matching ``context.name``
        (or all names if ``None`` indicated) along the paths in the list
        of directories ``context.path``.
        )�
_search_pathsr.r^r�ro)r0re�foundrrrrs�s
z%MetadataPathFinder.find_distributionscs tj��fdd�tt|�D��S)z1Find metadata directories in paths heuristically.c3s|]}|�t���VqdSr?)r�r�)r-r^r_rrrg�s�z3MetadataPathFinder._search_paths.<locals>.<genexpr>)rjrkrlr�r�)r0r.�pathsrr_rr��s�z MetadataPathFinder._search_pathsN)rrrrDrrarsr�rrrrr��sr�c@s.eZdZdd�Zdd�Zejje_dd�ZdS)rocCs
||_dS)z�Construct a distribution from a path to the metadata directory.

        :param path: A pathlib.Path or similar object supporting
                     .joinpath(), __div__, .parent, and .read_text().
        N)�_pathr]rrrrX�szPathDistribution.__init__c
Cs<tttttt��"|j�|�jdd�W5QR�SQRXdS)NrFrG)	r�FileNotFoundError�IsADirectoryError�KeyError�NotADirectoryError�PermissionErrorr�r�rNr[rrrrN�s
�zPathDistribution.read_textcCs|jj|Sr?)r��parentr]rrrrR�szPathDistribution.locate_fileN)rrrrXrNrrrRrrrrro�s
rocCs
t�|�S)z�Get the ``Distribution`` instance for the named package.

    :param distribution_name: The name of the distribution package as a string.
    :return: A ``Distribution`` instance (or subclass thereof).
    )rrd�Zdistribution_namerrrr
�scKstjf|�S)z|Get all ``Distribution`` instances in the current environment.

    :return: An iterable of ``Distribution`` instances.
    )rrn)rmrrrr�scCst�|�jS)z�Get the metadata for the named package.

    :param distribution_name: The name of the distribution package to query.
    :return: An email.Message containing the parsed metadata.
    )rrdrr�rrrrscCs
t|�jS)z�Get the version string for the named package.

    :param distribution_name: The name of the distribution package to query.
    :return: The version string for the package as defined in the package's
        "Version" metadata key.
    )r
rr�rrrrscCsHtj�dd�t�D��}t�d�}t||d�}t�||�}dd�|D�S)zwReturn EntryPoint objects for all installed packages.

    :return: EntryPoint objects for all installed packages.
    css|]}|jVqdSr?)r)r-rQrrrrgszentry_points.<locals>.<genexpr>r)�keycSsi|]\}}|t|��qSr)�tuple)r-r�epsrrrr�s�z entry_points.<locals>.<dictcomp>)rjrkrlrr��
attrgetter�sortedr�)r�Zby_groupZorderedZgroupedrrrrs�
�cCs
t|�jS)z�Return a list of files for the named package.

    :param distribution_name: The name of the distribution package to query.
    :return: List of files composing the distribution.
    )r
r
r�rrrr
%scCs
t|�jS)z�
    Return a list of requirements for the named package.

    :return: An iterator of requirements, suitable for
    packaging.requirement.Requirement.
    )r
rr�rrrr.s),r8r�r)r�r�rurwrpr�r�r"rjr��collectionsZconfigparserr�
contextlibr�	importlibr�
importlib.abcrr�__all__�ModuleNotFoundErrorr	�
namedtuplerZ
PurePosixPathrErSrrr�r�r�ror
rrrrr
rrrrr�<module>sb�

�NE/0		
	__pycache__/_bootstrap_external.cpython-38.opt-2.pyc000064400000103317150327175520016436 0ustar00U

&�.e��@s�ddladdlZddladdlZddlZtjdkZerHddlZddl	Z	nddl
Zer^ddgZndgZedZe
e�Zd�e�Zdd�eD�ZdZd	ZeeZd
d�Zdd
�Zdd�Zdd�Zer�dd�Zndd�Zdd�Zdd�Zdd�Zdd�Zdd�Ze�r
dd �Znd!d �Zdd#d$�Ze ej!�Z"d%�#d&d'�d(Z$e%�&e$d'�Z'd)Z(d*Z)d+gZ*d,gZ+e+Z,Z-d�dd-�d.d/�Z.d0d1�Z/d2d3�Z0d4d5�Z1d6d7�Z2d8d9�Z3d:d;�Z4d<d=�Z5d>d?�Z6d@dA�Z7d�dBdC�Z8d�dDdE�Z9d�dGdH�Z:dIdJ�Z;e<�Z=d�de=dK�dLdM�Z>GdNdO�dO�Z?GdPdQ�dQ�Z@GdRdS�dSe@�ZAGdTdU�dU�ZBGdVdW�dWeBeA�ZCGdXdY�dYeBe@�ZDgZEGdZd[�d[eBe@�ZFGd\d]�d]�ZGGd^d_�d_�ZHGd`da�da�ZIGdbdc�dc�ZJd�ddde�ZKdfdg�ZLdhdi�ZMdjdk�ZNdldmdndodpdqdrdsdtdudvdwdxdydzd{d|�ZOd}d~�ZPdS)��NZwin32�\�/�cCsh|]}d|���qS��:���.0�srr�5/usr/lib64/python3.8/importlib/_bootstrap_external.py�	<setcomp>/sr)�win)�cygwin�darwincs<tj�t�r0tj�t�rd�nd��fdd�}ndd�}|S)N�PYTHONCASEOKsPYTHONCASEOKcs
�tjkS�N)�_os�environr��keyrr�_relax_case@sz%_make_relax_case.<locals>._relax_casecSsdS)NFrrrrrrDs)�sys�platform�
startswith�_CASE_INSENSITIVE_PLATFORMS�#_CASE_INSENSITIVE_PLATFORMS_STR_KEY)rrrr�_make_relax_case9srcCst|�d@�dd�S)N�����little)�int�to_bytes)�xrrr�_pack_uint32Jsr#cCst�|d�S�Nr�r �
from_bytes��datarrr�_unpack_uint32Osr)cCst�|d�Sr$r%r'rrr�_unpack_uint16Tsr*cGs�|sdSt|�dkr|dSd}g}ttj|�D]z\}}|�t�sL|�t�rf|�t�pX|}t	|g}q0|�d�r�|�
�|�
�kr�|}|g}q�|�|�q0|p�|}|�|�q0dd�|D�}t|�dkr�|ds�|t	S|t	�|�S)Nr�rrcSsg|]}|r|�t��qSr��rstrip�path_separators�r	�prrr�
<listcomp>rs�_path_join.<locals>.<listcomp>)
�len�mapr�_path_splitrootr�path_sep_tuple�endswithr-r.�path_sep�casefold�append�join)�
path_parts�root�pathZnew_root�tailrrr�
_path_join[s*
r@cGst�dd�|D��S)NcSsg|]}|r|�t��qSrr,)r	�partrrrr1{s�r2)r8r;)r<rrrr@ys
�csBt�fdd�tD��}|dkr&d�fS�d|��|dd�fS)Nc3s|]}��|�VqdSr)�rfindr/�r>rr�	<genexpr>�sz_path_split.<locals>.<genexpr>rrr+)�maxr.)r>�irrCr�_path_splitsrGcCs
t�|�Sr)r�statrCrrr�
_path_stat�srIcCs2zt|�}Wntk
r"YdSX|jd@|kS)NFi�)rI�OSError�st_mode)r>�mode�	stat_inforrr�_path_is_mode_type�s
rNcCs
t|d�S)Ni�)rNrCrrr�_path_isfile�srOcCs|st��}t|d�S)Ni@)r�getcwdrNrCrrr�_path_isdir�srQcCs>|sdSt�|�d�dd�}t|�dko<|�d�p<|�d�S)NFrrrr+z\\)rr5�replacer3rr7)r>r=rrr�_path_isabs�srScCs
|�t�Sr)rr.rCrrrrS�s�cCs�d�|t|��}t�|tjtjBtjB|d@�}z2t�|d��}|�	|�W5QRXt�
||�Wn:tk
r�zt�|�Wntk
r�YnX�YnXdS)N�{}.{}rT�wb)
�format�idr�open�O_EXCL�O_CREAT�O_WRONLY�_io�FileIO�writerRrJ�unlink)r>r(rL�path_tmp�fd�filerrr�
_write_atomic�s�rdiU
�rs
�__pycache__zopt-z.pyz.pyc)�optimizationcCsX|dk	r4t�dt�|dk	r(d}t|��|r0dnd}t�|�}t|�\}}|�d�\}}}tj	j
}	|	dkrrtd��d�|r~|n|||	g�}
|dkr�tj
jdkr�d}ntj
j}t|�}|dkr�|��s�td�|���d	�|
t|�}
|
td}tjdk	�rLt|��stt��|�}|dd
k�r8|dtk�r8|dd�}ttj|�t�|�St|t|�S)NzFthe debug_override parameter is deprecated; use 'optimization' insteadz2debug_override or optimization must be set to Nonerr+�.�$sys.implementation.cache_tag is Nonerz{!r} is not alphanumericz{}.{}{}rre)�	_warnings�warn�DeprecationWarning�	TypeErrorr�fspathrG�
rpartitionr�implementation�	cache_tag�NotImplementedErrorr;�flags�optimize�str�isalnum�
ValueErrorrW�_OPT�BYTECODE_SUFFIXES�pycache_prefixrSr@rPr.�lstrip�_PYCACHE)r>�debug_overriderg�message�headr?�base�sep�rest�tag�almost_filename�filenamerrr�cache_from_sourcebsH�
	
�r�c
Cs.tjjdkrtd��t�|�}t|�\}}d}tjdk	rftj�t	�}|�
|t�rf|t|�d�}d}|s�t|�\}}|t
kr�tt
�d|����|�d�}|dkr�td|����n\|dk�r|�dd	�d
}|�
t�s�tdt����|tt�d�}|���std|�d
���|�d�d}	t||	td�S)NriFTz not bottom-level directory in rh>re�zexpected only 2 or 3 dots in r�re���z5optimization portion of filename does not start with zoptimization level z is not an alphanumeric valuer)rrprqrrrrnrGrzr-r.rr8r3r|rw�count�rsplitrxrv�	partitionr@�SOURCE_SUFFIXES)
r>r�pycache_filename�found_in_pycache_prefix�
stripped_path�pycache�	dot_countrg�	opt_level�
base_filenamerrr�source_from_cache�s4	





r�c	Cs~t|�dkrdS|�d�\}}}|r8|��dd�dkr<|Szt|�}Wn$ttfk
rl|dd�}YnXt|�rz|S|S)Nrrh�������py)r3ro�lowerr�rrrwrO)�
bytecode_pathr��_�	extension�source_pathrrr�_get_sourcefile�sr�cCsJ|�tt��r0z
t|�WStk
r,YqFXn|�tt��rB|SdSdSr)r7�tupler�r�rrry)r�rrr�_get_cached�s
r�cCs4zt|�j}Wntk
r&d}YnX|dO}|S)NrT�)rIrKrJ)r>rLrrr�
_calc_mode�s
r�csDd�fdd�	}z
tj}Wntk
r4dd�}YnX||��|S)NcsB|dkr|j}n |j|kr0td|j|f|d���||f|�|�S)Nzloader for %s cannot handle %s��name)r��ImportError)�selfr��args�kwargs��methodrr�_check_name_wrappers
��z(_check_name.<locals>._check_name_wrappercSs8dD] }t||�rt||t||��q|j�|j�dS)N)�
__module__�__name__�__qualname__�__doc__)�hasattr�setattr�getattr�__dict__�update)�new�oldrRrrr�_wraps
z_check_name.<locals>._wrap)N)�
_bootstrapr��	NameError)r�r�r�rr�r�_check_name�s

r�cCs<|�|�\}}|dkr8t|�r8d}t�|�|d�t�|S)Nz,Not importing directory {}: missing __init__r)�find_loaderr3rjrkrW�
ImportWarning)r��fullname�loader�portions�msgrrr�_find_module_shims

r�cCs�|dd�}|tkr<d|�d|��}t�d|�t|f|��t|�dkrfd|��}t�d|�t|��t|dd��}|d@r�d	|�d
|��}t|f|��|S)Nrzbad magic number in z: �{}�z(reached EOF while reading pyc header of ����zinvalid flags z in )�MAGIC_NUMBERr��_verbose_messager�r3�EOFErrorr))r(r��exc_details�magicr~rsrrr�
_classify_pyc)s
r�cCspt|dd��|d@kr:d|��}t�d|�t|f|��|dk	rlt|dd��|d@krltd|��f|��dS)Nr��rzbytecode is stale for r�r�)r)r�r�r�)r(�source_mtime�source_sizer�r�r~rrr�_validate_timestamp_pycJs
�r�cCs&|dd�|kr"td|��f|��dS)Nr�r�z.hash in bytecode doesn't match hash of source )r�)r(�source_hashr�r�rrr�_validate_hash_pycfs��r�cCsPt�|�}t|t�r8t�d|�|dk	r4t�||�|Std�	|�||d��dS)Nzcode object from {!r}zNon-code object in {!r}�r�r>)
�marshal�loads�
isinstance�
_code_typer�r��_imp�_fix_co_filenamer�rW)r(r�r�r��coderrr�_compile_bytecode~s


�r�cCsFtt�}|�td��|�t|��|�t|��|�t�|��|S�Nr��	bytearrayr��extendr#r��dumps)r��mtimer�r(rrr�_code_to_timestamp_pyc�sr�TcCs@tt�}d|d>B}|�t|��|�|�|�t�|��|S)Nr+r�)r�r��checkedr(rsrrr�_code_to_hash_pyc�s
r�cCs>ddl}t�|�j}|�|�}t�dd�}|�|�|d��S)NrT)�tokenizer]�BytesIO�readline�detect_encoding�IncrementalNewlineDecoder�decode)�source_bytesr��source_bytes_readline�encoding�newline_decoderrrr�
decode_source�s

r��r��submodule_search_locationsc	Cs|dkr<d}t|d�rFz|�|�}WqFtk
r8YqFXn
t�|�}tj|||d�}d|_|dkr�t�D]*\}}|�	t
|��rj|||�}||_q�qjdS|tkr�t|d�r�z|�
|�}Wntk
r�Yq�X|r�g|_n||_|jgk�r|�rt|�d}|j�|�|S)Nz	<unknown>�get_filename��originT�
is_packager)r�r�r�rrnr��
ModuleSpec�
_set_fileattr�_get_supported_file_loadersr7r�r��	_POPULATEr�r�rGr:)	r��locationr�r��spec�loader_class�suffixesr��dirnamerrr�spec_from_file_location�s>



r�c@sLeZdZdZdZdZedd��Zedd��Zed
d	d
��Z	eddd��Z
dS)�WindowsRegistryFinderz;Software\Python\PythonCore\{sys_version}\Modules\{fullname}zASoftware\Python\PythonCore\{sys_version}\Modules\{fullname}\DebugFcCs8zt�tj|�WStk
r2t�tj|�YSXdSr)�_winreg�OpenKey�HKEY_CURRENT_USERrJ�HKEY_LOCAL_MACHINE)�clsrrrr�_open_registrysz$WindowsRegistryFinder._open_registryc	Csr|jr|j}n|j}|j|dtjdd�d�}z&|�|��}t�|d�}W5QRXWnt	k
rlYdSX|S)Nz%d.%dre)r��sys_versionr)
�DEBUG_BUILD�REGISTRY_KEY_DEBUG�REGISTRY_KEYrWr�version_inforr��
QueryValuerJ)rr��registry_keyr�hkey�filepathrrr�_search_registrys�z&WindowsRegistryFinder._search_registryNcCsz|�|�}|dkrdSzt|�Wntk
r8YdSXt�D]4\}}|�t|��r@tj||||�|d�}|Sq@dS)Nr�)rrIrJr�r7r�r��spec_from_loader)rr�r>�targetr
r�r�r�rrr�	find_specs
�zWindowsRegistryFinder.find_speccCs"|�||�}|dk	r|jSdSdSr�rr��rr�r>r�rrr�find_module'sz!WindowsRegistryFinder.find_module)NN)N)r�r�r�rrr�classmethodrrrrrrrrr��s��

r�c@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�
_LoaderBasicscCs@t|�|��d}|�dd�d}|�d�d}|dko>|dkS)Nr+rhrre�__init__)rGr�r�ro)r�r�r��
filename_base�	tail_namerrrr�:sz_LoaderBasics.is_packagecCsdSrr�r�r�rrr�
create_moduleBsz_LoaderBasics.create_modulecCs8|�|j�}|dkr$td�|j���t�t||j�dS)Nz4cannot load module {!r} when get_code() returns None)�get_coder�r�rWr��_call_with_frames_removed�execr�)r��moduler�rrr�exec_moduleEs�z_LoaderBasics.exec_modulecCst�||�Sr)r��_load_module_shim�r�r�rrr�load_moduleMsz_LoaderBasics.load_moduleN)r�r�r�r�rr r#rrrrr5src@sJeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�d
d�Zdd�Z	dS)�SourceLoadercCst�dSr)rJ�r�r>rrr�
path_mtimeTszSourceLoader.path_mtimecCsd|�|�iS)Nr�)r&r%rrr�
path_stats\szSourceLoader.path_statscCs|�||�Sr)�set_data)r�r��
cache_pathr(rrr�_cache_bytecodejszSourceLoader._cache_bytecodecCsdSrr)r�r>r(rrrr(tszSourceLoader.set_datac
CsR|�|�}z|�|�}Wn0tk
rH}ztd|d�|�W5d}~XYnXt|�S)Nz'source not available through get_data()r�)r��get_datarJr�r�)r�r�r>r��excrrr�
get_source{s
��zSourceLoader.get_sourcer�)�	_optimizecCstjt||dd|d�S)NrT)�dont_inheritrt)r�r�compile)r�r(r>r.rrr�source_to_code�s�zSourceLoader.source_to_codec	Cs"|�|�}d}d}d}d}d}zt|�}Wntk
rDd}Y�n0Xz|�|�}	Wntk
rjY�n
Xt|	d�}z|�|�}
Wntk
r�Yn�X||d�}z�t|
||�}t|
�dd�}
|d@dk}|�r$|d@dk}t	j
d	k�r8|s�t	j
d
k�r8|�|�}t	�t|�}t
|
|||�nt|
||	d||�Wnttfk
�rTYn Xt�d||�t|
|||d
�S|dk�r�|�|�}|�||�}t�d|�tj�s|dk	�r|dk	�r|�r�|dk�r�t	�|�}t|||�}
nt||t|��}
z|�|||
�Wntk
�rYnX|S)NFTr�r�r�r+rre�never�always�sizez
{} matches {})r�r�r�zcode object from {})r�r�rrr'rJr r+r��
memoryviewr��check_hash_based_pycsr��_RAW_MAGIC_NUMBERr�r�r�r�r�r�r�r1r�dont_write_bytecoder�r�r3r*)r�r�r�r�r�r��
hash_based�check_sourcer��str(r�rs�
bytes_data�code_objectrrrr�s�
���
�����

�

�zSourceLoader.get_codeN)
r�r�r�r&r'r*r(r-r1rrrrrr$Rs

r$csxeZdZdd�Zdd�Zdd�Ze�fdd��Zed	d
��Zdd�Z	ed
d��Z
dd�Zdd�Zdd�Z
dd�Z�ZS)�
FileLoadercCs||_||_dSrr�)r�r�r>rrrr�szFileLoader.__init__cCs|j|jko|j|jkSr��	__class__r��r��otherrrr�__eq__�s
�zFileLoader.__eq__cCst|j�t|j�ASr��hashr�r>�r�rrr�__hash__�szFileLoader.__hash__cstt|��|�Sr)�superr>r#r"�r@rrr#�s
zFileLoader.load_modulecCs|jSrrCr"rrrr�szFileLoader.get_filenamec
Csft|ttf�r:t�t|���}|��W5QR�SQRXn(t�|d��}|��W5QR�SQRXdS)N�r)r�r$�ExtensionFileLoaderr]�	open_coderu�readr^)r�r>rcrrrr+s
zFileLoader.get_datacCs|�|�r|SdSr)r��r�rrrr�get_resource_readers
zFileLoader.get_resource_readercCs tt|j�d|�}t�|d�S)NrrJ)r@rGr>r]r^�r��resourcer>rrr�
open_resourceszFileLoader.open_resourcecCs&|�|�st�tt|j�d|�}|Sr�)�is_resource�FileNotFoundErrorr@rGr>rPrrr�
resource_paths
zFileLoader.resource_pathcCs(t|krdStt|j�d|�}t|�S)NFr)r8r@rGr>rO�r�r�r>rrrrS szFileLoader.is_resourcecCstt�t|j�d��Sr�)�iterr�listdirrGr>rFrrr�contents&szFileLoader.contents)r�r�r�rrCrGr�r#r�r+rOrRrUrSrY�
__classcell__rrrIrr>�s

r>c@s*eZdZdd�Zdd�Zdd�dd�Zd	S)
�SourceFileLoadercCst|�}|j|jd�S)N)r�r4)rI�st_mtime�st_size)r�r>r;rrrr'.szSourceFileLoader.path_statscCst|�}|j|||d�S)N��_mode)r�r()r�r�r�r(rLrrrr*3sz SourceFileLoader._cache_bytecoderTr^c	Cs�t|�\}}g}|r4t|�s4t|�\}}|�|�qt|�D]l}t||�}zt�|�Wq<tk
rpYq<Yq<tk
r�}zt	�
d||�WY�dSd}~XYq<Xq<zt|||�t	�
d|�Wn0tk
r�}zt	�
d||�W5d}~XYnXdS)Nzcould not create {!r}: {!r}zcreated {!r})rGrQr:�reversedr@r�mkdir�FileExistsErrorrJr�r�rd)	r�r>r(r_�parentr�r<rAr,rrrr(8s0
��zSourceFileLoader.set_dataN)r�r�r�r'r*r(rrrrr[*sr[c@seZdZdd�Zdd�ZdS)�SourcelessFileLoadercCsD|�|�}|�|�}||d�}t|||�tt|�dd�||d�S)Nr�r�)r�r�)r�r+r�r�r5)r�r�r>r(r�rrrr[s

��zSourcelessFileLoader.get_codecCsdSrrr"rrrr-kszSourcelessFileLoader.get_sourceN)r�r�r�rr-rrrrrdWsrdc@sXeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
edd��ZdS)rKcCs@||_t|�s6ztt��|�}Wntk
r4YnX||_dSr)r�rSr@rrPrJr>rVrrrr|szExtensionFileLoader.__init__cCs|j|jko|j|jkSrr?rArrrrC�s
�zExtensionFileLoader.__eq__cCst|j�t|j�ASrrDrFrrrrG�szExtensionFileLoader.__hash__cCs$t�tj|�}t�d|j|j�|S)Nz&extension module {!r} loaded from {!r})r�rr��create_dynamicr�r�r>)r�r�rrrrr�s��z!ExtensionFileLoader.create_modulecCs$t�tj|�t�d|j|j�dS)Nz(extension module {!r} executed from {!r})r�rr��exec_dynamicr�r�r>rNrrrr �s
�zExtensionFileLoader.exec_modulecs$t|j�d�t�fdd�tD��S)Nr+c3s|]}�d|kVqdS)rNr�r	�suffix��	file_namerrrD�s�z1ExtensionFileLoader.is_package.<locals>.<genexpr>)rGr>�any�EXTENSION_SUFFIXESr"rrirr��s�zExtensionFileLoader.is_packagecCsdSrrr"rrrr�szExtensionFileLoader.get_codecCsdSrrr"rrrr-�szExtensionFileLoader.get_sourcecCs|jSrrCr"rrrr��sz ExtensionFileLoader.get_filenameN)
r�r�r�rrCrGrr r�rr-r�r�rrrrrKts	rKc@sdeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dS)�_NamespacePathcCs$||_||_t|���|_||_dSr)�_name�_pathr��_get_parent_path�_last_parent_path�_path_finder�r�r�r>�path_finderrrrr�sz_NamespacePath.__init__cCs&|j�d�\}}}|dkrdS|dfS)Nrhr)rr>�__path__)rnro)r�rc�dot�merrr�_find_parent_path_names�sz&_NamespacePath._find_parent_path_namescCs|��\}}ttj||�Sr)rxr�r�modules)r��parent_module_name�path_attr_namerrrrp�sz_NamespacePath._get_parent_pathcCsPt|���}||jkrJ|�|j|�}|dk	rD|jdkrD|jrD|j|_||_|jSr)r�rprqrrrnr�r�ro)r��parent_pathr�rrr�_recalculate�s
z_NamespacePath._recalculatecCst|���Sr)rWr}rFrrr�__iter__�sz_NamespacePath.__iter__cCs|��|Sr�r})r��indexrrr�__getitem__�sz_NamespacePath.__getitem__cCs||j|<dSr)ro)r�r�r>rrr�__setitem__�sz_NamespacePath.__setitem__cCst|���Sr)r3r}rFrrr�__len__�sz_NamespacePath.__len__cCsd�|j�S)Nz_NamespacePath({!r}))rWrorFrrr�__repr__�sz_NamespacePath.__repr__cCs||��kSrr�r��itemrrr�__contains__�sz_NamespacePath.__contains__cCs|j�|�dSr)ror:r�rrrr:�sz_NamespacePath.appendN)r�r�r�rrxrpr}r~r�r�r�r�r�r:rrrrrm�s

rmc@sPeZdZdd�Zedd��Zdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�ZdS)�_NamespaceLoadercCst|||�|_dSr)rmrorsrrrr�sz_NamespaceLoader.__init__cCsd�|j�S)Nz<module {!r} (namespace)>)rWr�)rrrrr�module_repr�sz_NamespaceLoader.module_reprcCsdS)NTrr"rrrr��sz_NamespaceLoader.is_packagecCsdS�Nrrr"rrrr-�sz_NamespaceLoader.get_sourcecCstddddd�S)Nrz<string>rT)r/)r0r"rrrrsz_NamespaceLoader.get_codecCsdSrrrrrrrsz_NamespaceLoader.create_modulecCsdSrrrNrrrr sz_NamespaceLoader.exec_modulecCst�d|j�t�||�S)Nz&namespace module loaded with path {!r})r�r�ror!r"rrrr#	s�z_NamespaceLoader.load_moduleN)r�r�r�rrr�r�r-rrr r#rrrrr��s
r�c@sreZdZedd��Zedd��Zedd��Zedd��Zedd
d��Zeddd
��Z	eddd��Z
edd��Zd	S)�
PathFindercCs@ttj���D],\}}|dkr(tj|=qt|d�r|��qdS)N�invalidate_caches)�listr�path_importer_cache�itemsr�r�)rr��finderrrrr�s


zPathFinder.invalidate_cachesc	CsTtjdk	rtjst�dt�tjD],}z||�WStk
rLYq"Yq"Xq"dS)Nzsys.path_hooks is empty)r�
path_hooksrjrkr�r�)rr>�hookrrr�_path_hooks%s
zPathFinder._path_hookscCsh|dkr,zt��}Wntk
r*YdSXztj|}Wn(tk
rb|�|�}|tj|<YnX|Sr�)rrPrTrr��KeyErrorr�)rr>r�rrr�_path_importer_cache2s
zPathFinder._path_importer_cachecCsRt|d�r|�|�\}}n|�|�}g}|dk	r<t�||�St�|d�}||_|S)Nr�)r�r�rr�rr�r�)rr�r�r�r�r�rrr�_legacy_get_specHs

zPathFinder._legacy_get_specNc	Cs�g}|D]�}t|ttf�sq|�|�}|dk	rt|d�rF|�||�}n|�||�}|dkr\q|jdk	rn|S|j}|dkr�t	d��|�
|�qt�|d�}||_|S)Nrzspec missing loader)
r�ru�bytesr�r�rr�r�r�r�r�r�r�)	rr�r>r�namespace_path�entryr�r�r�rrr�	_get_specWs(


zPathFinder._get_speccCsd|dkrtj}|�|||�}|dkr(dS|jdkr\|j}|rVd|_t|||j�|_|SdSn|SdSr)rr>r�r�r�r�rm)rr�r>rr�r�rrrrws
zPathFinder.find_speccCs|�||�}|dkrdS|jSrrrrrrr�szPathFinder.find_modulecOsddlm}|j||�S)Nr)�MetadataPathFinder)�importlib.metadatar��find_distributions)rr�r�r�rrrr��s
zPathFinder.find_distributions)N)NN)N)r�r�r�rr�r�r�r�r�rrr�rrrrr�s 
	


r�c@sVeZdZdd�Zdd�ZeZdd�Zdd�Zdd
d�Z	dd
�Z
edd��Zdd�Z
d	S)�
FileFindercspg}|D] \�}|��fdd�|D��q||_|p6d|_t|j�sVtt��|j�|_d|_t�|_	t�|_
dS)Nc3s|]}|�fVqdSrrrg�r�rrrD�sz&FileFinder.__init__.<locals>.<genexpr>rhr�)r��_loadersr>rSr@rrP�_path_mtime�set�_path_cache�_relaxed_path_cache)r�r>�loader_details�loadersr�rr�rr�s

zFileFinder.__init__cCs
d|_dS)Nr�)r�rFrrrr��szFileFinder.invalidate_cachescCs*|�|�}|dkrdgfS|j|jp&gfSr)rr�r�)r�r�r�rrrr��s
zFileFinder.find_loadercCs|||�}t||||d�S)Nr�)r�)r�r�r�r>�smslrr�rrrr��s
�zFileFinder._get_specNc	Cs�d}|�d�d}zt|jp"t���j}Wntk
rBd}YnX||jkr\|��||_t	�rr|j
}|��}n
|j}|}||kr�t
|j|�}|jD]:\}	}
d|	}t
||�}t|�r�|�|
|||g|�Sq�t|�}|jD]r\}	}
zt
|j||	�}Wntk
�rYdSXtjd|dd�||	|kr�t|�r�|�|
||d|�Sq�|�r~t�d|�t�|d�}
|g|
_|
SdS)	NFrhrer�rz	trying {})�	verbosityzpossible namespace for {})rorIr>rrPr\rJr��_fill_cacherr�r�r�r@r�rOr�rQrwr�r�r�r�)r�r�r�is_namespace�tail_moduler��cache�cache_module�	base_pathrhr��
init_filename�	full_pathr�rrrr�sP





�
zFileFinder.find_specc	
Cs�|j}zt�|pt���}Wntttfk
r:g}YnXtj�	d�sTt
|�|_nJt
�}|D]8}|�d�\}}}|r�d�
||���}n|}|�|�q^||_tj�	t�r�dd�|D�|_dS)Nr
rhrUcSsh|]}|���qSr)r�)r	�fnrrrr*sz)FileFinder._fill_cache.<locals>.<setcomp>)r>rrXrPrT�PermissionError�NotADirectoryErrorrrrr�r�r�rWr��addrr�)	r�r>rY�lower_suffix_contentsr�r�rvrh�new_namerrrr�
s"
zFileFinder._fill_cachecs��fdd�}|S)Ncs"t|�std|d���|f���S)Nzonly directories are supportedrC)rQr�rC�rr�rr�path_hook_for_FileFinder6sz6FileFinder.path_hook.<locals>.path_hook_for_FileFinderr)rr�r�rr�r�	path_hook,s
zFileFinder.path_hookcCsd�|j�S)NzFileFinder({!r}))rWr>rFrrrr�>szFileFinder.__repr__)N)r�r�r�rr�r�rr�r�rr�rr�r�rrrrr��s	
3
r�cCs�|�d�}|�d�}|sB|r$|j}n||kr8t||�}n
t||�}|sTt|||d�}z$||d<||d<||d<||d<Wntk
r�YnXdS)N�
__loader__�__spec__r��__file__�
__cached__)�getr�rdr[r��	Exception)�nsr��pathname�	cpathnamer�r�rrr�_fix_up_moduleDs"


r�cCs*ttt���f}ttf}ttf}|||gSr)rK�_alternative_architecturesr��extension_suffixesr[r�rdry)�
extensions�source�bytecoderrrr�[sr�c	Cs�|atjatjatjt}dD]0}|tjkr8t�|�}n
tj|}t|||�qddgfdddgff}|D]X\}}|d}|tjkr�tj|}q�qjzt�|�}Wq�Wqjtk
r�YqjYqjXqjtd��t|d|�t|d	|�t|d
d�|��t|dd
d�|D��t�d�}	t|d|	�t�d�}
t|d|
�|dk�rXt�d�}t|d|�t|dt	��t
�tt�
���|dk�r�t�d�dt
k�r�dt_dS)N)r]rj�builtinsr��posixr�ntrrzimportlib requires posix or ntrr8r.r�_pathseps_with_coloncSsh|]}d|���qSrrrrrrr�sz_setup.<locals>.<setcomp>�_thread�_weakref�winregr�rz.pywz_d.pydT)r�rr�ryr��_builtin_from_namer�r�r;rrlr�r�r�r�r:r�r)�_bootstrap_module�self_module�builtin_name�builtin_module�
os_details�
builtin_osr.r8�	os_module�
thread_module�weakref_module�
winreg_modulerrr�_setupfsL













r�cCs2t|�t�}tj�tj|�g�tj�t	�dSr)
r�r�rr�r�r�r��	meta_pathr:r�)r��supported_loadersrrr�_install�sr��-arm-linux-gnueabihf.�-armeb-linux-gnueabihf.�-mips64-linux-gnuabi64.�-mips64el-linux-gnuabi64.�-powerpc-linux-gnu.�-powerpc-linux-gnuspe.�-powerpc64-linux-gnu.�-powerpc64le-linux-gnu.�-arm-linux-gnueabi.�-armeb-linux-gnueabi.�-mips64-linux-gnu.�-mips64el-linux-gnu.�-ppc-linux-gnu.�-ppc-linux-gnuspe.�-ppc64-linux-gnu.�-ppc64le-linux-gnu.)r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�cCsF|D]<}t��D].\}}||kr|�|�||��|Sqq|Sr)�	_ARCH_MAPr�r:rR)r�rh�original�alternativerrrr��sr�)rT)N)NNN)rr)T)N)N)Qr�r]rrjr�r�_MS_WINDOWSr�rr�r�r.r8r�r6r;r�r�%_CASE_INSENSITIVE_PLATFORMS_BYTES_KEYrrr#r)r*r@rGrIrNrOrQrSrd�type�__code__r�r!r�r r&r7r|rxr�ry�DEBUG_BYTECODE_SUFFIXES�OPTIMIZED_BYTECODE_SUFFIXESr�r�r�r�r�r�r�r�r�r�r�r�r�r��objectr�r�r�rr$r>r[rdrlrKrmr�r�r�r�r�r�r�r�r�rrrr�<module>s�



�

	



G(!



�D@H-:?*
A	�__pycache__/__init__.cpython-38.pyc000064400000007260150327175520013157 0ustar00U

e5d��@sjdZddddgZddlZddlZzddlZWn,ek
rXddlmZe�ee�Yn@Xd	e_	d
e_
ze�dd�e_Wne
k
r�YnXeejd	<zddlZWn0ek
r�dd
lmZe�e�ee_YnBXde_	d
e_
ze�dd�e_Wne
k
�r
YnXeejd<ejZejZddlZddlZddlmZdd�Zddd�Zddd�ZiZdd�ZdS)z'A pure Python implementation of import.�
__import__�
import_module�invalidate_caches�reload�N�)�
_bootstrapzimportlib._bootstrap�	importlibz__init__.pyz
_bootstrap.py)�_bootstrap_externalzimportlib._bootstrap_externalz_bootstrap_external.py)rcCs"tjD]}t|d�r|��qdS)zmCall the invalidate_caches() method on all meta path finders stored in
    sys.meta_path (where implemented).rN)�sys�	meta_path�hasattrr)�finder�r�*/usr/lib64/python3.8/importlib/__init__.pyrBs

cCs�tjdtdd�z.tj|j}|dkr6td�|���n|WSWn6tk
rRYn$t	k
rttd�|��d�YnXt
�||�}|dkr�dS|jdkr�|j
dkr�td�|�|d��td	|d��|jS)
z�Return the loader for the specified module.

    This is a backward-compatible wrapper around find_spec().

    This function is deprecated in favor of importlib.util.find_spec().

    zDDeprecated since Python 3.4. Use importlib.util.find_spec() instead.�)�
stacklevelNz{}.__loader__ is Nonez{}.__loader__ is not setzspec for {} missing loader��namez&namespace packages do not have loaders)�warnings�warn�DeprecationWarningr
�modules�
__loader__�
ValueError�format�KeyError�AttributeErrorr�
_find_spec�loader�submodule_search_locations�ImportError)r�pathr�specrrr�find_loaderJs2�



��r#cCsXd}|�d�rB|s$d}t|�|���|D]}|dkr8qB|d7}q(t�||d�||�S)z�Import a module.

    The 'package' argument is required when performing a relative import. It
    specifies the package to use as the anchor point from which to resolve the
    relative import to an absolute import.

    r�.zHthe 'package' argument is required to perform a relative import for {!r}rN)�
startswith�	TypeErrorrr�_gcd_import)r�package�level�msg�	characterrrrrms

cCsP|rt|tj�std��z|jj}Wntk
r>|j}YnXtj	�
|�|k	rfd}t|�|�|d��|t
krvt
|S|t
|<z�|�d�d}|r�ztj	|}Wn,tk
r�d}t|�|�|d�d�Yq�X|j}nd}|}t�|||�}|_|dk�rtd|��|d��t�||�tj	|W�Sz
t
|=Wntk
�rHYnXXdS)	zcReload the module and return it.

    The module must have been successfully imported before.

    z"reload() argument must be a modulezmodule {} not in sys.modulesrr$rzparent {!r} not in sys.modulesNzspec not found for the module )�
isinstance�types�
ModuleTyper&�__spec__rr�__name__r
r�getr r�
_RELOADINGr�
rpartition�__path__rr�ModuleNotFoundError�_exec)�modulerr*�parent_name�parent�pkgpath�targetr"rrrr�sH
��

)N)N)�__doc__�__all__�_impr
�_frozen_importlibrr ��_setupr0�__package__�__file__�replace�	NameErrorr�_frozen_importlib_externalr	�_pack_uint32�_unpack_uint32r-rrrr#rr2rrrrr�<module>sL




#
metadata.py000064400000042334150327175520006713 0ustar00import io
import os
import re
import abc
import csv
import sys
import email
import pathlib
import zipfile
import operator
import functools
import itertools
import posixpath
import collections

from configparser import ConfigParser
from contextlib import suppress
from importlib import import_module
from importlib.abc import MetaPathFinder
from itertools import starmap


__all__ = [
    'Distribution',
    'DistributionFinder',
    'PackageNotFoundError',
    'distribution',
    'distributions',
    'entry_points',
    'files',
    'metadata',
    'requires',
    'version',
    ]


class PackageNotFoundError(ModuleNotFoundError):
    """The package was not found."""


class EntryPoint(
        collections.namedtuple('EntryPointBase', 'name value group')):
    """An entry point as defined by Python packaging conventions.

    See `the packaging docs on entry points
    <https://packaging.python.org/specifications/entry-points/>`_
    for more information.
    """

    pattern = re.compile(
        r'(?P<module>[\w.]+)\s*'
        r'(:\s*(?P<attr>[\w.]+)\s*)?'
        r'((?P<extras>\[.*\])\s*)?$'
        )
    """
    A regular expression describing the syntax for an entry point,
    which might look like:

        - module
        - package.module
        - package.module:attribute
        - package.module:object.attribute
        - package.module:attr [extra1, extra2]

    Other combinations are possible as well.

    The expression is lenient about whitespace around the ':',
    following the attr, and following any extras.
    """

    def load(self):
        """Load the entry point from its definition. If only a module
        is indicated by the value, return that module. Otherwise,
        return the named object.
        """
        match = self.pattern.match(self.value)
        module = import_module(match.group('module'))
        attrs = filter(None, (match.group('attr') or '').split('.'))
        return functools.reduce(getattr, attrs, module)

    @property
    def extras(self):
        match = self.pattern.match(self.value)
        return list(re.finditer(r'\w+', match.group('extras') or ''))

    @classmethod
    def _from_config(cls, config):
        return [
            cls(name, value, group)
            for group in config.sections()
            for name, value in config.items(group)
            ]

    @classmethod
    def _from_text(cls, text):
        config = ConfigParser(delimiters='=')
        # case sensitive: https://stackoverflow.com/q/1611799/812183
        config.optionxform = str
        try:
            config.read_string(text)
        except AttributeError:  # pragma: nocover
            # Python 2 has no read_string
            config.readfp(io.StringIO(text))
        return EntryPoint._from_config(config)

    def __iter__(self):
        """
        Supply iter so one may construct dicts of EntryPoints easily.
        """
        return iter((self.name, self))

    def __reduce__(self):
        return (
            self.__class__,
            (self.name, self.value, self.group),
            )


class PackagePath(pathlib.PurePosixPath):
    """A reference to a path in a package"""

    def read_text(self, encoding='utf-8'):
        with self.locate().open(encoding=encoding) as stream:
            return stream.read()

    def read_binary(self):
        with self.locate().open('rb') as stream:
            return stream.read()

    def locate(self):
        """Return a path-like object for this path"""
        return self.dist.locate_file(self)


class FileHash:
    def __init__(self, spec):
        self.mode, _, self.value = spec.partition('=')

    def __repr__(self):
        return '<FileHash mode: {} value: {}>'.format(self.mode, self.value)


class Distribution:
    """A Python distribution package."""

    @abc.abstractmethod
    def read_text(self, filename):
        """Attempt to load metadata file given by the name.

        :param filename: The name of the file in the distribution info.
        :return: The text if found, otherwise None.
        """

    @abc.abstractmethod
    def locate_file(self, path):
        """
        Given a path to a file in this distribution, return a path
        to it.
        """

    @classmethod
    def from_name(cls, name):
        """Return the Distribution for the given package name.

        :param name: The name of the distribution package to search for.
        :return: The Distribution instance (or subclass thereof) for the named
            package, if found.
        :raises PackageNotFoundError: When the named package's distribution
            metadata cannot be found.
        """
        for resolver in cls._discover_resolvers():
            dists = resolver(DistributionFinder.Context(name=name))
            dist = next(dists, None)
            if dist is not None:
                return dist
        else:
            raise PackageNotFoundError(name)

    @classmethod
    def discover(cls, **kwargs):
        """Return an iterable of Distribution objects for all packages.

        Pass a ``context`` or pass keyword arguments for constructing
        a context.

        :context: A ``DistributionFinder.Context`` object.
        :return: Iterable of Distribution objects for all packages.
        """
        context = kwargs.pop('context', None)
        if context and kwargs:
            raise ValueError("cannot accept context and kwargs")
        context = context or DistributionFinder.Context(**kwargs)
        return itertools.chain.from_iterable(
            resolver(context)
            for resolver in cls._discover_resolvers()
            )

    @staticmethod
    def at(path):
        """Return a Distribution for the indicated metadata path

        :param path: a string or path-like object
        :return: a concrete Distribution instance for the path
        """
        return PathDistribution(pathlib.Path(path))

    @staticmethod
    def _discover_resolvers():
        """Search the meta_path for resolvers."""
        declared = (
            getattr(finder, 'find_distributions', None)
            for finder in sys.meta_path
            )
        return filter(None, declared)

    @property
    def metadata(self):
        """Return the parsed metadata for this Distribution.

        The returned object will have keys that name the various bits of
        metadata.  See PEP 566 for details.
        """
        text = (
            self.read_text('METADATA')
            or self.read_text('PKG-INFO')
            # This last clause is here to support old egg-info files.  Its
            # effect is to just end up using the PathDistribution's self._path
            # (which points to the egg-info file) attribute unchanged.
            or self.read_text('')
            )
        return email.message_from_string(text)

    @property
    def version(self):
        """Return the 'Version' metadata for the distribution package."""
        return self.metadata['Version']

    @property
    def entry_points(self):
        return EntryPoint._from_text(self.read_text('entry_points.txt'))

    @property
    def files(self):
        """Files in this distribution.

        :return: List of PackagePath for this distribution or None

        Result is `None` if the metadata file that enumerates files
        (i.e. RECORD for dist-info or SOURCES.txt for egg-info) is
        missing.
        Result may be empty if the metadata exists but is empty.
        """
        file_lines = self._read_files_distinfo() or self._read_files_egginfo()

        def make_file(name, hash=None, size_str=None):
            result = PackagePath(name)
            result.hash = FileHash(hash) if hash else None
            result.size = int(size_str) if size_str else None
            result.dist = self
            return result

        return file_lines and list(starmap(make_file, csv.reader(file_lines)))

    def _read_files_distinfo(self):
        """
        Read the lines of RECORD
        """
        text = self.read_text('RECORD')
        return text and text.splitlines()

    def _read_files_egginfo(self):
        """
        SOURCES.txt might contain literal commas, so wrap each line
        in quotes.
        """
        text = self.read_text('SOURCES.txt')
        return text and map('"{}"'.format, text.splitlines())

    @property
    def requires(self):
        """Generated requirements specified for this Distribution"""
        reqs = self._read_dist_info_reqs() or self._read_egg_info_reqs()
        return reqs and list(reqs)

    def _read_dist_info_reqs(self):
        return self.metadata.get_all('Requires-Dist')

    def _read_egg_info_reqs(self):
        source = self.read_text('requires.txt')
        return source and self._deps_from_requires_text(source)

    @classmethod
    def _deps_from_requires_text(cls, source):
        section_pairs = cls._read_sections(source.splitlines())
        sections = {
            section: list(map(operator.itemgetter('line'), results))
            for section, results in
            itertools.groupby(section_pairs, operator.itemgetter('section'))
            }
        return cls._convert_egg_info_reqs_to_simple_reqs(sections)

    @staticmethod
    def _read_sections(lines):
        section = None
        for line in filter(None, lines):
            section_match = re.match(r'\[(.*)\]$', line)
            if section_match:
                section = section_match.group(1)
                continue
            yield locals()

    @staticmethod
    def _convert_egg_info_reqs_to_simple_reqs(sections):
        """
        Historically, setuptools would solicit and store 'extra'
        requirements, including those with environment markers,
        in separate sections. More modern tools expect each
        dependency to be defined separately, with any relevant
        extras and environment markers attached directly to that
        requirement. This method converts the former to the
        latter. See _test_deps_from_requires_text for an example.
        """
        def make_condition(name):
            return name and 'extra == "{name}"'.format(name=name)

        def parse_condition(section):
            section = section or ''
            extra, sep, markers = section.partition(':')
            if extra and markers:
                markers = '({markers})'.format(markers=markers)
            conditions = list(filter(None, [markers, make_condition(extra)]))
            return '; ' + ' and '.join(conditions) if conditions else ''

        for section, deps in sections.items():
            for dep in deps:
                yield dep + parse_condition(section)


class DistributionFinder(MetaPathFinder):
    """
    A MetaPathFinder capable of discovering installed distributions.
    """

    class Context:
        """
        Keyword arguments presented by the caller to
        ``distributions()`` or ``Distribution.discover()``
        to narrow the scope of a search for distributions
        in all DistributionFinders.

        Each DistributionFinder may expect any parameters
        and should attempt to honor the canonical
        parameters defined below when appropriate.
        """

        name = None
        """
        Specific name for which a distribution finder should match.
        A name of ``None`` matches all distributions.
        """

        def __init__(self, **kwargs):
            vars(self).update(kwargs)

        @property
        def path(self):
            """
            The path that a distribution finder should search.

            Typically refers to Python package paths and defaults
            to ``sys.path``.
            """
            return vars(self).get('path', sys.path)

    @abc.abstractmethod
    def find_distributions(self, context=Context()):
        """
        Find distributions.

        Return an iterable of all Distribution instances capable of
        loading the metadata for packages matching the ``context``,
        a DistributionFinder.Context instance.
        """


class FastPath:
    """
    Micro-optimized class for searching a path for
    children.
    """

    def __init__(self, root):
        self.root = root
        self.base = os.path.basename(root).lower()

    def joinpath(self, child):
        return pathlib.Path(self.root, child)

    def children(self):
        with suppress(Exception):
            return os.listdir(self.root or '')
        with suppress(Exception):
            return self.zip_children()
        return []

    def zip_children(self):
        zip_path = zipfile.Path(self.root)
        names = zip_path.root.namelist()
        self.joinpath = zip_path.joinpath

        return dict.fromkeys(
            child.split(posixpath.sep, 1)[0]
            for child in names
            )

    def is_egg(self, search):
        base = self.base
        return (
            base == search.versionless_egg_name
            or base.startswith(search.prefix)
            and base.endswith('.egg'))

    def search(self, name):
        for child in self.children():
            n_low = child.lower()
            if (n_low in name.exact_matches
                    or n_low.startswith(name.prefix)
                    and n_low.endswith(name.suffixes)
                    # legacy case:
                    or self.is_egg(name) and n_low == 'egg-info'):
                yield self.joinpath(child)


class Prepared:
    """
    A prepared search for metadata on a possibly-named package.
    """
    normalized = ''
    prefix = ''
    suffixes = '.dist-info', '.egg-info'
    exact_matches = [''][:0]
    versionless_egg_name = ''

    def __init__(self, name):
        self.name = name
        if name is None:
            return
        self.normalized = name.lower().replace('-', '_')
        self.prefix = self.normalized + '-'
        self.exact_matches = [
            self.normalized + suffix for suffix in self.suffixes]
        self.versionless_egg_name = self.normalized + '.egg'


class MetadataPathFinder(DistributionFinder):
    @classmethod
    def find_distributions(cls, context=DistributionFinder.Context()):
        """
        Find distributions.

        Return an iterable of all Distribution instances capable of
        loading the metadata for packages matching ``context.name``
        (or all names if ``None`` indicated) along the paths in the list
        of directories ``context.path``.
        """
        found = cls._search_paths(context.name, context.path)
        return map(PathDistribution, found)

    @classmethod
    def _search_paths(cls, name, paths):
        """Find metadata directories in paths heuristically."""
        return itertools.chain.from_iterable(
            path.search(Prepared(name))
            for path in map(FastPath, paths)
            )


class PathDistribution(Distribution):
    def __init__(self, path):
        """Construct a distribution from a path to the metadata directory.

        :param path: A pathlib.Path or similar object supporting
                     .joinpath(), __div__, .parent, and .read_text().
        """
        self._path = path

    def read_text(self, filename):
        with suppress(FileNotFoundError, IsADirectoryError, KeyError,
                      NotADirectoryError, PermissionError):
            return self._path.joinpath(filename).read_text(encoding='utf-8')
    read_text.__doc__ = Distribution.read_text.__doc__

    def locate_file(self, path):
        return self._path.parent / path


def distribution(distribution_name):
    """Get the ``Distribution`` instance for the named package.

    :param distribution_name: The name of the distribution package as a string.
    :return: A ``Distribution`` instance (or subclass thereof).
    """
    return Distribution.from_name(distribution_name)


def distributions(**kwargs):
    """Get all ``Distribution`` instances in the current environment.

    :return: An iterable of ``Distribution`` instances.
    """
    return Distribution.discover(**kwargs)


def metadata(distribution_name):
    """Get the metadata for the named package.

    :param distribution_name: The name of the distribution package to query.
    :return: An email.Message containing the parsed metadata.
    """
    return Distribution.from_name(distribution_name).metadata


def version(distribution_name):
    """Get the version string for the named package.

    :param distribution_name: The name of the distribution package to query.
    :return: The version string for the package as defined in the package's
        "Version" metadata key.
    """
    return distribution(distribution_name).version


def entry_points():
    """Return EntryPoint objects for all installed packages.

    :return: EntryPoint objects for all installed packages.
    """
    eps = itertools.chain.from_iterable(
        dist.entry_points for dist in distributions())
    by_group = operator.attrgetter('group')
    ordered = sorted(eps, key=by_group)
    grouped = itertools.groupby(ordered, by_group)
    return {
        group: tuple(eps)
        for group, eps in grouped
        }


def files(distribution_name):
    """Return a list of files for the named package.

    :param distribution_name: The name of the distribution package to query.
    :return: List of files composing the distribution.
    """
    return distribution(distribution_name).files


def requires(distribution_name):
    """
    Return a list of requirements for the named package.

    :return: An iterator of requirements, suitable for
    packaging.requirement.Requirement.
    """
    return distribution(distribution_name).requires
resources.py000064400000022500150327175520007136 0ustar00import os
import tempfile

from . import abc as resources_abc
from contextlib import contextmanager, suppress
from importlib import import_module
from importlib.abc import ResourceLoader
from io import BytesIO, TextIOWrapper
from pathlib import Path
from types import ModuleType
from typing import Iterable, Iterator, Optional, Set, Union   # noqa: F401
from typing import cast
from typing.io import BinaryIO, TextIO
from zipimport import ZipImportError


__all__ = [
    'Package',
    'Resource',
    'contents',
    'is_resource',
    'open_binary',
    'open_text',
    'path',
    'read_binary',
    'read_text',
    ]


Package = Union[str, ModuleType]
Resource = Union[str, os.PathLike]


def _get_package(package) -> ModuleType:
    """Take a package name or module object and return the module.

    If a name, the module is imported.  If the passed or imported module
    object is not a package, raise an exception.
    """
    if hasattr(package, '__spec__'):
        if package.__spec__.submodule_search_locations is None:
            raise TypeError('{!r} is not a package'.format(
                package.__spec__.name))
        else:
            return package
    else:
        module = import_module(package)
        if module.__spec__.submodule_search_locations is None:
            raise TypeError('{!r} is not a package'.format(package))
        else:
            return module


def _normalize_path(path) -> str:
    """Normalize a path by ensuring it is a string.

    If the resulting string contains path separators, an exception is raised.
    """
    parent, file_name = os.path.split(path)
    if parent:
        raise ValueError('{!r} must be only a file name'.format(path))
    else:
        return file_name


def _get_resource_reader(
        package: ModuleType) -> Optional[resources_abc.ResourceReader]:
    # Return the package's loader if it's a ResourceReader.  We can't use
    # a issubclass() check here because apparently abc.'s __subclasscheck__()
    # hook wants to create a weak reference to the object, but
    # zipimport.zipimporter does not support weak references, resulting in a
    # TypeError.  That seems terrible.
    spec = package.__spec__
    if hasattr(spec.loader, 'get_resource_reader'):
        return cast(resources_abc.ResourceReader,
                    spec.loader.get_resource_reader(spec.name))
    return None


def _check_location(package):
    if package.__spec__.origin is None or not package.__spec__.has_location:
        raise FileNotFoundError(f'Package has no location {package!r}')


def open_binary(package: Package, resource: Resource) -> BinaryIO:
    """Return a file-like object opened for binary reading of the resource."""
    resource = _normalize_path(resource)
    package = _get_package(package)
    reader = _get_resource_reader(package)
    if reader is not None:
        return reader.open_resource(resource)
    _check_location(package)
    absolute_package_path = os.path.abspath(package.__spec__.origin)
    package_path = os.path.dirname(absolute_package_path)
    full_path = os.path.join(package_path, resource)
    try:
        return open(full_path, mode='rb')
    except OSError:
        # Just assume the loader is a resource loader; all the relevant
        # importlib.machinery loaders are and an AttributeError for
        # get_data() will make it clear what is needed from the loader.
        loader = cast(ResourceLoader, package.__spec__.loader)
        data = None
        if hasattr(package.__spec__.loader, 'get_data'):
            with suppress(OSError):
                data = loader.get_data(full_path)
        if data is None:
            package_name = package.__spec__.name
            message = '{!r} resource not found in {!r}'.format(
                resource, package_name)
            raise FileNotFoundError(message)
        else:
            return BytesIO(data)


def open_text(package: Package,
              resource: Resource,
              encoding: str = 'utf-8',
              errors: str = 'strict') -> TextIO:
    """Return a file-like object opened for text reading of the resource."""
    resource = _normalize_path(resource)
    package = _get_package(package)
    reader = _get_resource_reader(package)
    if reader is not None:
        return TextIOWrapper(reader.open_resource(resource), encoding, errors)
    _check_location(package)
    absolute_package_path = os.path.abspath(package.__spec__.origin)
    package_path = os.path.dirname(absolute_package_path)
    full_path = os.path.join(package_path, resource)
    try:
        return open(full_path, mode='r', encoding=encoding, errors=errors)
    except OSError:
        # Just assume the loader is a resource loader; all the relevant
        # importlib.machinery loaders are and an AttributeError for
        # get_data() will make it clear what is needed from the loader.
        loader = cast(ResourceLoader, package.__spec__.loader)
        data = None
        if hasattr(package.__spec__.loader, 'get_data'):
            with suppress(OSError):
                data = loader.get_data(full_path)
        if data is None:
            package_name = package.__spec__.name
            message = '{!r} resource not found in {!r}'.format(
                resource, package_name)
            raise FileNotFoundError(message)
        else:
            return TextIOWrapper(BytesIO(data), encoding, errors)


def read_binary(package: Package, resource: Resource) -> bytes:
    """Return the binary contents of the resource."""
    resource = _normalize_path(resource)
    package = _get_package(package)
    with open_binary(package, resource) as fp:
        return fp.read()


def read_text(package: Package,
              resource: Resource,
              encoding: str = 'utf-8',
              errors: str = 'strict') -> str:
    """Return the decoded string of the resource.

    The decoding-related arguments have the same semantics as those of
    bytes.decode().
    """
    resource = _normalize_path(resource)
    package = _get_package(package)
    with open_text(package, resource, encoding, errors) as fp:
        return fp.read()


@contextmanager
def path(package: Package, resource: Resource) -> Iterator[Path]:
    """A context manager providing a file path object to the resource.

    If the resource does not already exist on its own on the file system,
    a temporary file will be created. If the file was created, the file
    will be deleted upon exiting the context manager (no exception is
    raised if the file was deleted prior to the context manager
    exiting).
    """
    resource = _normalize_path(resource)
    package = _get_package(package)
    reader = _get_resource_reader(package)
    if reader is not None:
        try:
            yield Path(reader.resource_path(resource))
            return
        except FileNotFoundError:
            pass
    else:
        _check_location(package)
    # Fall-through for both the lack of resource_path() *and* if
    # resource_path() raises FileNotFoundError.
    file_path = None
    if package.__spec__.origin is not None:
        package_directory = Path(package.__spec__.origin).parent
        file_path = package_directory / resource
    if file_path is not None and file_path.exists():
        yield file_path
    else:
        with open_binary(package, resource) as fp:
            data = fp.read()
        # Not using tempfile.NamedTemporaryFile as it leads to deeper 'try'
        # blocks due to the need to close the temporary file to work on
        # Windows properly.
        fd, raw_path = tempfile.mkstemp()
        try:
            os.write(fd, data)
            os.close(fd)
            yield Path(raw_path)
        finally:
            try:
                os.remove(raw_path)
            except FileNotFoundError:
                pass


def is_resource(package: Package, name: str) -> bool:
    """True if 'name' is a resource inside 'package'.

    Directories are *not* resources.
    """
    package = _get_package(package)
    _normalize_path(name)
    reader = _get_resource_reader(package)
    if reader is not None:
        return reader.is_resource(name)
    try:
        package_contents = set(contents(package))
    except (NotADirectoryError, FileNotFoundError):
        return False
    if name not in package_contents:
        return False
    # Just because the given file_name lives as an entry in the package's
    # contents doesn't necessarily mean it's a resource.  Directories are not
    # resources, so let's try to find out if it's a directory or not.
    path = Path(package.__spec__.origin).parent / name
    return path.is_file()


def contents(package: Package) -> Iterable[str]:
    """Return an iterable of entries in 'package'.

    Note that not all entries are resources.  Specifically, directories are
    not considered resources.  Use `is_resource()` on each entry returned here
    to check if it is a resource or not.
    """
    package = _get_package(package)
    reader = _get_resource_reader(package)
    if reader is not None:
        return reader.contents()
    # Is the package a namespace package?  By definition, namespace packages
    # cannot have resources.  We could use _check_location() and catch the
    # exception, but that's extra work, so just inline the check.
    elif package.__spec__.origin is None or not package.__spec__.has_location:
        return ()
    else:
        package_directory = Path(package.__spec__.origin).parent
        return os.listdir(package_directory)
__init__.pyo000064400000002736150327176250007054 0ustar00�
{fc@s+dZddlZd�Zdd�ZdS(s-Backport of importlib.import_module from 3.x.i����NcCs�t|d�std��nt|�}xSt|dd�D]?}y|jdd|�}Wq=tk
r{td��q=Xq=Wd|| |fS(	s6Return the absolute name of the module to be imported.trindexs'package' not set to a stringii����t.is2attempted relative import beyond top-level packages%s.%s(thasattrt
ValueErrortlentxrangeR(tnametpackagetleveltdottx((s*/usr/lib64/python2.7/importlib/__init__.pyt
_resolve_names
cCs�|jd�rn|s$td��nd}x(|D] }|dkrGPn|d7}q1Wt||||�}nt|�tj|S(s�Import a module.

    The 'package' argument is required when performing a relative import. It
    specifies the package to use as the anchor point from which to resolve the
    relative import to an absolute import.

    Rs/relative imports require the 'package' argumentii(t
startswitht	TypeErrorRt
__import__tsystmodules(RRRt	character((s*/usr/lib64/python2.7/importlib/__init__.pyt
import_modules

(t__doc__RRtNoneR(((s*/usr/lib64/python2.7/importlib/__init__.pyt<module>s	__init__.pyc000064400000002736150327176250007040 0ustar00�
{fc@s+dZddlZd�Zdd�ZdS(s-Backport of importlib.import_module from 3.x.i����NcCs�t|d�std��nt|�}xSt|dd�D]?}y|jdd|�}Wq=tk
r{td��q=Xq=Wd|| |fS(	s6Return the absolute name of the module to be imported.trindexs'package' not set to a stringii����t.is2attempted relative import beyond top-level packages%s.%s(thasattrt
ValueErrortlentxrangeR(tnametpackagetleveltdottx((s*/usr/lib64/python2.7/importlib/__init__.pyt
_resolve_names
cCs�|jd�rn|s$td��nd}x(|D] }|dkrGPn|d7}q1Wt||||�}nt|�tj|S(s�Import a module.

    The 'package' argument is required when performing a relative import. It
    specifies the package to use as the anchor point from which to resolve the
    relative import to an absolute import.

    Rs/relative imports require the 'package' argumentii(t
startswitht	TypeErrorRt
__import__tsystmodules(RRRt	character((s*/usr/lib64/python2.7/importlib/__init__.pyt
import_modules

(t__doc__RRtNoneR(((s*/usr/lib64/python2.7/importlib/__init__.pyt<module>s