Generate the dependency tree object
6642
def __generate_dependency_tree(self):
        
        dependency_dict = {}
        for s in self.manifest.sections():
            if s != "config":
                if self.manifest.has_option(s, 'depends'):
                    dependency_list = [d.strip() for d in re.split('\n|,', self.manifest.get(s, 'depends'))]
                    dependency_dict[s] = dependency_list
                else:
                    dependency_dict[s] = []
        try:
            return DependencyTree(dependency_dict)
        except DependencyTreeException:
            dte = sys.exc_info()[1]
            raise ManifestException("Dependency tree for manifest is invalid! %s" % str(dte))
1330109
function getAllDependencies() {
    var folder = './' + getBowerFolder();
    var bowerDependencies = fs.readdirSync(folder, {encoding: 'utf8'});

    var dependencyInfos = [];
    bowerDependencies.forEach(function(dirname) {
        var filepath = nodePath.resolve(cwd, folder, dirname, '.bower.json');
        if (fs.existsSync(filepath)) {
            var dependencyInfo = getDependency(filepath);
            dependencyInfo.dirName = dirname;
            dependencyInfos.push(dependencyInfo);
        }
    });

    return dependencyInfos;
}
685473
def generate_from_yaml(pseudo_ast, language):
    '''
    

    '''
    return pseudo.generate(pseudo.loader.as_tree(pseudo_ast), language)
380426
def _get_deps(self, tree, include_punct, representation, universal):
        """"""
        if universal:
            converter = self.universal_converter

            if self.universal_converter == self.converter:
                import warnings
                warnings.warn("This jar doesn't support universal "
                              "dependencies, falling back to Stanford "
                              "Dependencies. To suppress this message, "
                              "call with universal=False")
        else:
            converter = self.converter

        if include_punct:
            egs = converter(tree, self.acceptFilter)
        else:
            egs = converter(tree)

        if representation == 'basic':
            deps = egs.typedDependencies()
        elif representation == 'collapsed':
            deps = egs.typedDependenciesCollapsed(True)
        elif representation == 'CCprocessed':
            deps = egs.typedDependenciesCCprocessed(True)
        else:
            # _raise_on_bad_representation should ensure that this
            # assertion doesn't fail
            assert representation == 'collapsedTree'
            deps = egs.typedDependenciesCollapsedTree()
        return self._listify(deps)
631860
def generate_tree(root, paths, mock_os):
    
    tree = []
    dentries = mock_os.listdir(root)

    for d in dentries:
        full_path = mock_os.path.join(root, d)
        node = {
            'text': d,
            'href': '#%s' % d,
            'state': {
                'expanded': True
            }
        }

        if mock_os.path.isdir(full_path):
            node['nodes'] = generate_tree(full_path, paths, mock_os)
        else:
            node['icon'] = 'fa fa-file-code-o'
            node['href'] = '#'
            node['color'] = '#0088ce'
            node['dataAttr'] = {
                'toggle': 'modal',
                'target': '#file_modal',
                'load': paths[full_path] + '/'
            }
        tree.append(node)
    return tree
784291
def build_tree(self):
        """"""
        for m in listdir(self.path):
            abs_m = join(self.path, m)
            if isfile(abs_m) and m.endswith('.py'):
                name = splitext(m)[0]
                if not self.limit_to or name in self.limit_to:
                    self.modules.append(Module(name, abs_m, self.dsm, self))
            elif isdir(abs_m):
                if isfile(join(abs_m, '__init__.py')) or not self.enforce_init:
                    heads, new_limit_to = self.split_limits_heads()
                    if not heads or m in heads:
                        self.packages.append(
                            Package(m, abs_m, self.dsm, self, new_limit_to,
                                    build_tree=True,
                                    build_dependencies=False,
                                    enforce_init=self.enforce_init))
1265140
function _buildDependencyTreeOf(node) {
		var requireStatements = getRequireStatements(getCode(node.path))
		if (requireStatements.length == 0) {
			return leaves.push(node)
		}
		each(requireStatements, function(requireStatement) {
			var childNode = []
			childNode.path = resolve.requireStatement(requireStatement, node.path)
			childNode.parent = node
			node.push(childNode)
			_buildDependencyTreeOf(childNode)
		})
		node.waitingForNumChildren = node.length
	}
651742
def leaves(self, nodes=None, unique=True):
        
        if nodes is None:
            return super(DependencyTree, self).leaves(unique=unique)

        res = list()
        for child_id in nodes:
            for sub_child in self._all_nodes[child_id].leaves(unique=unique):
                if not unique or sub_child not in res:
                    res.append(sub_child)
        return res
1240665
function buildDependencyTreeFromSources(filenames, sourcesObject) {
  const orgnizedFlat = {};

  // build tree object
  filenames.forEach(sourceFileName => {
    orgnizedFlat[sourceFileName] = {
      path: sourceFileName,
      source: sourcesObject[sourceFileName],
      dependencies: buildDependencyTreeFromSources(allImportPaths(sourcesObject[sourceFileName]), sourcesObject),
    };
  });

  // return organized object
  return orgnizedFlat;
}
455246
def to_tree(instance, *children):
    

    # Yield representation of self
    yield unicode(instance)

    # Iterate trough each instance child collection
    for i, child in enumerate(children):
        lines = 0

        yield "|"
        yield "+---" + unicode(child)

        if i != len(children) - 1:
            a = "|"
        else:
            a = " "

        # Iterate trough all values of collection of child
        for j, item in enumerate(child.itervalues()):
            if j != len(child) - 1:
                b = "|"
            else:
                b = " "

            if j == 0:
                yield a + "   |"

            # Append prefix to each line
            for k, line in enumerate(item.to_tree()):
                lines += 1

                if k == 0:
                    yield a + "   +---" + line
                else:
                    yield a + "   " + b + "   " + line

        # Add extra space if required
        if len(children) > 1 and i == len(children) - 1 and lines > 1:
            yield a
756896
def _pipdeptree(python_bin, package_name: str = None, warn: bool = False) -> typing.Optional[dict]:
    """"""
    cmd = "{} -m pipdeptree --json".format(python_bin)

    _LOGGER.debug("Obtaining pip dependency tree using: %r", cmd)
    output = run_command(cmd, is_json=True).stdout

    if not package_name:
        return output

    for entry in output:
        # In some versions pipdeptree does not work with --packages flag, do the logic on out own.
        # TODO: we should probably do difference of reference this output and original environment
        if entry["package"]["key"].lower() == package_name.lower():
            return entry

    # The given package was not found.
    if warn:
        _LOGGER.warning("Package %r was not found in pipdeptree output %r", package_name, output)
    return None
499418
function buildTree(index, api) {
  const modules = {};

  const dependency = (module, parent) => {
    const filepath = api.resolve(module, parent);
    if (modules[filepath] != null) {
      return modules[filepath];
    }

    const src = api.getFileContents(module, parent, "utf8");
    const basic = api.parser(src);
    const [nestedImports, hasMemory] = parseImports(basic, api);

    const deps = {};

    Object.keys(nestedImports).forEach(mod => {
      if (mod.indexOf(".") === 0) {
        const dep = dependency(mod, filepath);
        deps[mod] = dep;
      }
    });

    const patched = inferImportTypes(basic, deps, api);
    const ast = api.semantics(patched);

    api.validate(ast, {
      lines: src.split("\n"),
      filename: module.split("/").pop(),
    });

    const result = {
      ast,
      deps,
      filepath,
      hasMemory,
    };
    modules[filepath] = result;

    return result;
  };

  const root = dependency(index, null);

  return {
    root,
    modules,
  };
}
988808
def _register_dependencies(self):
        
        for tree_name, context_entry in context.timetable_context.items():
            tree = self.trees[tree_name]
            assert isinstance(tree, MultiLevelTree)
            for dependent_on in context_entry.dependent_on:
                dependent_on_tree = self.trees[dependent_on]
                assert isinstance(dependent_on_tree, MultiLevelTree)
                tree.register_dependent_on(dependent_on_tree)
805543
function gatherDependencies (root, options, callback) {
  if (typeof options === 'function') {
    callback = options
    options = {}
  }

  options = extend(defaultOptions, options)

  /**
   * read-package-tree callback
   * @param  {error}  err  read-package-tree error
   * @param  {object} data read-package-tree blob (contains cyclical refrences)
   */
  var rpt_cb = function rpt_cb (err, data) {
    if (err) return logger.error(err)
    if (data.error) return logger.error(data.error)
    if (!data.package) {
      logger.warn('`data.package` not defined. Initializing placeholder.')
      data.package = {}
    }

    var dependencyReport = {}

    if (!data.package || !data.package.name) logger.warn('`data.package.name` missing')
    dependencyReport.name = data.package.name

    if (!data.package || !data.package.version) logger.warn('`data.package.version` missing')
    dependencyReport.version = data.package.version

    if (options.meta) {
      dependencyReport.meta = {
        nodeVersions: process.versions,
        date: Date.now()
      }
    }

    buildDependencyReport(dependencyReport, data, options, 0)

    // Finally, return gatherDependencies callback
    callback(null, dependencyReport)
  }

  fs.stat(path.resolve(root, 'node_modules'), function (err, stats) {
    if (err && err.code === 'ENOENT') {
      fs.stat(path.resolve(root, 'package.json'), function (er, sta) {
        if (er && er.code === 'ENOENT') {
          return callback(new Error('No module found'))
        }
        return callback(new Error('Need to run \`npm install\` first.'))
      })
    }
  })

  readPackageTree(root, options.filter, rpt_cb)
}
1147510
def generate(ast_tree: ast.Tree, model_name: str, options: Dict[str, bool]=None) -> Model:
    
    if options is None:
        options = {}
    component_ref = ast.ComponentRef.from_string(model_name)
    ast_walker = GeneratorWalker()
    flat_tree = flatten(ast_tree, component_ref)
    component_ref_tuple = component_ref.to_tuple()
    casadi_gen = Generator(flat_tree, component_ref_tuple[-1], options)
    ast_walker.walk(casadi_gen, flat_tree)
    return casadi_gen.model
404506
def to_tree(self):
        
        tree = TreeLibTree()
        for node in self:
            tree.create_node(node, node.node_id, parent=node.parent)
        return tree
55834
def compute_dependency_specs(cls, kwargs=None, payload=None):
    """"""
    for spec in super(ImportRemoteSourcesMixin, cls).compute_dependency_specs(kwargs, payload):
      yield spec

    imported_target_specs = cls.imported_target_specs(kwargs=kwargs, payload=payload)
    for spec in imported_target_specs:
      yield spec