Stolen from igorw/get-in because YAY can't have a lot of dependencies
973219
private function getIn(array $array, array $keys, $default = null)
    {
        if (!$keys) {
            return $array;
        }

        // This is a micro-optimization, it is fast for non-nested keys, but fails for null values
        if (\count($keys) === 1 && isset($array[$keys[0]])) {
            return $array[$keys[0]];
        }

        $current = $array;
        foreach ($keys as $key) {
            if (!\is_array($current) || !\array_key_exists($key, $current)) {
                return $default;
            }

            $current = $current[$key];
        }

        return $current;
    }
1146377
function(context, pkg, isRoot) {
		var deps = crawl.getDependencies(context.loader, pkg, isRoot);

		return Promise.all(utils.filter(utils.map(deps, function(childPkg){
			return crawl.fetchDep(context, pkg, childPkg, isRoot);
		}), truthy)).then(function(packages){
 			// at this point all dependencies of pkg have been loaded, it's ok to get their children

			return Promise.all(utils.map(packages, function(childPkg){
				// Also load 'steal' so that the builtins will be configured
				if(childPkg && childPkg.name === 'steal') {
					return crawl.deps(context, childPkg);
				}
			})).then(function(){
				return packages;
			});
		});
	}
660338
function build(options) {
  installGitDependencies(options, function(err) {
    if (err) {
      console.error(err.message);
      process.exit(1);
    }

    var args = [path.join('node_modules', 'pangyp', 'bin', 'node-gyp'), 'rebuild'].concat(
      ['libsass_ext', 'libsass_cflags', 'libsass_ldflags', 'libsass_library'].map(function(subject) {
        return ['--', subject, '=', process.env[subject.toUpperCase()] || ''].join('');
      })).concat(options.args);

    console.log(['Building:', process.sass.runtime.execPath].concat(args).join(' '));

    var proc = spawn(process.sass.runtime.execPath, args, {
      stdio: [0, 1, 2]
    });

    proc.on('exit', function(errorCode) {
      if (!errorCode) {
        afterBuild(options);

        return;
      }

      console.error(errorCode === 127 ? 'node-gyp not found!' : 'Build failed');
      process.exit(1);
    });
  });
}
581752
def main(args=sys.argv):
    
    try:
        opts, args = getopt.gnu_getopt(args[1:], 'p:o:jdt', [
            'jspath=', 'output=', 'private', 'json', 'dependencies', 
            'test', 'help'])
        opts = dict(opts)
    except getopt.GetoptError:
        usage()
        sys.exit(2)

    run_and_exit_if(opts, run_doctests, '--test')
    run_and_exit_if(opts, usage, '--help')

    js_paths = get_path_list(opts)
    docs = CodeBaseDoc(js_paths, '--private' in opts)
    if args:
        selected_files = set(docs.keys()) & set(args)
    else:
        selected_files = list(docs.keys())

    def print_json():
        print(docs.to_json(selected_files))
    run_and_exit_if(opts, print_json, '--json', '-j')

    def print_dependencies():
        for dependency in find_dependencies(selected_files, docs):
            print(dependency)
    run_and_exit_if(opts, print_dependencies, '--dependencies', '-d')

    output = opts.get('--output') or opts.get('-o')
    if output is None and len(args) != 1:
        output = 'apidocs'
    docs.save_docs(selected_files, output)
1086460
def build_dependencies(self):
        '''
        '''

        cmd_list = ['pyang', '--plugindir', self.pyang_plugins]
        cmd_list += ['-p', self.dir_yang]
        cmd_list += ['-f', 'pyimport']
        cmd_list += [self.dir_yang + '/*.yang']
        logger.info('Building dependencies: {}'.format(' '.join(cmd_list)))
        p = Popen(' '.join(cmd_list), shell=True, stdout=PIPE, stderr=PIPE)
        stdout, stderr = p.communicate()
        logger.info('pyang return code is {}'.format(p.returncode))
        logger.debug(stderr.decode())
        parser = etree.XMLParser(remove_blank_text=True)
        self.dependencies = etree.XML(stdout.decode(), parser)
1217690
def slack_package(prgnam):
    
    binaries, cache, binary = [], "0", ""
    for pkg in find_package(prgnam, _meta_.output):
        if pkg.startswith(prgnam) and pkg[:-4].endswith("_SBo"):
            binaries.append(pkg)
    for bins in binaries:
        if LooseVersion(bins) > LooseVersion(cache):
            binary = bins
            cache = binary
    if not binary:
        Msg().build_FAILED(prgnam)
        raise SystemExit(1)
    return ["".join(_meta_.output + binary)]
775256
def install_dependencies(dependencies, verbose=False):
    """"""
    if not dependencies:
        return

    stdout = stderr = None if verbose else subprocess.DEVNULL
    with tempfile.TemporaryDirectory() as req_dir:
        req_file = Path(req_dir) / "requirements.txt"

        with open(req_file, "w") as f:
            for dependency in dependencies:
                f.write(f"{dependency}\n")

        pip = ["python3", "-m", "pip", "install", "-r", req_file]
        # Unless we are in a virtualenv, we need --user
        if sys.base_prefix == sys.prefix and not hasattr(sys, "real_prefix"):
            pip.append("--user")

        try:
            subprocess.check_call(pip, stdout=stdout, stderr=stderr)
        except subprocess.CalledProcessError:
            raise Error(_("failed to install dependencies"))

        # Reload sys.path, to find recently installed packages
        importlib.reload(site)
289968
function installDeps (deps, cliOpts, argv, cb) {
  const mods = deps.map(function (dep) {
    return function (done) {
      process.stdout.write('pkg: ' + dep + '\n')
      const infinity = '--cache-min Infinity'
      const args = [ 'npm i', cliOpts, dep, infinity ].join(' ')
      exec(args, function (err) {
        if (err) return cb(err)
      })
    }
  })

  parallel(mods, cb)
}
218061
function main (argv, conf) {
  if (!conf.repo) {
    console.error("[Github-Todos] Mandatory option 'repo' not set, where am I supposed to create issues?");
    console.error("[Github-Todos] Run 'github-todos config repo \"<GITHUB USER OR ORG>/<REPOSITORY>\"' to enable hook");
    process.exit(1);
  }

  if (argv.range) {

    // Extract target SHA
    var targetCommit = _.last(argv.range.split(".."));
    return git.run("rev-parse '" + targetCommit + "'").then(function (sha) {
      return analyzeRange(argv.range, sha.trim(), conf);
    });

  } else {

    // Receive git-hook data from stdin
    return new Promise(function (resolve, reject) {
      var analyzing = [];

      process.stdin.on("data", function (chunk) {
        var info = chunk.toString("utf8").split(/\s+/);
        var promise = onCommitRange(info[1], info[3], conf);
        analyzing.push(promise);
      });

      process.stdin.on("close", function () {
        Promise.all(analyzing).then(resolve, reject);
      });
    });

  }
}
82073
function getDependencies(pkg) {
	if (!pkg) {
		return [];
	}

	if (!isObject(pkg)) {
		$.error('Content from `package.json` must be an `Object`!');
		return [];
	}

	// get all possible dependencies
	const deps = [
		'dependencies', 'devDependencies', 'peerDependencies'
	].filter(key => pkg[key] !== void 0).map(k => Object.keys(pkg[k]));

	return flatten(deps);
}
1372586
function setup (program) {
  return new Promise((resolve, reject) => {
    if (isSetupRequired(program)) {
      // If we're setup, merge the dotfile configuration into the program
      defaults(program, dotfile.get())
      logConfiguration(program)
      resolve()
    } else {
      // We're not setup, let's do that now
      askForDependencies(program)
        .then(() => wizardSetup(program))
        .then(() => logConfiguration(program))
        .then(() => resolve())
        .catch((e) => reject(e))
    }
  })
}
393300
def consolidate_dependencies(needs_ipython, child_program,
                             requirement_files, manual_dependencies):
    """"""
    # We get the logger here because it's not defined at module level
    logger = logging.getLogger('fades')

    if needs_ipython:
        logger.debug("Adding ipython dependency because --ipython was detected")
        ipython_dep = parsing.parse_manual(['ipython'])
    else:
        ipython_dep = {}

    if child_program:
        srcfile_deps = parsing.parse_srcfile(child_program)
        logger.debug("Dependencies from source file: %s", srcfile_deps)
        docstring_deps = parsing.parse_docstring(child_program)
        logger.debug("Dependencies from docstrings: %s", docstring_deps)
    else:
        srcfile_deps = {}
        docstring_deps = {}

    all_dependencies = [ipython_dep, srcfile_deps, docstring_deps]

    if requirement_files is not None:
        for rf_path in requirement_files:
            rf_deps = parsing.parse_reqfile(rf_path)
            logger.debug('Dependencies from requirements file %r: %s', rf_path, rf_deps)
            all_dependencies.append(rf_deps)

    manual_deps = parsing.parse_manual(manual_dependencies)
    logger.debug("Dependencies from parameters: %s", manual_deps)
    all_dependencies.append(manual_deps)

    # Merge dependencies
    indicated_deps = {}
    for dep in all_dependencies:
        for repo, info in dep.items():
            indicated_deps.setdefault(repo, set()).update(info)

    return indicated_deps
643726
def get_from_requirements(self,
                              r,                      # type: Dict[Text, Text]
                              pull_image,             # type: bool
                              force_pull=False,       # type: bool
                              tmp_outdir_prefix=None  # type: Text
                             ):
        # type: (...) -> Optional[Text]
        

        if not bool(spawn.find_executable('singularity')):
            raise WorkflowException('singularity executable is not available')

        if not self.get_image(r, pull_image, force_pull):
            raise WorkflowException(u"Container image {} not "
                                    "found".format(r["dockerImageId"]))

        return os.path.abspath(r["dockerImageId"])
568882
function wrap(err, js) {
		if (err) { return next(err); }

		var deps = exports.dependencies(id, js), params = [], undef = '';

		// make sure require, exports, and module are properly passed into the factory
		if (/\brequire\b/.test(js)) { params.push('require'); }
		if (/\bexports\b/.test(js)) { params.push('exports'); }
		if (/\bmodule\b/.test(js)) { params.push('module'); }

		// make sure code follows the `exports` path instead of `define` path once wrapped
		if (/\bdefine\.amd\b/.test(js)) { undef = 'var define;'; }

		if (deps.length) {
			deps = ',' + JSON.stringify(params.concat(deps));
		} else if (params.length) {
			params = [ 'require', 'exports', 'module' ];
		}

		js = 'define(' + JSON.stringify(id) + deps + ',function(' + params + ')' +
				'{' + js + '\n' + undef + '}' + // rely on hoisting for define
			');\n';
		next(null, js);
	}
690306
function fetchUnmetDependencies() {
        var runAgain = false;
        for (var id in dependencyMap) {
            _.forEach(dependencyMap[id], function (depId) {
                if (!dependencyMap[depId] && !injectedMap[depId]) {
                    try {
                        loadExternalModule(id, depId);
                    } catch (err) {
                        throw new Error('Error loading dependency ' + depId + ' for ' + id + ': ' + err.message);
                    }

                    runAgain = true;
                }
            });
        }

        if (runAgain) { //continue until all we don't have any more unmet dependencies
            fetchUnmetDependencies();
        }
    }
875894
function parseDependencies (source, root) {
  var dependencies = []
  var match = null
  while ((match = configCommentRegex.exec(source))) {
    var option = match[1]
    var value = match[2]
    switch (option) {
      case 'dependency':
      case 'dependencies':
        pushAll(dependencies, parseDependenciesList(root, value))
        break
      default:
        console.warn(
          'WARNING: Unrecognized configuration command ' +
          '"rails-erb-loader-' + option + '". Comment ignored.'
        )
    }
  }
  return dependencies
}
650548
function dependencies(dependencyObject) {
    'use strict';

    function extractSpecificPath(depPath, loadType) {
        if (typeof depPath === 'object') {
            return depPath[loadType];
        }

        return depPath;
    }

    var depNames, depPaths;

    depNames = Object.keys(dependencyObject);
    depPaths = depNames.map(function (depName) {return dependencyObject[depName]; });

    function init(root, factory) {

        if (typeof module === 'object' && module.exports) {
            // Node/CommonJS
            console.log("NODE MODE");
            factory.apply(root, depPaths.map(function (depPath) {return require(extractSpecificPath(depPath, 'node')); }));
        } else if (typeof define === 'function' && define.amd) {
            // AMD
            console.log("AMD MODE");
            define(depPaths.map(function (depPath) { return extractSpecificPath(depPath, 'browser'); }), factory);
        } else {
            // Browser globals
            console.log("GLOBALS MODE");
            factory.apply(root, depNames.map(function (depName) {return root[depName]; }));
        }
    }

    return { init: init };
}