Private method used by `.findGenerator`.
967245
function(name, options) {
        if (this.generators.hasOwnProperty(name)) {
          return this.generators[name];
        }

        if (~name.indexOf('.')) {
          return this.getSubGenerator.apply(this, arguments);
        }

        var opts = utils.extend({}, this.options, options);
        if (typeof opts.lookup === 'function') {
          var app = this.lookupGenerator(name, opts, opts.lookup);
          if (app) {
            return app;
          }
        }
        return this.matchGenerator(name);
      }
1106422
@Override
    public int getGeneration() {
	int penalty = Timing.getInstance().LOCAL_READ;
	log.trace("[getGeneration] Waiting {} cycles", penalty);
	turnsControl.waitTurns(penalty, "Get Generation");
	return this.robot.getData().getGeneration();
    }
221608
def generation(self):
        """"""
        if not self.parent:
            return 0
        elif self.parent.is_dict:
            return 1 + self.parent.generation
        else:
            return self.parent.generation
1081338
private static TreeElement recursiveFindSelected(TreeElement elem)
    {
        assert(elem != null);

        if (elem.isSelected())
            return elem;

        TreeElement children[] = elem.getChildren();
        assert(children != null);
        for (int i = 0; i < children.length; i++) {
            TreeElement e = recursiveFindSelected(children[i]);
            if (e != null)
                return e;
        }
        return null;
    }
468961
def writeGenerator(self, gen):
        
        n = getattr(gen, 'next')

        while True:
            try:
                self.writeElement(n())
            except StopIteration:
                break
1163587
private ImmutableList<Function> getAtomsForGenerators(Collection<TreeWitnessGenerator> gens, Term r0)  {
		return TreeWitnessGenerator.getMaximalBasicConcepts(gens, reasoner).stream()
				.map(con -> {
					log.debug("  BASIC CONCEPT: {}", con);
					if (con instanceof OClass) {
						return atomFactory.getMutableTripleBodyAtom(r0, ((OClass) con).getIRI());
					}
					else if (con instanceof ObjectSomeValuesFrom) {
						ObjectPropertyExpression ope = ((ObjectSomeValuesFrom)con).getProperty();
						return (!ope.isInverse())
								? atomFactory.getMutableTripleBodyAtom(r0, ope.getIRI(), getFreshVariable())
								: atomFactory.getMutableTripleBodyAtom(getFreshVariable(), ope.getIRI(), r0);
					}
					else {
						DataPropertyExpression dpe = ((DataSomeValuesFrom)con).getProperty();
						return atomFactory.getMutableTripleBodyAtom(r0, dpe.getIRI(), getFreshVariable());
					}
				})
				.collect(ImmutableCollectors.toList());
	}
812898
private void initGenerator(ResourceGenerator generator) {

		initializeGeneratorProperties(generator);
		updateRegistries(generator);
		ResourceReader proxy = ResourceGeneratorReaderProxyFactory.getResourceReaderProxy(generator, rsHandler, config);
		rsHandler.addResourceReader(proxy);
	}
696203
def _get_generator(parser, extract, keep, check_maf):
    """"""
    if extract is not None:
        parser = Extractor(parser, names=extract)

    for data in parser.iter_genotypes():
        data.genotypes = data.genotypes[keep]

        # Checking the MAF, if required
        if check_maf:
            data.code_minor()

        yield data
1074292
private void checkForGenerator(final Class<?> clazz, Field field, GeneratedValue generatedValue, String schemaName)

    {

        TableGenerator tableGenerator = field.getAnnotation(TableGenerator.class);
        SequenceGenerator sequenceGenerator = field.getAnnotation(SequenceGenerator.class);
        if (tableGenerator == null || !tableGenerator.name().equals(generatedValue.generator()))
        {
            tableGenerator = clazz.getAnnotation(TableGenerator.class);
        }
        if (sequenceGenerator == null || !sequenceGenerator.name().equals(generatedValue.generator()))
        {
            sequenceGenerator = clazz.getAnnotation(SequenceGenerator.class);
        }

        if ((tableGenerator == null && sequenceGenerator == null)
                || (tableGenerator != null && !tableGenerator.name().equals(generatedValue.generator()))
                || (sequenceGenerator != null && !sequenceGenerator.name().equals(generatedValue.generator())))
        {

            throw new RuleValidationException("Unknown Id.generator: " + generatedValue.generator());

        }
        else if ((tableGenerator != null && !tableGenerator.schema().isEmpty() && !tableGenerator.schema().equals(
                schemaName))
                || (sequenceGenerator != null && !sequenceGenerator.schema().isEmpty() && !sequenceGenerator.schema()
                        .equals(schemaName)))
        {

            throw new RuleValidationException("Generator " + generatedValue.generator() + " in entity : "
                    + clazz.getName() + " has different schema name ,it should be same as entity have");

        }

    }
1202781
protected function buildGeneratorWrapper()
    {
        foreach ($this->generator as $key => &$value) {
            yield null;
            $this->currentKey   = $key;
            $this->currentValue =& $value;
        }
    }
1098931
def visit_generatorexp(self, node):
        """"""
        return "(%s %s)" % (
            node.elt.accept(self),
            " ".join(n.accept(self) for n in node.generators),
        )
742439
@SuppressWarnings("unchecked")
    private <T> TypedStringConverter<T> findAnyConverter(final Class<T> cls) {
        // check factories
        for (StringConverterFactory factory : factories) {
            StringConverter<T> factoryConv = (StringConverter<T>) factory.findConverter(cls);
            if (factoryConv != null) {
                return TypedAdapter.adapt(cls, factoryConv);
            }
        }
        return null;
    }
1247605
@NotNull
    public final List<GeneratorConfig> findGeneratorsForParser(@NotNull final String parserName) {
        Contract.requireArgNotNull("parserName", parserName);

        final List<GeneratorConfig> list = new ArrayList<>();
        final List<GeneratorConfig> gcList = generators.getList();
        for (final GeneratorConfig gc : gcList) {
            if (gc.getParser().equals(parserName)) {
                list.add(gc);
            }
        }
        return list;
    }
791057
def try_one_generator_really (project, name, generator, target_type, properties, sources):
    
    if __debug__:
        from .targets import ProjectTarget
        assert isinstance(project, ProjectTarget)
        assert isinstance(name, basestring) or name is None
        assert isinstance(generator, Generator)
        assert isinstance(target_type, basestring)
        assert isinstance(properties, property_set.PropertySet)
        assert is_iterable_typed(sources, virtual_target.VirtualTarget)
    targets = generator.run (project, name, properties, sources)

    usage_requirements = []
    success = False

    dout("returned " + str(targets))

    if targets:
        success = True;

        if isinstance (targets[0], property_set.PropertySet):
            usage_requirements = targets [0]
            targets = targets [1]

        else:
            usage_requirements = property_set.empty ()

    dout(  "  generator" + generator.id() + " spawned ")
    #    generators.dout [ indent ] " " $(targets) ;
#    if $(usage-requirements)
#    {
#        generators.dout [ indent ] "  with usage requirements:" $(x) ;
#    }

    if success:
        return (usage_requirements, targets)
    else:
        return None
120695
function runGenerator (makeGenerator) {
  return function (thisArg, args) {
    var generator = makeGenerator.apply(thisArg, args)

    function handle (result, gen) {
      var value = result.value

      if (value != null) {
        if (value.constructor.name === 'GeneratorFunctionPrototype') {
          value = handle(value.next(), value)
        } else if (value.constructor.name === 'GeneratorFunction') {
          value = runGenerator(value)(thisArg, args)
        }
      }

      if (result.done) {
        return Promise.resolve(value)
      }

      return Promise.resolve(value).then(function (res) {
        return handle(gen.next(res), gen)
      }, function (err){
        return handle(gen.throw(err), gen)
      })
    }

    try {
      return handle(generator.next(), generator)
    } catch (ex) {
      return Promise.reject(ex)
    }
  }
}
485333
public ArrayList<String> getGenerators() {
        ArrayList<String> genList = new ArrayList<String>();
        for (ArrayList<HashMap<String, String>> genGroup : genGroups) {
            if (!genGroup.isEmpty()) {
                HashMap<String, String> genRule = genGroup.get(genGroup.size() - 1);
                if (!genRule.isEmpty()) {
                    genList.add(genRule.get("cmd") + "," + genRule.get("variable") + "," + genRule.get("args"));
                }
            }
        }

        return genList;
    }
824609
def is_generator(self, node):
        """"""
        results = {}
        if self.yield_expr.match(node, results):
            return True
        for child in node.children:
            if child.type not in (syms.funcdef, syms.classdef):
                if self.is_generator(child):
                    return True
        return False