Qucs-S S-parameter Viewer & RF Synthesis Tools
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
jinja2.sandbox.SandboxedEnvironment Class Reference
Inheritance diagram for jinja2.sandbox.SandboxedEnvironment:
Inheritance graph
[legend]
Collaboration diagram for jinja2.sandbox.SandboxedEnvironment:
Collaboration graph
[legend]

Public Member Functions

None __init__ (self, *t.Any args, **t.Any kwargs)
 
bool is_safe_attribute (self, t.Any obj, str attr, t.Any value)
 
bool is_safe_callable (self, t.Any obj)
 
t.Any call_binop (self, Context context, str operator, t.Any left, t.Any right)
 
t.Any call_unop (self, Context context, str operator, t.Any arg)
 
t.Union[t.Any, Undefinedgetitem (self, t.Any obj, t.Union[str, t.Any] argument)
 
t.Union[t.Any, Undefinedgetattr (self, t.Any obj, str attribute)
 
Undefined unsafe_undefined (self, t.Any obj, str attribute)
 
t.Optional[t.Callable[..., str]] wrap_str_format (self, t.Any value)
 
t.Any call (__self, Context __context, t.Any __obj, *t.Any args, **t.Any kwargs)
 
- Public Member Functions inherited from jinja2.environment.Environment
None add_extension (self, t.Union[str, t.Type["Extension"]] extension)
 
None extend (self, **t.Any attributes)
 
"te.Self" overlay (self, str block_start_string=missing, str block_end_string=missing, str variable_start_string=missing, str variable_end_string=missing, str comment_start_string=missing, str comment_end_string=missing, t.Optional[str] line_statement_prefix=missing, t.Optional[str] line_comment_prefix=missing, bool trim_blocks=missing, bool lstrip_blocks=missing, "te.Literal['\\n', '\\r\\n', '\\r']" newline_sequence=missing, bool keep_trailing_newline=missing, t.Sequence[t.Union[str, t.Type["Extension"]]] extensions=missing, bool optimized=missing, t.Type[Undefined] undefined=missing, t.Optional[t.Callable[..., t.Any]] finalize=missing, t.Union[bool, t.Callable[[t.Optional[str]], bool]] autoescape=missing, t.Optional["BaseLoader"] loader=missing, int cache_size=missing, bool auto_reload=missing, t.Optional["BytecodeCache"] bytecode_cache=missing, bool enable_async=missing)
 
Lexer lexer (self)
 
t.Iterator["Extension"] iter_extensions (self)
 
t.Any call_filter (self, str name, t.Any value, t.Optional[t.Sequence[t.Any]] args=None, t.Optional[t.Mapping[str, t.Any]] kwargs=None, t.Optional[Context] context=None, t.Optional[EvalContext] eval_ctx=None)
 
t.Any call_test (self, str name, t.Any value, t.Optional[t.Sequence[t.Any]] args=None, t.Optional[t.Mapping[str, t.Any]] kwargs=None, t.Optional[Context] context=None, t.Optional[EvalContext] eval_ctx=None)
 
nodes.Template parse (self, str source, t.Optional[str] name=None, t.Optional[str] filename=None)
 
t.Iterator[t.Tuple[int, str, str]] lex (self, str source, t.Optional[str] name=None, t.Optional[str] filename=None)
 
str preprocess (self, str source, t.Optional[str] name=None, t.Optional[str] filename=None)
 
CodeType compile (self, t.Union[str, nodes.Template] source, t.Optional[str] name=None, t.Optional[str] filename=None, "te.Literal[False]" raw=False, bool defer_init=False)
 
str compile (self, t.Union[str, nodes.Template] source, t.Optional[str] name=None, t.Optional[str] filename=None, "te.Literal[True]" raw=..., bool defer_init=False)
 
t.Union[str, CodeType] compile (self, t.Union[str, nodes.Template] source, t.Optional[str] name=None, t.Optional[str] filename=None, bool raw=False, bool defer_init=False)
 
"TemplateExpression" compile_expression (self, str source, bool undefined_to_none=True)
 
None compile_templates (self, t.Union[str, "os.PathLike[str]"] target, t.Optional[t.Collection[str]] extensions=None, t.Optional[t.Callable[[str], bool]] filter_func=None, t.Optional[str] zip="deflated", t.Optional[t.Callable[[str], None]] log_function=None, bool ignore_errors=True)
 
t.List[str] list_templates (self, t.Optional[t.Collection[str]] extensions=None, t.Optional[t.Callable[[str], bool]] filter_func=None)
 
"te.NoReturn" handle_exception (self, t.Optional[str] source=None)
 
str join_path (self, str template, str parent)
 
"Template" get_template (self, t.Union[str, "Template"] name, t.Optional[str] parent=None, t.Optional[t.MutableMapping[str, t.Any]] globals=None)
 
"Template" select_template (self, t.Iterable[t.Union[str, "Template"]] names, t.Optional[str] parent=None, t.Optional[t.MutableMapping[str, t.Any]] globals=None)
 
"Template" get_or_select_template (self, t.Union[str, "Template", t.List[t.Union[str, "Template"]]] template_name_or_list, t.Optional[str] parent=None, t.Optional[t.MutableMapping[str, t.Any]] globals=None)
 
"Template" from_string (self, t.Union[str, nodes.Template] source, t.Optional[t.MutableMapping[str, t.Any]] globals=None, t.Optional[t.Type["Template"]] template_class=None)
 
t.MutableMapping[str, t.Any] make_globals (self, t.Optional[t.MutableMapping[str, t.Any]] d)
 

Public Attributes

 binop_table
 
 unop_table
 
- Public Attributes inherited from jinja2.environment.Environment
 block_start_string
 
 block_end_string
 
 variable_start_string
 
 variable_end_string
 
 comment_start_string
 
 comment_end_string
 
 line_statement_prefix
 
 line_comment_prefix
 
 trim_blocks
 
 lstrip_blocks
 
 newline_sequence
 
 keep_trailing_newline
 
 optimized
 
 finalize
 
 autoescape
 
 filters
 
 tests
 
 globals
 
 loader
 
 cache
 
 bytecode_cache
 
 auto_reload
 
 policies
 
 extensions
 
 is_async
 

Static Public Attributes

bool sandboxed = True
 
dict default_binop_table
 
dict default_unop_table
 
intercepted_binops = frozenset()
 
intercepted_unops = frozenset()
 
- Static Public Attributes inherited from jinja2.environment.Environment
bool sandboxed = False
 
bool overlayed = False
 
linked_to = None
 
bool shared = False
 
code_generator_class = CodeGenerator
 
str concat = "".join
 
context_class = Context
 
template_class .Type["Template"]
 

Additional Inherited Members

- Protected Member Functions inherited from jinja2.environment.Environment
t.Any _filter_test_common (self, t.Union[str, Undefined] name, t.Any value, t.Optional[t.Sequence[t.Any]] args, t.Optional[t.Mapping[str, t.Any]] kwargs, t.Optional[Context] context, t.Optional[EvalContext] eval_ctx, bool is_filter)
 
nodes.Template _parse (self, str source, t.Optional[str] name, t.Optional[str] filename)
 
TokenStream _tokenize (self, str source, t.Optional[str] name, t.Optional[str] filename=None, t.Optional[str] state=None)
 
str _generate (self, nodes.Template source, t.Optional[str] name, t.Optional[str] filename, bool defer_init=False)
 
CodeType _compile (self, str source, str filename)
 
"Template" _load_template (self, str name, t.Optional[t.MutableMapping[str, t.Any]] globals)
 

Detailed Description

The sandboxed environment.  It works like the regular environment but
tells the compiler to generate sandboxed code.  Additionally subclasses of
this environment may override the methods that tell the runtime what
attributes or functions are safe to access.

If the template tries to access insecure code a :exc:`SecurityError` is
raised.  However also other exceptions may occur during the rendering so
the caller has to ensure that all exceptions are caught.

Constructor & Destructor Documentation

◆ __init__()

None jinja2.sandbox.SandboxedEnvironment.__init__ (   self,
*t.Any  args,
**t.Any  kwargs 
)

Reimplemented from jinja2.environment.Environment.

Member Function Documentation

◆ call()

t.Any jinja2.sandbox.SandboxedEnvironment.call (   __self,
Context  __context,
t.Any  __obj,
*t.Any  args,
**t.Any  kwargs 
)
Call an object from sandboxed code.

◆ call_binop()

t.Any jinja2.sandbox.SandboxedEnvironment.call_binop (   self,
Context  context,
str  operator,
t.Any  left,
t.Any   right 
)
For intercepted binary operator calls (:meth:`intercepted_binops`)
this function is executed instead of the builtin operator.  This can
be used to fine tune the behavior of certain operators.

.. versionadded:: 2.6

◆ call_unop()

t.Any jinja2.sandbox.SandboxedEnvironment.call_unop (   self,
Context  context,
str  operator,
t.Any  arg 
)
For intercepted unary operator calls (:meth:`intercepted_unops`)
this function is executed instead of the builtin operator.  This can
be used to fine tune the behavior of certain operators.

.. versionadded:: 2.6

◆ getattr()

t.Union[t.Any, Undefined] jinja2.sandbox.SandboxedEnvironment.getattr (   self,
t.Any  obj,
str  attribute 
)
Subscribe an object from sandboxed code and prefer the
attribute.  The attribute passed *must* be a bytestring.

Reimplemented from jinja2.environment.Environment.

◆ getitem()

t.Union[t.Any, Undefined] jinja2.sandbox.SandboxedEnvironment.getitem (   self,
t.Any  obj,
t.Union[str, t.Any]   argument 
)
Subscribe an object from sandboxed code.

Reimplemented from jinja2.environment.Environment.

◆ is_safe_attribute()

bool jinja2.sandbox.SandboxedEnvironment.is_safe_attribute (   self,
t.Any  obj,
str  attr,
t.Any  value 
)
The sandboxed environment will call this method to check if the
attribute of an object is safe to access.  Per default all attributes
starting with an underscore are considered private as well as the
special attributes of internal python objects as returned by the
:func:`is_internal_attribute` function.

Reimplemented in jinja2.sandbox.ImmutableSandboxedEnvironment.

◆ is_safe_callable()

bool jinja2.sandbox.SandboxedEnvironment.is_safe_callable (   self,
t.Any  obj 
)
Check if an object is safely callable. By default callables
are considered safe unless decorated with :func:`unsafe`.

This also recognizes the Django convention of setting
``func.alters_data = True``.

◆ unsafe_undefined()

Undefined jinja2.sandbox.SandboxedEnvironment.unsafe_undefined (   self,
t.Any  obj,
str  attribute 
)
Return an undefined object for unsafe attributes.

◆ wrap_str_format()

t.Optional[t.Callable[..., str]] jinja2.sandbox.SandboxedEnvironment.wrap_str_format (   self,
t.Any  value 
)
If the given value is a ``str.format`` or ``str.format_map`` method,
return a new function than handles sandboxing. This is done at access
rather than in :meth:`call`, so that calls made without ``call`` are
also sandboxed.

Member Data Documentation

◆ default_binop_table

dict jinja2.sandbox.SandboxedEnvironment.default_binop_table
static
Initial value:
= {
"+": operator.add,
"-": operator.sub,
"*": operator.mul,
"/": operator.truediv,
"//": operator.floordiv,
"**": operator.pow,
"%": operator.mod,
}

◆ default_unop_table

dict jinja2.sandbox.SandboxedEnvironment.default_unop_table
static
Initial value:
= {
"+": operator.pos,
"-": operator.neg,
}

The documentation for this class was generated from the following file: