Allows for lazy instantiation of providers (Jinja2 templating is heavy, so only instantiate it if
        necessary).
170684
def get_provider(self, name):
        """"""
        if name not in self.providers:
            cls = self.provider_classes[name]
            # instantiate the provider
            self.providers[name] = cls(self)
        return self.providers[name]
341179
def _instantiate(self, module, class_name,
                     args=None, kwargs=None, static=None):
        
        if args is None:
            args = []
        if kwargs is None:
            kwargs = {}
        if static is None:
            static = False

        _check_type('args', args, list)
        _check_type('kwargs', kwargs, dict)

        if static and class_name is None:
            return module

        if static and class_name is not None:
            return getattr(module, class_name)

        service_obj = getattr(module, class_name)

        # Replace scalars
        args = self._replace_scalars_in_args(args)
        kwargs = self._replace_scalars_in_kwargs(kwargs)

        # Replace service references
        args = self._replace_services_in_args(args)
        kwargs = self._replace_services_in_kwargs(kwargs)

        # Instantiate object
        return service_obj(*args, **kwargs)
1240562
function Templater(options) {
  if (options == null) {
    options = { allowEval: true };
  }
  this.options = options;
  if (options.stack && Array.isArray(options.stack)) {
    this.stack = options.stack;
  }
  else if (typeof options.stack === 'string') {
    this.stack = [ options.stack ];
  }
  else {
    this.stack = [];
  }
  this.nodes = [];
}
332172
def init_provider(context)
      providers = Map.authorizer_provider_map model_class
      provider_class = providers[self.class.provider_name]
      provider_class ||= providers.values.find { |klass| klass.available? context }
      provider_class.new context
    end
1004729
def force_lazy_import(name):
  
  obj = import_object(name)
  module_items = list(getattr(obj, '__dict__', {}).items())
  for key, value in module_items:
    if getattr(value, '__module__', None):
        import_object(name + '.' + key)
346156
private Templates tryCache(String url) throws Exception {
        Templates x = (Templates) m_cache.get(url);
        if (x == null) {
            synchronized (m_cache) {
                if (!m_cache.containsKey(url)) {
                    TransformerFactory factory = TransformerFactory.newInstance();
                    if (factory.getClass().getName().equals("net.sf.saxon.TransformerFactoryImpl")) {
                        factory.setAttribute(FeatureKeys.VERSION_WARNING, Boolean.FALSE);
                    }
                    StreamSource ss = new StreamSource(getInputStream(url));
                    ss.setSystemId(url);
                    x = factory.newTemplates(ss);
                    m_cache.put(url, x);
                }
            }
        }
        return x;
    }
71863
def main(app):
    
    c = app.config
    src = c.jinjaapi_srcdir

    if not src:
        return

    suffix = "rst"

    out = c.jinjaapi_outputdir or app.env.srcdir

    if c.jinjaapi_addsummarytemplate:
        tpath = pkg_resources.resource_filename(__package__, AUTOSUMMARYTEMPLATE_DIR)
        c.templates_path.append(tpath)

    tpath = pkg_resources.resource_filename(__package__, TEMPLATE_DIR)
    c.templates_path.append(tpath)

    prepare_dir(app, out, not c.jinjaapi_nodelete)
    generate(app, src, out,
             exclude=c.jinjaapi_exclude_paths,
             force=c.jinjaapi_force,
             followlinks=c.jinjaapi_followlinks,
             dryrun=c.jinjaapi_dryrun,
             private=c.jinjaapi_includeprivate,
             suffix=suffix,
             template_dirs=c.templates_path)
3588
private void lazyClassInit() {
        if (lazyInitDone) return;
        synchronized (lazyInitLock) {
            if (redirect!=null) {
                throw new GroovyBugError("lazyClassInit called on a proxy ClassNode, that must not happen."+
                                         "A redirect() call is missing somewhere!");
            }   
            if (lazyInitDone) return;
            VMPluginFactory.getPlugin().configureClassNode(compileUnit,this);
            lazyInitDone = true;
        }
    }
460723
private void lazyInit() {

    if (tokenToPosTagMap != null) {
      return;
    }

    Map<String, List<MultiWordEntry>> map = new HashMap<>();

    try (InputStream stream = JLanguageTool.getDataBroker().getFromResourceDirAsStream(filename)) {
      List<String> posTokens = loadWords(stream);

      for (String posToken : posTokens) {
        String[] tokenAndTag = posToken.split("\t");
        if (tokenAndTag.length != 2) {
          throw new RuntimeException("Invalid format in " + filename + ": '" + posToken + "', expected two tab-separated parts");
        }
        
        String[] tokens = tokenAndTag[0].split(" ");
        String posTag = tokenAndTag[1];
        
        List<MultiWordEntry> multiwordItems;
        if( map.containsKey(tokens[0]) ) {
          multiwordItems = map.get(tokens[0]);
        }
        else {
          multiwordItems = new ArrayList<>();
          map.put(tokens[0], multiwordItems);
        }
        
        multiwordItems.add(new MultiWordEntry(Arrays.asList(tokens), posTag));
      }
      
      tokenToPosTagMap = map;
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
  }
223075
def template(src, context=binding)
      eruby = Erubis::Eruby.new(src)
      eruby.result(context)
    rescue Object => e
      raise Sprinkle::Errors::TemplateError.new(e, src, context)
    end
591714
def _create_template(self, name):
        
        url = '%s/%s' % (self._base_url, escape.url_escape(name))
        LOGGER.debug('Making HTTP GET request to %s', url)
        response = self._http_client.fetch(url)
        data = json.loads(response.body, ensure_ascii=False)
        return template.Template(data['template'], name=name, loader=self)
741914
def lazily(self, name, callable, args):
        
        self._lazy[name] = callable, args
        self._all.add(name)
1091260
function cjsWrap(factoryCode, deps) {
        var requires = deps.map(function (dep) {
            return "require('" + dep + "')";
        });
        return CJS_TEMPLATE.START +
            factoryCode +
            CJS_TEMPLATE.MIDDLE +
            requires.join(',') +
            CJS_TEMPLATE.END;
    }
939844
def stream_template(template_name, **context):
    '''
    
    '''
    app.update_template_context(context)
    template = app.jinja_env.get_template(template_name)
    stream = template.generate(context)
    return Response(stream_with_context(stream))
1174053
def templated(template=None, *templates):
    

    def decorator(func):
        @functools.wraps(func)
        def wrapper(*args, **kwargs):
            template_ = template
            if template_ is None:
                template_ = request.endpoint.split('.', 1)[1].replace(
                    '.', '/') + '.html'
            context = func(*args, **kwargs)
            if context is None:
                context = {}
            elif not isinstance(context, dict):
                return context
            return custom_render_template(
                list(chain(to_list(template_), templates)), **context)

        return wrapper

    return decorator
63892
private <T> Provider<T> autoProvider(Key<T> key)
  {
    for (InjectAutoBind autoBind : _autoBind) {
      Provider<T> provider = autoBind.provider(this, key);

      if (provider != null) {
        return provider;
      }
    }

    return providerDefault(key);
  }
1161668
private static Function<Service<HttpRequest, HttpResponse>,
            ? extends Service<HttpRequest, HttpResponse>> decorator(
            Method method, Class<?> clazz,
            Function<Service<HttpRequest, HttpResponse>,
                    ? extends Service<HttpRequest, HttpResponse>> initialDecorator) {

        final List<DecoratorAndOrder> decorators = collectDecorators(clazz, method);

        Function<Service<HttpRequest, HttpResponse>,
                ? extends Service<HttpRequest, HttpResponse>> decorator = initialDecorator;
        for (int i = decorators.size() - 1; i >= 0; i--) {
            final DecoratorAndOrder d = decorators.get(i);
            decorator = decorator.andThen(d.decorator());
        }
        return decorator;
    }