Creates another generator that is the same as $(self), except that
        if 'base' is in target types of $(self), 'type' will in target types
        of the new generator.
979598
def clone_and_change_target_type(self, base, type):
        """"""
        assert isinstance(base, basestring)
        assert isinstance(type, basestring)
        target_types = []
        for t in self.target_types_and_names_:
            m = _re_match_type.match(t)
            assert m

            if m.group(1) == base:
                if m.group(2):
                    target_types.append(type + m.group(2))
                else:
                    target_types.append(type)
            else:
                target_types.append(t)

        return self.__class__(self.id_, self.composing_,
                              self.source_types_,
                              target_types,
                              self.requirements_)
1299637
def gen_all_subclasses(cls: Type) -> Generator[Type, None, None]:
    

    for s1 in cls.__subclasses__():
        yield s1
        for s2 in gen_all_subclasses(s1):
            yield s2
829433
@CheckReturnValue
    public static <T> FluentGenerator<T> from(@Nonnull Generator<T> generator) {
        return new FluentGenerator<>(generator);
    }
248871
function(target, source) {
    target = cloneJSON(target);

    for (var key in source) {
      if (source.hasOwnProperty(key)) {
        if (isObject(target[key]) && isObject(source[key])) {
          target[key] = merge(target[key], source[key]);
        } else {
          target[key] = source[key];
        }
      }
    }
    return target;
  }
167665
@XmlElementDecl(namespace = "http://www.w3.org/2005/Atom", name = "generator", scope = SourceType.class)
    public JAXBElement<GeneratorType> createSourceTypeGenerator(
            GeneratorType value) {
        return new JAXBElement<GeneratorType>(FEED_TYPE_GENERATOR_QNAME,
                GeneratorType.class, SourceType.class, value);
    }
1276568
void expectGeneratorSupertype(Node n, JSType type, String msg) {
    if (!getNativeType(GENERATOR_TYPE).isSubtypeOf(type)) {
      mismatch(n, msg, type, GENERATOR_TYPE);
    }
  }
1345574
JaversType spawn(Type baseJavaType) {
        try {
            Constructor c = this.getClass().getConstructor(Type.class);
            return (JaversType)c.newInstance(new Object[]{baseJavaType});
        } catch (ReflectiveOperationException exception) {
            throw new RuntimeException("error calling Constructor for " + this.getClass().getName(), exception);
        }
    }
1359978
void generate(T input) throws SourceFileGenerationException {
    ClassName generatedTypeName = nameGeneratedType(input);
    try {
      Optional<TypeSpec.Builder> type = write(generatedTypeName, input);
      if (!type.isPresent()) {
        return;
      }
      buildJavaFile(generatedTypeName, type.get()).writeTo(filer);
    } catch (Exception e) {
      // if the code above threw a SFGE, use that
      Throwables.propagateIfPossible(e, SourceFileGenerationException.class);
      // otherwise, throw a new one
      throw new SourceFileGenerationException(
          Optional.<ClassName>absent(), e, getElementForErrorReporting(input));
    }
  }
986102
def reset ():
    
    global __generators, __type_to_generators, __generators_for_toolset, __construct_stack
    global __overrides, __active_generators
    global __viable_generators_cache, __viable_source_types_cache
    global __vstg_cached_generators, __vst_cached_types

    __generators = {}
    __type_to_generators = {}
    __generators_for_toolset = {}
    __overrides = {}

    # TODO: can these be global?
    __construct_stack = []
    __viable_generators_cache = {}
    __viable_source_types_cache = {}
    __active_generators = []

    __vstg_cached_generators = []
    __vst_cached_types = []
166613
function(target,source) {
    var keys = Object.keys(source);
    var len = keys.length;
    for (var i = 0; i < len; i++) {
      var key = keys[i];
      if (lib.type.isObject(source[key])) {
        if (!lib.type.isObject(target[key])) {
          target[key] = {};
        }
        factory.merge(target[key],source[key]);
      } else {
        target[key] = source[key];
      }
    }
    return target;
  }
619579
function generatorToPromise(fn) {
    if (typeof fn !== 'function') {
        throw Error('fn is not a function');
    }
    if (!isGenerator(fn)) {
        // assume it's Promise-based
        return fn;
    }
    return co.wrap(fn);
}
987639
public static <S> PVolumeBDGenerator<S> create()
  {
    return new PVolumeBDGenerator<>(new Generator<BigDecimal>()
    {
      private final Random random = new Random();

      @Override
      public BigDecimal next()
      {
        return BigDecimal.valueOf(Math.abs(this.random.nextLong()));
      }
    });
  }
710068
def derived_from_chain(self):
    
    cur = self
    while cur.derived_from is not cur:
      cur = cur.derived_from
      yield cur
776860
def create_instance(self, plugin_type, plugin_name, **instance_kwargs):
        """"""
        plugin_type = self._get_plugin_type(plugin_type)
        return plugin_type.create_instance(plugin_name, **instance_kwargs)
323152
private function makeGenerator()
    {
        if ($this->generatorStrategy !== null) {
            switch ($this->generatorStrategy) {
                case self::GENERATOR_TYPE_ALNUM:
                    $this->generator = new AlnumGenerator($this->className, $this->name);

                    if (isset($this->generatorOptions['pad'])) {
                        $this->generator->setPad($this->generatorOptions['pad']);
                    }
                    if (isset($this->generatorOptions['chars'])) {
                        $this->generator->setChars($this->generatorOptions['chars']);
                    } elseif (isset($this->generatorOptions['awkwardSafe'])) {
                        $this->generator->setAwkwardSafeMode($this->generatorOptions['awkwardSafe']);
                    }

                    break;

                case self::GENERATOR_TYPE_INCREMENT:
                    $this->generator = new IncrementGenerator($this->className, $this->name);

                    if (isset($this->generatorOptions['hash'])) {
                        $this->generator->setHash($this->generatorOptions['key']);
                    }
                    if (isset($this->generatorOptions['range'])) {
                        $this->generator->setRange($this->generatorOptions['range']);
                    }
                    if (isset($this->generatorOptions['startingValue'])) {
                        $this->generator->setStartingValue($this->generatorOptions['startingValue']);
                    }
                    if (isset($this->generatorOptions['table'])) {
                        $this->generator->setTable($this->generatorOptions['table']);
                    }

                    break;

                case self::GENERATOR_TYPE_UUID:
                    $this->generator = new UuidGenerator();

                    if (isset($this->generatorOptions['salt'])) {
                        $this->generator->setSalt($this->generatorOptions['salt']);
                    }

                    break;

                case self::GENERATOR_TYPE_CUSTOM:
                    if (empty($this->generatorOptions['class'])) {
                        throw MappingException::missingCustomGeneratorClass($this);
                    }

                    $customGenerator = new $this->generatorOptions['class'];
                    if (!$customGenerator instanceof ValueGenerator) {
                        throw MappingException::classIsNotAValidGenerator(get_class($customGenerator));
                    }

                    $methods = get_class_methods($customGenerator);
                    foreach ($this->generatorOptions as $name => $value) {
                        $method = 'set' . ucfirst($name);
                        if (!in_array($method, $methods)) {
                            throw MappingException::missingGeneratorSetter(get_class($customGenerator), $name);
                        }

                        $customGenerator->$method($value);
                    }

                    $this->generator = $customGenerator;

                    break;

                default:
                    throw new MappingException('Unknown generator type: ' . $this->generatorStrategy);
            }
        }
    }
25463
private void generateStoreNewProxyMatcher() {
        String proxyMatcherType = Types.PROXY_MATCHER.getInternalName();

        // stack:
        insert(new TypeInsnNode(NEW, proxyMatcherType));
        // stack: <proxyMatcher>
        insert(new InsnNode(DUP));
        // stack: <proxyMatcher> :: <proxyMatcher>
        insert(new MethodInsnNode(INVOKESPECIAL, proxyMatcherType, "<init>", "()V", false));
        // stack: <proxyMatcher>
        generateStoreInCache();
        // stack: <proxyMatcher>
    }
984973
Node createAsyncGeneratorWrapperReference(JSType originalFunctionType, Scope scope) {
    Node ctor = createQName(scope, "$jscomp.AsyncGeneratorWrapper");

    if (isAddingTypes() && !ctor.getJSType().isUnknownType()) {
      // if ctor has the unknown type, we must have not injected the required runtime
      // libraries - hopefully because this is in a test using NonInjectingCompiler.

      // e.g get `number` from `AsyncIterable<number>`
      JSType yieldedType =
          originalFunctionType
              .toMaybeFunctionType()
              .getReturnType()
              .getInstantiatedTypeArgument(getNativeType(JSTypeNative.ASYNC_ITERABLE_TYPE));

      // e.g. replace
      //  AsyncGeneratorWrapper<T>
      // with
      //  AsyncGeneratorWrapper<number>
      ctor.setJSType(replaceTemplate(ctor.getJSType(), yieldedType));
    }

    return ctor;
  }