Inherits ast.NodeVisitor.
|
None | __init__ (self) |
|
_VisitResult | visit (self, ast.AST node) |
|
None | visit_Name (self, ast.Name node) |
|
None | visit_DictComp (self, ast.DictComp node) |
|
| visit_ListComp (self, node) |
|
None | visit_Attribute (self, ast.Attribute node) |
|
| generic_visit (self, node) |
|
| visit_Slice (self, node) |
|
None | visit_Str (self, ast.Str node) |
|
| visit_Subscript (self, ast.Subscript node) |
|
None | visit_Constant (self, node) |
|
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.
◆ visit_Constant()
None UM.Settings.SettingFunction._SettingExpressionVisitor.visit_Constant |
( |
| self, |
|
|
| node ) |
This one is used on Python 3.8+ to visit constant string, bool, int and float types.
◆ visit_Slice()
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:
◆ visit_Str()
None UM.Settings.SettingFunction._SettingExpressionVisitor.visit_Str |
( |
| self, |
|
|
ast.Str | node ) |
This one is used before Python 3.8 to visit string types.
visit_Str will be marked as deprecated from Python 3.8 and onwards.
The documentation for this class was generated from the following file:
- UM/Settings/SettingFunction.py