Run and return the results of the AttributeInitialization plugin.
18742
def analyze(self, scratch, **kwargs):
        """"""
        changes = dict((x.name, self.sprite_changes(x)) for x in
                       scratch.sprites)
        changes['stage'] = {
            'background': self.attribute_state(scratch.stage.scripts,
                                               'costume')}
        # self.output_results(changes)
        return {'initialized': changes}
396027
def _check_initialized(self):
    
    baddies = self._find_uninitialized()
    if baddies:
      raise datastore_errors.BadValueError(
          'Entity has uninitialized properties: %s' % ', '.join(baddies))
69921
def run():
    
    plugin_list = load_plugins()

    module = sys.modules['__main__']
    plugin_list.insert(0, ObjectSupplier(module))

    return run_with_plugins(plugin_list)
844519
public void init() {
      
      // before running init check to see if attributes has been injected/set
      if (wurflDirPath == null)
         throw new IllegalStateException ("wurflDirPath not properly set");
      
      // look for wurfl file and patches
      File wurflDir = new File(wurflDirPath);
      // if file does not exists, it might be relative to the servlet
      if (!wurflDir.exists() && servletContext != null) 
         wurflDir = new File(servletContext.getRealPath(wurflDirPath));
      // check again
      if (!wurflDir.exists())
         throw new IllegalArgumentException("wurflDirPath " + wurflDir.getAbsolutePath() + " does not exists");
      
      if (!wurflDir.isDirectory()) 
         throw new IllegalArgumentException("wurflDirPath " + wurflDir.getAbsolutePath() + " is not a directory");
      
      ArrayList<File> patchFiles = new ArrayList<File> ();

      logger.info("search for wurfl file and patches on: " + wurflDir.getAbsolutePath());
      for (String filePath:wurflDir.list()) {
         File file = new File(wurflDir.getAbsoluteFile() + "/" + filePath);
         if (WURFL_FILENAME.equals(file.getName())) {
            wurflFile = file;
            logger.debug("wurfl file: " + wurflFile.getAbsolutePath());
         } else if (file.getName().endsWith(".xml")) {
            patchFiles.add(file);
            logger.debug("wurfl patch file: " + file.getAbsolutePath());
         }
                  
      }
      this.wurflPatchFiles = patchFiles.toArray(new File[] {});

      // initialize wurfl holder
      this.wurflHolder = new CustomWURFLHolder(this.wurflFile, this.wurflPatchFiles);
      
      startWatchingFiles();
      this.statusInfo = getNewStatusInfo("");
   }
776764
def InitializeContext(self, args):
    """"""
    if args is None:
      args = rdf_flow_runner.FlowRunnerArgs()

    output_plugins_states = []
    for plugin_descriptor in args.output_plugins:
      if not args.client_id:
        self.Log(
            "Not initializing output plugin %s as flow does not run on "
            "the client.", plugin_descriptor.plugin_name)
        continue

      plugin_class = plugin_descriptor.GetPluginClass()
      try:
        plugin, plugin_state = plugin_class.CreatePluginAndDefaultState(
            source_urn=self.flow_obj.output_urn,
            args=plugin_descriptor.plugin_args,
            token=self.token)
        # TODO(amoser): Those do not need to be inside the state, they
        # could be part of the plugin descriptor.
        plugin_state["logs"] = []
        plugin_state["errors"] = []

        output_plugins_states.append(
            rdf_flow_runner.OutputPluginState(
                plugin_state=plugin_state, plugin_descriptor=plugin_descriptor))
      except Exception as e:  # pylint: disable=broad-except
        logging.exception("Plugin %s failed to initialize (%s), ignoring it.",
                          plugin, e)

    parent_creator = None
    if self.parent_runner:
      parent_creator = self.parent_runner.context.creator

    context = rdf_flow_runner.FlowContext(
        create_time=rdfvalue.RDFDatetime.Now(),
        creator=parent_creator or self.token.username,
        current_state="Start",
        output_plugins_states=output_plugins_states,
        state=rdf_flow_runner.FlowContext.State.RUNNING,
    )

    return context
333823
def _init():
    """"""
    import importlib
    import os
    import re

    filenames = os.listdir(os.path.dirname(__file__))

    module_names = set()
    for filename in filenames:
        match = re.match(r'^(?P<name>[A-Z_a-z]\w*)\.py[co]?$', filename)
        if match:
            module_names.add(match.group('name'))

    for module_name in module_names:
        try:
            module = importlib.import_module('.' + module_name, __name__)
        except ImportError:
            continue

        for name, member in module.__dict__.items():
            if not isinstance(member, type):
                # skip non-new-style classes
                continue
            if not issubclass(member, Engine):
                # skip non-subclasses of Engine
                continue
            if member is Engine:
                # skip "abstract" class Engine
                continue

            try:
                handle = member.handle
            except AttributeError:
                continue

            engines[handle] = member
1267970
def igetattr(self, attrname, context=None):
        
        if attrname == "start":
            yield self._wrap_attribute(self.lower)
        elif attrname == "stop":
            yield self._wrap_attribute(self.upper)
        elif attrname == "step":
            yield self._wrap_attribute(self.step)
        else:
            yield from self.getattr(attrname, context=context)
617120
def _initialize(self, con):
        """"""
        if self.initialized:
            return

        SQLite3Database()._initialize(con)  # ASE db initialization

        cur = con.execute(
            'SELECT COUNT(*) FROM sqlite_master WHERE name="reaction"')

        if cur.fetchone()[0] == 0:  # no reaction table
            for init_command in init_commands:
                con.execute(init_command)  # Create tables
            con.commit()

        self.initialized = True
1076973
protected function initAttributes() {
		$vars = get_object_vars($this->_xml->attributes());
			
		$this->_attributes = empty($vars) ? [] : $vars['@attributes'];
	}
1356542
def output(output_id, name, value_class=NumberValue):
        """"""
        def _init():
            return value_class(
                name,
                input_id=output_id,
                is_input=False,
                index=-1
            )
        def _decorator(cls):
            setattr(cls, output_id, _init())
            return cls
        return _decorator
989917
function initializeWithEval() {
  var dbTest = new loki('perfInsertWithEval');

  var start, end, totalTime;
  var totalTimes = [];
  var totalMS = 0.0;

  var coll = dbTest.addCollection('samplecoll',
    {
      indices: ['customId'],
      asyncListeners: false,
      disableChangesApi: true,
      transactional: false,
      clone: false
    }
  );

  var dv = coll.addDynamicView('test');
  dv.applyFind({'customId': {'$lt': arraySize/4 }});

  for (var idx=0; idx < arraySize; idx++) {
    var v1 = genRandomVal();
    var v2 = genRandomVal();

    start = performance.now();
    coll.insert({
      customId: idx,
      val: v1,
      val2: v2,
      val3: "more data 1234567890"
    });
    end = performance.now() - start;
    totalTimes.push([0, end * 1e6]);
  }

  for(idx=0; idx < totalTimes.length; idx++) {
    totalMS += totalTimes[idx][0] * 1e3 + totalTimes[idx][1]/1e6;
  }

  totalMS = totalMS.toFixed(2);
  var rate = arraySize * 1000 / totalMS;
  rate = rate.toFixed(2);
  trace("load (insert with dynamic view registered) : " + totalMS + "ms (" + rate + ") ops/s");
}
1148474
def run_plugins(plugins, url_data, stop_after_match=False, **kwargs):
    """"""
    for plugin in plugins:
        log.debug(LOG_PLUGIN, "Run plugin %s", plugin.__class__.__name__)
        if plugin.applies_to(url_data, **kwargs):
            plugin.check(url_data)
            if stop_after_match:
                break
525790
def build_data(self, plugin, attribute, stat):
        """"""
        line = ''

        if attribute is not None:
            line += '{}{}'.format(str(stat.get(attribute, self.na)),
                                  self.separator)
        else:
            if isinstance(stat, dict):
                for v in stat.values():
                    line += '{}{}'.format(str(v), self.separator)
            elif isinstance(stat, list):
                for i in stat:
                    if isinstance(i, dict) and 'key' in i:
                        for v in i.values():
                            line += '{}{}'.format(str(v), self.separator)
            else:
                line += '{}{}'.format(str(stat), self.separator)

        return line
188412
def _run(self):
        """"""
        success = self.initialize()
        while success is None:
            success = self.propagate()
        return success
825894
private function runInitMethods(): void
    {
        $reflectionClass = self::getDoctrineStaticMeta()->getReflectionClass();
        $methods         = $reflectionClass->getMethods(\ReflectionMethod::IS_PRIVATE);
        foreach ($methods as $method) {
            if ($method instanceof ReflectionMethod) {
                $method = $method->getName();
            }
            if (\ts\stringContains($method, UsesPHPMetaDataInterface::METHOD_PREFIX_INIT)
                && \ts\stringStartsWith($method, UsesPHPMetaDataInterface::METHOD_PREFIX_INIT)
            ) {
                $this->$method();
            }
        }
    }
1214303
def _init_eval_iter(self, eval_data):
        """"""
        if eval_data is None:
            return eval_data
        if isinstance(eval_data, (tuple, list)) and len(eval_data) == 2:
            if eval_data[0] is not None:
                if eval_data[1] is None and isinstance(eval_data[0], io.DataIter):
                    return eval_data[0]
                input_data = (np.array(eval_data[0]) if isinstance(eval_data[0], list)
                              else eval_data[0])
                input_label = (np.array(eval_data[1]) if isinstance(eval_data[1], list)
                               else eval_data[1])
                return self._init_iter(input_data, input_label, is_train=True)
            else:
                raise ValueError("Eval data is NONE")
        if not isinstance(eval_data, io.DataIter):
            raise TypeError('Eval data must be DataIter, or ' \
                            'NDArray/numpy.ndarray/list pair (i.e. tuple/list of length 2)')
        return eval_data
744426
def create_attribute_model(self, initial_value=None):
        # type: (Any) -> AttributeModel
        
        attr = self.attribute_class(meta=self, value=initial_value)
        return attr