Build gadgets recursively.
19296
def _build_from(self, address, root, base_address, depth=2):
        
        if depth == 0:
            return

        end_addr = address

        for step in range(1, self._max_bytes + 1):
            start_addr = address - step

            if start_addr < 0 or start_addr < base_address:
                break

            raw_bytes = self._mem[start_addr:end_addr]

            # TODO: Improve this code.
            if self._architecture == ARCH_ARM:
                try:
                    asm_instr = self._disasm.disassemble(raw_bytes, start_addr, architecture_mode=self._architecture_mode)
                except InvalidDisassemblerData:
                    continue
            else:
                try:
                    asm_instr = self._disasm.disassemble(raw_bytes, start_addr)
                except:
                    asm_instr = None

            if not asm_instr or asm_instr.size != step:
                continue

            try:
                ir_instrs = self._ir_trans.translate(asm_instr)
            except:
                continue

            if self._is_valid_ins(ir_instrs):
                asm_instr.ir_instrs = ir_instrs

                child = GadgetTreeNode(asm_instr)

                root.add_child(child)

                self._build_from(address - step, child, base_address, depth - 1)
417132
def build(self):
        """"""
        if self.is_built():  # pragma: no cover
            return
        with _wait_signal(self.loadFinished, 20):
            self.rebuild()
        self._built = True
323095
function build(hasSeparateGlobals) {
                    var root = new output.NavigationItem('Index', 'index.html');
                    if (entryPoint == project) {
                        var globals = new output.NavigationItem('Globals', hasSeparateGlobals ? 'globals.html' : 'index.html', root);
                        globals.isGlobals = true;
                    }
                    var modules = [];
                    project.getReflectionsByKind(td.models.ReflectionKind.SomeModule).forEach(function (someModule) {
                        var target = someModule.parent;
                        var inScope = (someModule == entryPoint);
                        while (target) {
                            if (target.kindOf(td.models.ReflectionKind.ExternalModule))
                                return;
                            if (entryPoint == target)
                                inScope = true;
                            target = target.parent;
                        }
                        if (inScope) {
                            modules.push(someModule);
                        }
                    });
                    if (modules.length < 10) {
                        buildGroups(modules, root);
                    }
                    else {
                        buildGroups(entryPoint.getChildrenByKind(td.models.ReflectionKind.SomeModule), root, buildChildren);
                    }
                    return root;
                }
839673
def build_tree(self):
        """"""
        for spec in self.specs:
            if spec.ismodule:
                self.modules.append(Module(spec.name, spec.path, dsm=self))
            else:
                self.packages.append(Package(
                    spec.name, spec.path,
                    dsm=self, limit_to=spec.limit_to,
                    build_tree=True,
                    build_dependencies=False,
                    enforce_init=self.enforce_init))
479624
def _get_recursive_state(widget, store=None, drop_defaults=False):
    """"""
    if store is None:
        store = dict()
    state = widget._get_embed_state(drop_defaults=drop_defaults)
    store[widget.model_id] = state

    # Loop over all values included in state (i.e. don't consider excluded values):
    for ref in _find_widget_refs_by_state(widget, state['state']):
        if ref.model_id not in store:
            _get_recursive_state(ref, store, drop_defaults=drop_defaults)
    return store
449464
function build (args, cb) {
  readAll(args, function (er, args) {
    if (er) return cb(er)
    // do all preinstalls, then check deps, then install all, then finish up.
    chain
      ( [asyncMap, args, function (a, cb) {
          return lifecycle(a, "preinstall", cb)
        }]
      , [asyncMap, args, function (a, cb) {
          return resolveDependencies(a, cb)
        }]
      , [ asyncMap
        , args
        , function (pkg, cb) {
            linkModules(pkg, path.join(npm.root, pkg.name+"@"+pkg.version), cb)
          }
        , linkBins
        , linkMans
        ]
      // must rebuild bundles serially, because it messes with configs.
      , [chain].concat(args.map(function (a) { return [rebuildBundle, a] }))
      , [linkDependencies, args]
      , [finishBuild, args]
      , cb
      )
  })
}
872305
def build(self, targets: Iterable[str]) -> Iterable[str]:
        
        return generate_source_directories(
            targets, build=self._build, prompt=self._prompt
        )
130070
public function build()
    {
        $this->_temperature();
        $this->_voltage();
        $this->_fans();
        $this->_power();
        $this->_current();
        $this->_other();
    }
1004213
def push_all(collector, **kwargs):
    """"""
    configuration = collector.configuration
    configuration["harpoon"].do_push = True
    configuration["harpoon"].only_pushable = True
    make_all(collector, **kwargs)
28695
def build(self):
        """"""
        from ambry.orm.config import BuildConfigGroupAccessor

        # It is a lightweight object, so no need to cache
        return BuildConfigGroupAccessor(self.dataset, 'buildstate', self._session)
1035793
def descendants(self):
        """"""
        for i in self.current_item.items:
            self.move_to(i)
            if i.type == TYPE_COLLECTION:
                for c in self.children:
                    yield c
            else:
                yield i
            self.move_up()
1192774
def _recursive_upsert(context, params, data):
    """"""
    children = params.get("children", {})
    nested_calls = []
    for child_params in children:
        key = child_params.get("key")
        child_data_list = ensure_list(data.pop(key))
        if isinstance(child_data_list, dict):
            child_data_list = [child_data_list]
        if not (isinstance(child_data_list, list) and
                all(isinstance(i, dict) for i in child_data_list)):
            context.log.warn(
                "Expecting a dict or a lost of dicts as children for key", key
            )
            continue
        if child_data_list:
            table_suffix = child_params.get("table_suffix", key)
            child_params["table"] = params.get("table") + "_" + table_suffix
            # copy some properties over from parent to child
            inherit = child_params.get("inherit", {})
            for child_data in child_data_list:
                for dest, src in inherit.items():
                    child_data[dest] = data.get(src)
                nested_calls.append((child_params, child_data))
    # Insert or update data
    _upsert(context, params, data)
    for child_params, child_data in nested_calls:
        _recursive_upsert(context, child_params, child_data)
328633
public function build()
    {
        $files = $this->iterator->getFiles();
        $generators = $this->generatorRegistry->generators();

        foreach ($files as $file) {
            foreach ($generators as $generator) {
                $generator->parseFile($file);
            }
        }

        foreach ($generators as $generator) {
            $generator->generate();
        }
    }
896445
function build(mode, system, cdef, out, cb) {
    logger.info('building');
    out.stdout('--> building');

    builder.build(mode, system, cdef, out, function(err, specific) {
      if (err) { logger.error(err); return cb(err); }
      cb(err);
    });
  }
269344
def recurse(self, fn, *args):
        """"""
        fn(self, *args)
        for i in self.items:
            if isinstance(i, Hypercat):
                self.recurse(i, *args)
57434
def build_items(self):
        
        """
        protocols = ['tcp', 'tcp6']
        for protocol in protocols:
            procfile = open('/proc/net/{0}'.format(protocol), 'r')
            stats = self.count(procfile)

            for key, value in stats.items():
                item = NetstatItem(key=key,
                                   value=value,
                                   host=self.hostname
                                   )

                self.queue.put(item, block=False)
336056
def build(self):
        """"""

        # If there's no output tube, it means that this stage
        # is at the end of a fork (hasn't been linked to any stage downstream).
        # Therefore, create one output tube.
        if not self._output_tubes:
            self._output_tubes.append(self._worker_class.getTubeClass()())

        self._worker_class.assemble(
            self._worker_args,
            self._input_tube,
            self._output_tubes,
            self._size,
            self._disable_result,
            self._do_stop_task,
            )

        # Build all downstream stages.
        for stage in self._next_stages:
            stage.build()