Uranium
Application Framework
UM.Settings.SettingFunction._SettingExpressionVisitor Class Reference

Inherits NodeVisitor.

Public Member Functions

def __init__ (self)
 
def visit
 
def visit_Name
 
def visit_DictComp
 
def visit_ListComp (self, node)
 
def visit_Attribute
 
def generic_visit (self, node)
 
def visit_Slice (self, node)
 
def visit_Str
 
def visit_Subscript
 
def visit_Constant (self, node)
 

Public Attributes

 values
 
 keys
 

Detailed Description

Helper class used to analyze a parsed function.

It walks a Python AST generated from a Python expression. It will analyze the AST and produce two sets, one set of
"used keys" and one set of "used values". "used keys" are setting keys (strings) that are used by the expression,
whereas "used values" are actual variable references that are needed for the function to be executed.

Member Function Documentation

def UM.Settings.SettingFunction._SettingExpressionVisitor.visit_Constant (   self,
  node,
  None 
)
This one is used on Python 3.8+ to visit constant string, bool, int and float types.
def UM.Settings.SettingFunction._SettingExpressionVisitor.visit_Slice (   self,
  node 
)
Visitor function for slices.
We want to block all usage of slices, since it can be used to wiggle your way around the string filtering.
For example: "_0"[:1] + "_0"[:1] + "import__" will still result in the final string "__import__"
:param node:
:return:

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