# Path: bin/deps/astroid/interpreter/_import/spec.py
#     _HAS_MACHINERY = True
#     _HAS_MACHINERY = False
# _SPEC_FINDERS = (
#     ImpFinder,
#     ZipFinder,
# )
# def _imp_type_to_module_type(imp_type):
#     def __new__(cls, name, module_type, location=None, origin=None,
#                 submodule_search_locations=None):
#     def __init__(self, path=None):
#     def find_module(self, modname, module_parts, processed, submodule_path):
#     def contribute_to_path(self, spec, processed):
#     def find_module(self, modname, module_parts, processed, submodule_path):
#     def contribute_to_path(self, spec, processed):
#     def find_module(self, modname, module_parts, processed, submodule_path):
#     def contribute_to_path(self, spec, processed):
#     def __init__(self, path):
#     def find_module(self, modname, module_parts, processed, submodule_path):
#     def find_module(self, modname, module_parts, processed, submodule_path):
#     def contribute_to_path(self, spec, processed):
# def _is_setuptools_namespace(location):
# def _cached_set_diff(left, right):
# def _precache_zipimporters(path=None):
# def _search_zip(modpath, pic):
# def _find_spec_with_path(search_path, modname, module_parts, processed, submodule_path):
# def find_spec(modpath, path=None):
# class ModuleSpec(_ModuleSpec):
# class Finder(object):
# class ImpFinder(Finder):
# class ExplicitNamespacePackageFinder(ImpFinder):
# class ZipFinder(Finder):
# class PathSpecFinder(Finder):


import imp
import os
import platform
import sys
import six
from distutils.sysconfig import get_python_lib # pylint: disable=import-error
from distutils.errors import DistutilsPlatformError
from .interpreter._import import spec
from .interpreter._import import util
    except ImportError:
        return False


# internal only functions #####################################################

def _spec_from_modpath(modpath, path=None, context=None):
    """given a mod path (i.e. split module / package name), return the
    corresponding spec

    this function is used internally, see `file_from_modpath`'s
    documentation for more information
    """
    assert modpath
    location = None
    if context is not None:
        try:
            found_spec = spec.find_spec(modpath, [context])
            location = found_spec.location
        except ImportError:
            found_spec = spec.find_spec(modpath, path)
            location = found_spec.location
    else:
        found_spec = spec.find_spec(modpath, path)
    if found_spec.type == spec.ModuleType.PY_COMPILED:
        try:
            location = get_source_file(found_spec.location)
            return found_spec._replace(location=location, type=spec.ModuleType.PY_SOURCE)
        except NoSourceFile:
            return found_spec._replace(location=location)

# Path: bin/deps/astroid/interpreter/_import/spec.py
#     _HAS_MACHINERY = True
#     _HAS_MACHINERY = False
# _SPEC_FINDERS = (
#     ImpFinder,
#     ZipFinder,
# )
# def _imp_type_to_module_type(imp_type):
#     def __new__(cls, name, module_type, location=None, origin=None,
#                 submodule_search_locations=None):
#     def __init__(self, path=None):
#     def find_module(self, modname, module_parts, processed, submodule_path):
#     def contribute_to_path(self, spec, processed):
#     def find_module(self, modname, module_parts, processed, submodule_path):
#     def contribute_to_path(self, spec, processed):
#     def find_module(self, modname, module_parts, processed, submodule_path):
#     def contribute_to_path(self, spec, processed):
#     def __init__(self, path):
#     def find_module(self, modname, module_parts, processed, submodule_path):
#     def find_module(self, modname, module_parts, processed, submodule_path):
#     def contribute_to_path(self, spec, processed):
# def _is_setuptools_namespace(location):
# def _cached_set_diff(left, right):
# def _precache_zipimporters(path=None):
# def _search_zip(modpath, pic):
# def _find_spec_with_path(search_path, modname, module_parts, processed, submodule_path):
# def find_spec(modpath, path=None):
# class ModuleSpec(_ModuleSpec):
# class Finder(object):
# class ImpFinder(Finder):
# class ExplicitNamespacePackageFinder(ImpFinder):
# class ZipFinder(Finder):
# class PathSpecFinder(Finder):


# Path: bin/deps/astroid/modutils.py
import imp
import os
import platform
import sys
import six
from distutils.sysconfig import get_python_lib # pylint: disable=import-error
from distutils.errors import DistutilsPlatformError
from .interpreter._import import spec
from .interpreter._import import util

    except ImportError:
        return False


# internal only functions #####################################################

def _spec_from_modpath(modpath, path=None, context=None):
    """given a mod path (i.e. split module / package name), return the
    corresponding spec

    this function is used internally, see `file_from_modpath`'s
    documentation for more information
    """
    assert modpath
    location = None
    if context is not None:
        try:
            found_spec = spec.find_spec(modpath, [context])
            location = found_spec.location
        except ImportError:
            found_spec = spec.find_spec(modpath, path)
            location = found_spec.location
    else:
        found_spec = spec.find_spec(modpath, path)
    if found_spec.type == spec.ModuleType.PY_COMPILED:
        try:
            location = get_source_file(found_spec.location)
            return found_spec._replace(location=location, type=spec.ModuleType.PY_SOURCE)
        except NoSourceFile:
            return found_spec._replace(location=location)

    elif found_spec.type == spec.ModuleType.C_BUILTIN: