MCPcopy Index your code
hub / github.com/nodejs/node / overlay

Method overlay

tools/inspector_protocol/jinja2/environment.py:356–399  ·  view source on GitHub ↗

Create a new overlay environment that shares all the data with the current environment except for cache and the overridden attributes. Extensions cannot be removed for an overlayed environment. An overlayed environment automatically gets all the extensions of the environment

(self, block_start_string=missing, block_end_string=missing,
                variable_start_string=missing, variable_end_string=missing,
                comment_start_string=missing, comment_end_string=missing,
                line_statement_prefix=missing, line_comment_prefix=missing,
                trim_blocks=missing, lstrip_blocks=missing,
                extensions=missing, optimized=missing,
                undefined=missing, finalize=missing, autoescape=missing,
                loader=missing, cache_size=missing, auto_reload=missing,
                bytecode_cache=missing)

Source from the content-addressed store, hash-verified

354 setattr(self, key, value)
355
356 def overlay(self, block_start_string=missing, block_end_string=missing,
357 variable_start_string=missing, variable_end_string=missing,
358 comment_start_string=missing, comment_end_string=missing,
359 line_statement_prefix=missing, line_comment_prefix=missing,
360 trim_blocks=missing, lstrip_blocks=missing,
361 extensions=missing, optimized=missing,
362 undefined=missing, finalize=missing, autoescape=missing,
363 loader=missing, cache_size=missing, auto_reload=missing,
364 bytecode_cache=missing):
365 """Create a new overlay environment that shares all the data with the
366 current environment except for cache and the overridden attributes.
367 Extensions cannot be removed for an overlayed environment. An overlayed
368 environment automatically gets all the extensions of the environment it
369 is linked to plus optional extra extensions.
370
371 Creating overlays should happen after the initial environment was set
372 up completely. Not all attributes are truly linked, some are just
373 copied over so modifications on the original environment may not shine
374 through.
375 """
376 args = dict(locals())
377 del args['self'], args['cache_size'], args['extensions']
378
379 rv = object.__new__(self.__class__)
380 rv.__dict__.update(self.__dict__)
381 rv.overlayed = True
382 rv.linked_to = self
383
384 for key, value in iteritems(args):
385 if value is not missing:
386 setattr(rv, key, value)
387
388 if cache_size is not missing:
389 rv.cache = create_cache(cache_size)
390 else:
391 rv.cache = copy_cache(self.cache)
392
393 rv.extensions = {}
394 for key, value in iteritems(self.extensions):
395 rv.extensions[key] = value.bind(rv)
396 if extensions is not missing:
397 rv.extensions.update(load_extensions(rv, extensions))
398
399 return _environment_sanity_check(rv)
400
401 lexer = property(get_lexer, doc="The lexer for this environment.")
402

Callers

nothing calls this directly

Calls 7

create_cacheFunction · 0.70
copy_cacheFunction · 0.70
load_extensionsFunction · 0.70
updateMethod · 0.65
__new__Method · 0.45
bindMethod · 0.45

Tested by

no test coverage detected