called by the _inherit method in template modules to set
    up the inheritance chain at the start of a template's
    execution.
776985
def _inherit_from(context, uri, calling_uri):
    """"""

    if uri is None:
        return None
    template = _lookup_template(context, uri, calling_uri)
    self_ns = context['self']
    ih = self_ns
    while ih.inherits is not None:
        ih = ih.inherits
    lclcontext = context._locals({'next': ih})
    ih.inherits = TemplateNamespace("self:%s" % template.uri,
                                lclcontext,
                                template=template,
                                populate_self=False)
    context._data['parent'] = lclcontext._data['local'] = ih.inherits
    callable_ = getattr(template.module, '_mako_inherit', None)
    if callable_ is not None:
        ret = callable_(template, lclcontext)
        if ret:
            return ret

    gen_ns = getattr(template.module, '_mako_generate_namespaces', None)
    if gen_ns is not None:
        gen_ns(context)
    return (template.callable_, lclcontext)
269990
def visit_Extends(self, node, frame):
        """"""
        if not frame.toplevel:
            self.fail('cannot use extend from a non top-level scope',
                      node.lineno)

        # if the number of extends statements in general is zero so
        # far, we don't have to add a check if something extended
        # the template before this one.
        if self.extends_so_far > 0:

            # if we have a known extends we just add a template runtime
            # error into the generated code.  We could catch that at compile
            # time too, but i welcome it not to confuse users by throwing the
            # same error at different times just "because we can".
            if not self.has_known_extends:
                self.writeline('if parent_template is not None:')
                self.indent()
            self.writeline('raise TemplateRuntimeError(%r)' %
                           'extended multiple times')

            # if we have a known extends already we don't need that code here
            # as we know that the template execution will end here.
            if self.has_known_extends:
                raise CompilerExit()
            else:
                self.outdent()

        self.writeline('parent_template = environment.get_template(', node)
        self.visit(node.template, frame)
        self.write(', %r)' % self.name)
        self.writeline('for name, parent_block in parent_template.'
                       'blocks.%s():' % dict_item_iter)
        self.indent()
        self.writeline('context.blocks.setdefault(name, []).'
                       'append(parent_block)')
        self.outdent()

        # if this extends statement was in the root level we can take
        # advantage of that information and simplify the generated code
        # in the top level from this point onwards
        if frame.rootlevel:
            self.has_known_extends = True

        # and now we have one more
        self.extends_so_far += 1
240090
def _build_inheritance_chain(cls, bases, *names, merge=False):
        """"""
        result = []
        for name in names:
            maps = []
            for base in bases:
                bmap = getattr(base, name, None)
                if bmap is not None:
                    assert isinstance(bmap, (dict, ChainMap))
                    if len(bmap):
                        if isinstance(bmap, ChainMap):
                            maps.extend(bmap.maps)
                        else:
                            maps.append(bmap)
            result.append(ChainMap({}, *maps))
        if merge:
            result = [dict(map) for map in result]
        if len(names) == 1:
            return result[0]
        return result
635351
public final void chainInitialized() {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.entry(this, tc, "chainInitialized, chain: " + this.name);
        }
        // Clone the list in case one of the event listeners modifies
        // the chain during this iteration.
        for (ChainEventListener listener : chainEventListeners) {
            listener.chainInitialized(this);
        }
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.exit(this, tc, "chainInitialized");
        }
    }
150461
public static function init() {
		self::$tpl_auto_config = Yesf::app()->getConfig('view.auto', Yesf::CONF_PROJECT) === true;
		self::$tpl_extension = Yesf::app()->getConfig('view.extension', Yesf::CONF_PROJECT, 'phtml');
		self::$tpl_engine = Template::class;
		Container::getInstance()->setMulti(Template::class, Container::MULTI_CLONE);
	}
461912
public void onStartup() {
        try {
            preloadCaches();
            SpringAppContext.getInstance().loadPackageContexts();  // trigger dynamic context loading
            preloadDynamicCaches();
            // implementor cache relies on kotlin from preloadDynamicCaches()
            ImplementorCache implementorCache = new ImplementorCache();
            implementorCache.loadCache();
            allCaches.put(ImplementorCache.class.getSimpleName(), implementorCache);
        }
        catch (Exception ex){
            String message = "Failed to load caches";
            logger.severeException(message, ex);
            throw new StartupException(message, ex);
        }
    }
833353
function inherits(ctor, superCtor) {
  ctor.super_ = superCtor;
  var TempCtor = function() {};
  TempCtor.prototype = superCtor.prototype;
  ctor.prototype = new TempCtor();
  ctor.prototype.constructor = ctor;
}
344945
public function init(Smarty_Internal_Template $tpl, $initChild, $blockNames = array())
    {
        // if template was from an inner block or template is a parent template create new inheritance root
        if ($initChild && ($this->blockNesting || $this->state == 3)) {
            $tpl->ext->_inheritance = new Smarty_Internal_Runtime_Inheritance();
            $tpl->ext->_inheritance->init($tpl, $initChild, $blockNames);
            return;
        }
        // start of child sub template(s)
        if ($initChild) {
            $this->state = 1;
            if (!$this->inheritanceLevel) {
                //grab any output of child templates
                ob_start();
            }
            $this->inheritanceLevel ++;
        }
        // in parent state {include} will not increment template index
        if ($this->state != 3) {
            $this->tplIndex ++;
        }
        // if state was waiting for parent change state to parent
        if ($this->state == 2) {
            $this->state = 3;
        }
    }
357260
public function setTemplate()
    {
        // Creates the loader & sets the template directory path
        $loader = new FilesystemLoader('../src/View');

        // Creates the template engine
        $twig = new Environment($loader, array(
            'cache' => false,
            'debug' => true
        ));

        // Adds Twig extensions
        $twig->addExtension(new DebugExtension());
        $twig->addExtension(new PamTwigExtension());

        // Attributes the template engine to the current object
        $this->twig = $twig;
    }
926026
def _process_extends(self, node, **kwargs):
        

        # find all the blocks in this template
        for b in self.ast.find_all(nodes.Block):

            # if not already in `child_blocks` then this is the first time a
            # block with this name has been encountered.
            if b.name not in self.child_blocks:
                self.child_blocks[b.name] = b
            else:

                # otherwise we have seen this block before, so we need to find the last
                # super_block and add the block from this template to the end.
                block = self.child_blocks.get(b.name)
                while hasattr(block, 'super_block'):
                    block = block.super_block
                block.super_block = b

        # load the parent template
        parent_template = JinjaToJS(template_root=self.template_root,
                                    template_name=node.template.value,
                                    js_module_format=self.js_module_format,
                                    runtime_path=self.runtime_path,
                                    include_prefix=self.include_prefix,
                                    include_ext=self.include_ext,
                                    child_blocks=self.child_blocks,
                                    dependencies=self.dependencies)

        # add the parent templates output to the current output
        self.output.write(parent_template.output.getvalue())

        # Raise an exception so we stop parsing this template
        raise ExtendsException
1314537
function setupTemplates() {
  
  // Reset templates before proceeding
  // NOTE: This is needed for templates to be copatible with hot code loading
  this.templates = {};

  var self = this;
  var tplDir = app.mvcpath + app.paths.templates;
  var multiSlashes = this.regex.multipleSlashes;
  
  if (fs.existsSync(tplDir) && fs.statSync(tplDir).isDirectory()) {
    
    var files = protos.util.walkDir(tplDir, this.regex.templateFile);
  
    files.forEach(function(path) {
      buildTemplatePartial.call(this, path);
      watchPartial.call(this, path, buildTemplatePartial);
    }, this);
    
  }
  
  this.emit('templates_loaded', this.templates);
  
}
11086
def _inherit_context(self, node):
        ''''''

        # Collect the initial list of xml:foo attributes.
        xmlattrs = filter(_IN_XML_NS, _attrs(node))

        # Walk up and get all xml:XXX attributes we inherit.
        inherited, parent = [], node.parentNode
        while parent and parent.nodeType == Node.ELEMENT_NODE:
            for a in filter(_IN_XML_NS, _attrs(parent)):
                n = a.localName
                if n not in xmlattrs:
                    xmlattrs.append(n)
                    inherited.append(a)
            parent = parent.parentNode
        return inherited
50946
def define_inheritable_method(mod_name, *args, &block)
      mod = get_inheritable_module(mod_name)
      mod.module_eval do
        define_method(*args, &block)
      end
    end
954011
public static function init()
    {
        self::$loader = new Twig_Loader_Filesystem();

        $config = Config::getInstance();

        foreach (array_reverse($config->get('Octo.paths.templates', [])) as $path) {
            self::$loader->addPath($path);
        }

        foreach (array_reverse($config->get('Octo.paths.admin_templates', [])) as $path) {
            self::$loader->addPath($path, 'admin');
        }

        self::$loader->addPath(CMS_PATH . 'Database/Templates/', 'db');

        if (OCTO_CACHE_ENABLED) {
            self::$cache = OCTO_CACHE_PATH;
        } else {
            self::$cache = false;
        }

        self::$twig = new Twig_Environment(self::$loader, [
            'charset' => 'UTF-8',
            'cache' => self::$cache,
            'auto_reload' => true,
            'strict_variables' => false,
        ]);

        $functions = [];
        Event::trigger('TemplateInit', $functions);

        foreach ($functions as $name => $callable) {
            self::addFunction($name, $callable);
        }

        self::$initialised = true;
    }
1323969
protected function _inherit() {

		$inherited = array_fill_keys($this->_inherited(), []);

		foreach (static::_parents() as $parent) {
			$parentConfig = get_class_vars($parent);

			foreach ($inherited as $key => $value) {
				if (isset($parentConfig["{$key}"])) {
					$val = $parentConfig["{$key}"];
					if (is_array($val)) {
						$inherited[$key] += $val;
					}
				}
			}

			if ($parent === __CLASS__) {
				break;
			}
		}

		foreach ($inherited as $key => $value) {
			if (is_array($this->{$key})) {
				$this->{$key} += $value;
			}
		}
	}
627359
function init(parent, name) {  // {{{2
/**
 * Millitime field constructor
 *
 * @method constructor
 */

  this.min = 0;
  this.decimal = 0;
  this.unit = 'millisecond';

  O.inherited(this)(parent, name);
}
1326653
private void initBaseTemplatePath(ServletContext servletContext) {
		if (engine.getSourceFactory() instanceof ClassPathSourceFactory) {
			// do nothing
		} else {
			if (StrKit.isBlank(engine.getBaseTemplatePath())) {
				String path = servletContext.getRealPath("/");
				engine.setBaseTemplatePath(path);
			}
		}
	}