Performs enrichment.
510816
protected function performEnrichment()
    {
        $strategies = $this->info->export->strategies;

        foreach ($strategies as $key => $strategyData) {

            if (empty($strategyData['strategy'])) {
                $strategies[ $key ]['strategy'] = $key;
            }
        }

        $this->info->export->strategies = $strategies;
    }
1027177
def run(self):
        """"""
        kwargs = {'query': self.get_data()}
        if self.data_type == "ip":
            kwargs.update({'query_type': 'ip'})
        elif self.data_type == "network":
            kwargs.update({'query_type': 'network'})
        elif self.data_type == 'autonomous-system':
            kwargs.update({'query_type': 'asn'})
        elif self.data_type == 'port':
            kwargs.update({'query_type': 'port'})
        else:
            self.notSupported()
            return False

        if self.service == 'observations':
            response = self.bs.get_observations(**kwargs)
            self.report(response)
        elif self.service == 'enrichment':
            response = self.bs.enrich(**kwargs)
            self.report(response)
        else:
            self.report({'error': 'Invalid service defined.'})
682309
protected void performSubtasks(TaskRequest req, TaskResponse res, List<Task> tasks) {
        // Assertions...
        if (req == null) {
            String msg = "Argument 'req' cannot be null.";
            throw new IllegalArgumentException(msg);
        }
        if (res == null) {
            String msg = "Argument 'res' cannot be null.";
            throw new IllegalArgumentException(msg);
        }
        if (tasks == null) {
            String msg = "Child tasks have not been initialized.  Subclasses "
                            + "of AbstractContainerTask must call super.init() "
                            + "within their own init() method.";
            throw new IllegalStateException(msg);
        }
        
        // Invoke each of our children...
        for (Task k : tasks) {
            k.perform(req, res);
        }
	}
256090
public void doInvocationCollaboratorsPreInvoke(IInvocationCollaborator[] webAppInvocationCollaborators, WebComponentMetaData cmd,
                                                 ServletRequest request, ServletResponse response)
  {
    if (webAppInvCollabs != null && !webAppInvCollabs.isEmpty())
    {
      for (WebAppInvocationCollaborator inv : webAppInvCollabs)
      {
        inv.preInvoke(cmd,request,response);
      }
    }
  }
501013
protected function enrichCustomData()
    {
        // Check filled columns and enrich them as required
        // Note that these can be either attributes or relations

        $columns = [];

        foreach ($this->info->list->columns as $key => $column) {

            try {
                $this->enrichColumn($key, $column, $columns);

            } catch (\Exception $e) {

                // Wrap and decorate exceptions so it is easier to track the problem source
                throw (new ModelInformationEnrichmentException(
                    "Issue with list column '{$key}' (list.columns.{$key}): \n{$e->getMessage()}",
                    (int) $e->getCode(),
                    $e
                ))
                    ->setSection('list.columns')
                    ->setKey($key);
            }
        }

        $this->info->list->columns = $columns;
    }
398473
private void perform(int operation, int position, long bs, int length) {
		checkBitsLength(length);
		position = adjPosition(position);
		checkMutable();
		performAdj(operation, position, bs, length);
	}
1285083
def enrich_value(value)
      return nil unless value.is_a? DPLA::MAP::Controlled::DCMIType
      return nil unless TERMS.include? value.rdf_subject
      value
    end
1236057
protected void enrichWithCM(Set<BioPAXElement> seed, Set<BioPAXElement> all)
	{
		Set addition = access(type == Type.TO_GENERAL ? complexAcc : memberAcc, seed, all);

		if (blacklist != null) addition = blacklist.getNonUbiqueObjects(addition);

		if (!addition.isEmpty())
		{
			all.addAll(addition);
			enrichWithGenerics(addition, all);
		}
	}
551741
private static void performWork(Span parent) {
    SpanBuilder spanBuilder =
        tracer
            .spanBuilderWithExplicitParent("internal_work", parent)
            .setRecordEvents(true)
            .setSampler(Samplers.alwaysSample());
    try (Scope scope = spanBuilder.startScopedSpan()) {
      Span span = tracer.getCurrentSpan();
      span.putAttribute("my_attribute", AttributeValue.stringAttributeValue("blue"));
      span.addAnnotation("Performing work.");
      sleepFor(20); // Working hard here.
      span.addAnnotation("Done work.");
    }
  }
286870
protected void enrichWithGenerics(Set<BioPAXElement> seed, Set<BioPAXElement> all)
	{
		Set addition;
		if (type == Type.TO_GENERAL) addition = access(upperGenAcc, seed, all);
		else addition = access(lowerGenAcc, seed, all);
		
		all.addAll(addition);
		seed.addAll(addition);

		enrichWithCM(seed, all);
	}
1238652
public function execute() {
        global $CFG, $DB;

        if ($CFG->enablecompletion) {
            require_once($CFG->libdir . "/completionlib.php");

            if (debugging()) {
                mtrace('Marking users as started');
            }

            // This causes it to default to everyone (if there is no student role).
            $sqlroles = '';
            if (!empty($CFG->gradebookroles)) {
                $sqlroles = ' AND ra.roleid IN (' . $CFG->gradebookroles.')';
            }

            // It's purpose is to locate all the active participants of a course with course completion enabled.
            // We also only want the users with no course_completions record as this functions job is to create
            // the missing ones :)
            // We want to record the user's enrolment start time for the course. This gets tricky because there can be
            // multiple enrolment plugins active in a course, hence the possibility of multiple records for each
            // couse/user in the results.
            $sql = "SELECT c.id AS course, u.id AS userid, crc.id AS completionid, ue.timestart AS timeenrolled,
                           ue.timecreated
                      FROM {user} u
                INNER JOIN {user_enrolments} ue ON ue.userid = u.id
                INNER JOIN {enrol} e ON e.id = ue.enrolid
                INNER JOIN {course} c ON c.id = e.courseid
                INNER JOIN {role_assignments} ra ON ra.userid = u.id
                 LEFT JOIN {course_completions} crc ON crc.course = c.id AND crc.userid = u.id
                     WHERE c.enablecompletion = 1
                       AND crc.timeenrolled IS NULL
                       AND ue.status = 0
                       AND e.status = 0
                       AND u.deleted = 0
                       AND ue.timestart < ?
                       AND (ue.timeend > ? OR ue.timeend = 0)
                       $sqlroles
                  ORDER BY course, userid";
            $now = time();
            $rs = $DB->get_recordset_sql($sql, [$now, $now, $now, $now]);

            // Check if result is empty.
            if (!$rs->valid()) {
                // Not going to iterate (but exit), close rs.
                $rs->close();
                return;
            }

            // We are essentially doing a group by in the code here (as I can't find a decent way of doing it
            // in the sql). Since there can be multiple enrolment plugins for each course, we can have multiple rows
            // for each participant in the query result. This isn't really a problem until you combine it with the fact
            // that the enrolment plugins can save the enrol start time in either timestart or timeenrolled.
            // The purpose of the loop is to find the earliest enrolment start time for each participant in each course.
            $prev = null;
            while ($rs->valid() || $prev) {
                $current = $rs->current();
                if (!isset($current->course)) {
                    $current = false;
                } else {
                    // Not all enrol plugins fill out timestart correctly, so use whichever is non-zero.
                    $current->timeenrolled = max($current->timecreated, $current->timeenrolled);
                }

                // If we are at the last record, or we aren't at the first and the record is for a diff user/course.
                if ($prev && (!$rs->valid() ||
                        ($current->course != $prev->course || $current->userid != $prev->userid))) {

                    $completion = new \completion_completion();
                    $completion->userid = $prev->userid;
                    $completion->course = $prev->course;
                    $completion->timeenrolled = (string) $prev->timeenrolled;
                    $completion->timestarted = 0;
                    $completion->reaggregate = time();
                    if ($prev->completionid) {
                        $completion->id = $prev->completionid;
                    }
                    $completion->mark_enrolled();

                    if (debugging()) {
                        mtrace('Marked started user ' . $prev->userid . ' in course ' . $prev->course);
                    }
                } else if ($prev && $current) {
                    // Else, if this record is for the same user/course use oldest timeenrolled.
                    $current->timeenrolled = min($current->timeenrolled, $prev->timeenrolled);
                }
                // Move current record to previous.
                $prev = $current;
                // Move to next record.
                $rs->next();
            }
            $rs->close();
        }
    }
1237419
def fold_enrichment(self):
        
        expected = self.K * (self.n/float(self.N))
        return self.k / expected
1187782
function gather(cbk) {
      ask(questions[0], function(user) {
        state.user = user;
        ask(questions[1], function(pass){
          state.pass = pass;
          cbk(state.user, state.pass);
        }, state.pass);
      }, state.user);
    }
210966
function process( $tpl, &$text, $nspace, $current_nspace )
    {
        foreach( array_keys( $this->Children ) as $key )
        {
            $this->Children[$key]->process( $tpl, $text, $nspace, $current_nspace );
        }
    }
821371
public function fulfill(): void
    {
        $this->state = Promise::FULFILLED;
        $response = $this->responseBuilder->getResponse();
        try {
            $response->getBody()->seek(0);
        } catch (\RuntimeException $e) {
            $exception = new Exception\TransferException($e->getMessage(), $e->getCode(), $e);
            $this->reject($exception);

            return;
        }

        while (count($this->onFulfilled) > 0) {
            $callback = array_shift($this->onFulfilled);
            $response = call_user_func($callback, $response);
        }

        if ($response instanceof ResponseInterface) {
            $this->responseBuilder->setResponse($response);
        }
    }
1190120
public void raActive() {
		// init client
		client = new XcapClientImpl();		
		activities = new ConcurrentHashMap<XCAPResourceAdaptorActivityHandle, AsyncActivityImpl>();
		executorService = Executors.newCachedThreadPool();
		sbbInterface.setActive(true);
	}
1032010
protected function _execute()
    {
        if (!$this->enabled() && !$this->focused()) {
            return;
        }
        foreach ($this->_children as $child) {
            if ($this->suite()->failfast()) {
                break;
            }
            $this->_passed = $child->process() && $this->_passed;
        }
    }