Usage:
        import_and_wrap_deprecated('conda.common.connection', locals())
        # looks for conda.common.connection.__all__
508458
def import_and_wrap_deprecated(module_name, module_dict, warn_import=True):
    
    if warn_import:
        deprecated_import(module_name)

    from importlib import import_module
    module = import_module(module_name)
    for attr in module.__all__:
        module_dict[attr] = deprecated(getattr(module, attr))
1231387
def _wrap_deprecated_function(func, message):
    
    def _(col):
        warnings.warn(message, DeprecationWarning)
        return func(col)
    return functools.wraps(func)(_)
1297491
def find_conda():
    
    USER_HOME = os.path.expanduser('~')
    CONDA_HOME = os.environ.get('CONDA_HOME', '')
    PROGRAMDATA = os.environ.get('PROGRAMDATA', '')

    # Search common install paths and sys path
    search_paths = [
        # Windows
        join(PROGRAMDATA, 'miniconda2', 'scripts'),
        join(PROGRAMDATA, 'miniconda3', 'scripts'),
        join(USER_HOME, 'miniconda2', 'scripts'),
        join(USER_HOME, 'miniconda3', 'scripts'),
        join(CONDA_HOME, 'scripts'),

        # Linux
        join(USER_HOME, 'miniconda2', 'bin'),
        join(USER_HOME, 'miniconda3', 'bin'),
        join(CONDA_HOME, 'bin'),
        # TODO: OSX
    ] + os.environ.get("PATH", "").split(";" if 'win' in sys.path else ":")

    cmd = 'conda.exe' if IS_WIN else 'conda'
    for conda_path in search_paths:
        conda = join(conda_path, cmd)
        if exists(conda):
            return sh.Command(conda)

    # Try to let the system find it
    return sh.conda
1331297
def commonjs_module?
      data.to_s.include?("module.exports") || data.present? && data.to_s.match(/(require\(.*\)|import)/) && dependencies.length > 0
    end
643247
def is_import(self):
        """"""
        return not self.cmd and len(self.deps) == 1 and len(self.outs) == 1
1195271
def connection_class(self, adapter):
        """"""
        if self.adapters.get(adapter):
            return self.adapters[adapter]
        try:
            class_prefix = getattr(
                __import__('db.' + adapter, globals(), locals(),
                           ['__class_prefix__']), '__class_prefix__')
            driver = self._import_class('db.' + adapter + '.connection.' +
                                        class_prefix + 'Connection')
        except ImportError:
            raise DBError("Must install adapter `%s` or doesn't support" %
                          (adapter))

        self.adapters[adapter] = driver
        return driver
651342
def wrap_connection(func_, *args, **kwargs):
    
    if not args[-1]:
        new_args = list(args)
        new_args[-1] = connect()
        args = tuple(new_args)
    return func_(*args, **kwargs)
1293011
def get_local_ep(*args, **kwargs):
    
    if kwargs.get("warn", True):
        raise DeprecationWarning("'get_local_ep()' has been deprecated in favor of "
                                 "'globus_sdk.LocalGlobusConnectPersonal().endpoint_id'. "
                                 "To override, pass in 'warn=False'.")
    else:
        import warnings
        warnings.warn("'get_local_ep()' has been deprecated in favor of "
                      "'globus_sdk.LocalGlobusConnectPersonal().endpoint_id'.")
    return globus_sdk.LocalGlobusConnectPersonal().endpoint_id
1004867
def get_all_dict(module):
    """"""
    if hasattr(module, "__all__"):
        all_dict = copy.deepcopy(module.__all__)
    else:
        all_dict = copy.deepcopy(dir(module))
        all_dict = [name for name in all_dict
                    if not name.startswith("_")]
    for name in ['absolute_import', 'division', 'print_function']:
        try:
            all_dict.remove(name)
        except ValueError:
            pass

    # Modules are almost always private; real submodules need a separate
    # run of refguide_check.
    all_dict = [name for name in all_dict
                if not inspect.ismodule(getattr(module, name, None))]

    deprecated = []
    not_deprecated = []
    for name in all_dict:
        f = getattr(module, name, None)
        if callable(f) and is_deprecated(f):
            deprecated.append(name)
        else:
            not_deprecated.append(name)

    others = set(dir(module)).difference(set(deprecated)).difference(set(not_deprecated))

    return not_deprecated, deprecated, others
214626
def _ImportHookBySuffix(
    name, globals=None, locals=None, fromlist=None, level=None):
  
  _IncrementNestLevel()

  if level is None:
    # A level of 0 means absolute import, positive values means relative
    # imports, and -1 means to try both an absolute and relative import.
    # Since imports were disambiguated in Python 3, -1 is not a valid value.
    # The default values are 0 and -1 for Python 3 and 3 respectively.
    # https://docs.python.org/2/library/functions.html#__import__
    # https://docs.python.org/3/library/functions.html#__import__
    level = 0 if six.PY3 else -1

  try:
    # Really import modules.
    module = _real_import(name, globals, locals, fromlist, level)
  finally:
    # This _real_import call may raise an exception (e.g., ImportError).
    # However, there might be several modules already loaded before the
    # exception was raised. For instance:
    #   a.py
    #     import b  # success
    #     import c  # ImportError exception.
    # In this case, an 'import a' statement would have the side effect of
    # importing module 'b'. This should trigger the import hooks for module
    # 'b'. To achieve this, we always search/invoke import callbacks (i.e.,
    # even when an exception is raised).
    #
    # Important Note: Do not use 'return' inside the finally block. It will
    # cause any pending exception to be discarded.
    _ProcessImportBySuffix(name, fromlist, globals)

  return module
374942
function (connection, options) {
	options = options || {};
	var includeKey = options.includeKey;
	
	return map(function (key, callback) {
		connection.get(key, options, includeKey ? function (error, result) {
			if (result != null)
				result.key = key;
			callback(error, result);
		} : callback);
	});
}
1212031
def return_locals(func):
    ''''''

    @functools.wraps(func)
    def wrap(*args, **kwargs):
        frames = []

        def tracer(frame, event, arg): # pragma: no cover
            # coverage does not work in this function because the tracer
            # is deactivated here
            frames.append(frame)
            sys.settrace(old_tracer)
            if old_tracer is not None:
                return old_tracer(frame, event, arg)

        old_tracer = sys.gettrace()
        # tracer is activated on next call, return or exception
        sys.settrace(tracer)
        try:
            func(*args, **kwargs)
        finally:
            sys.settrace(old_tracer)
        assert len(frames) == 1
        argspec = inspect.getargspec(func)
        argnames = list(argspec.args)
        if argspec.varargs is not None:
            argnames.append(argspec.varargs)
        if argspec.keywords is not None:
            argnames.append(argspec.keywords)
        return {name: value for name, value in frames.pop(0).f_locals.items()
                if name not in argnames}

    return wrap
442679
def import_handle(self, original, loc, tokens):
        """"""
        if len(tokens) == 1:
            imp_from, imports = None, tokens[0]
        elif len(tokens) == 2:
            imp_from, imports = tokens
            if imp_from == "__future__":
                self.strict_err_or_warn("unnecessary from __future__ import (Coconut does these automatically)", original, loc)
                return ""
        else:
            raise CoconutInternalException("invalid import tokens", tokens)
        if self.strict:
            self.unused_imports.update(imported_names(imports))
        return universal_import(imports, imp_from=imp_from, target=self.target)
1345953
def wrap_connection_loader__get(name, *args, **kwargs):
    
    if name in ('docker', 'kubectl', 'jail', 'local', 'lxc',
                'lxd', 'machinectl', 'setns', 'ssh'):
        name = 'mitogen_' + name
    return connection_loader__get(name, *args, **kwargs)
1151506
def deprecated(func):
    """"""

    @functools.wraps(func)
    def decorated(*args, **kwargs):
        warnings.warn_explicit(
            "Call to deprecated function {}.".format(func.__name__),
            category=DeprecationWarning,
            filename=func.__code__.co_filename,
            lineno=func.__code__.co_firstlineno + 1
        )

        return func(*args, **kwargs)
    return decorated
350642
def _check_for_conda_problems():
    
    conda_bin = _get_conda_bin()
    channels = _get_conda_channels(conda_bin)
    lib_dir = os.path.join(os.path.dirname(conda_bin), os.pardir, "lib")
    for l in ["libgomp.so.1", "libquadmath.so"]:
        if not os.path.exists(os.path.join(lib_dir, l)):
            subprocess.check_call([conda_bin, "install", "-f", "--yes"] + channels + ["libgcc-ng"])
505885
def try_import(module_name, names=None, default=ImportErrorModule, warn=True):
    
    try:
        module = importlib.import_module(module_name)
    except ImportError:
        if warn:
            if warn is True:
                Config.utils_logger.warning(
                    "Module `%s` not found. Install it to remove this warning"
                    % module_name
                )
            else:
                warn(module_name, names, default)
        module = (
            ImportErrorModule(module_name) if default is ImportErrorModule else default
        )
    if not names:
        return module
    if not isinstance(names, (tuple, set, list)):
        names = [names]
    result = []
    for name in names:
        if hasattr(module, name):
            result.append(module.__getattribute__(name))
        else:
            result.append(
                ImportErrorModule("%s.%s" % (module_name, name))
                if default is ImportErrorModule
                else default
            )
    return result[0] if len(result) == 1 else result