Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
children.extend(flatten(self.handlers))
children.append(self.else_)
return tuple(children)
def getChildNodes(self):
nodelist = []
nodelist.append(self.body)
nodelist.extend(flatten_nodes(self.handlers))
if self.else_ is not None:
nodelist.append(self.else_)
return tuple(nodelist)
def __repr__(self):
return "TryExcept(%s, %s, %s)" % (repr(self.body), repr(self.handlers), repr(self.else_))
class TryFinally(Node):
def __init__(self, body, final, lineno=None):
self.body = body
self.final = final
self.lineno = lineno
def getChildren(self):
return self.body, self.final
def getChildNodes(self):
return self.body, self.final
def __repr__(self):
return "TryFinally(%s, %s)" % (repr(self.body), repr(self.final))
class Tuple(Node):
def __init__(self, nodes, lineno=None):
def __init__(self, test, then, else_, lineno=None):
self.test = test
self.then = then
self.else_ = else_
self.lineno = lineno
def getChildren(self):
return self.test, self.then, self.else_
def getChildNodes(self):
return self.test, self.then, self.else_
def __repr__(self):
return "IfExp(%s, %s, %s)" % (repr(self.test), repr(self.then), repr(self.else_))
class Import(Node):
def __init__(self, names, lineno=None):
self.names = names
self.lineno = lineno
def getChildren(self):
return self.names,
def getChildNodes(self):
return ()
def __repr__(self):
return "Import(%s)" % (repr(self.names),)
class Invert(Node):
def __init__(self, expr, lineno=None):
self.expr = expr
class Getattr(Node):
def __init__(self, expr, attrname, lineno=None):
self.expr = expr
self.attrname = attrname
self.lineno = lineno
def getChildren(self):
return self.expr, self.attrname
def getChildNodes(self):
return self.expr,
def __repr__(self):
return "Getattr(%s, %s)" % (repr(self.expr), repr(self.attrname))
class Global(Node):
def __init__(self, names, lineno=None):
self.names = names
self.lineno = lineno
def getChildren(self):
return self.names,
def getChildNodes(self):
return ()
def __repr__(self):
return "Global(%s)" % (repr(self.names),)
class If(Node):
def __init__(self, tests, else_, lineno=None):
self.tests = tests
class UnaryAdd(Node):
def __init__(self, expr, lineno=None):
self.expr = expr
self.lineno = lineno
def getChildren(self):
return self.expr,
def getChildNodes(self):
return self.expr,
def __repr__(self):
return "UnaryAdd(%s)" % (repr(self.expr),)
class UnarySub(Node):
def __init__(self, expr, lineno=None):
self.expr = expr
self.lineno = lineno
def getChildren(self):
return self.expr,
def getChildNodes(self):
return self.expr,
def __repr__(self):
return "UnarySub(%s)" % (repr(self.expr),)
class While(Node):
def __init__(self, test, body, else_, lineno=None):
self.test = test
def __init__(self, nodes, lineno=None):
self.nodes = nodes
self.lineno = lineno
def getChildren(self):
return tuple(flatten(self.nodes))
def getChildNodes(self):
nodelist = []
nodelist.extend(flatten_nodes(self.nodes))
return tuple(nodelist)
def __repr__(self):
return "Tuple(%s)" % (repr(self.nodes),)
class UnaryAdd(Node):
def __init__(self, expr, lineno=None):
self.expr = expr
self.lineno = lineno
def getChildren(self):
return self.expr,
def getChildNodes(self):
return self.expr,
def __repr__(self):
return "UnaryAdd(%s)" % (repr(self.expr),)
class UnarySub(Node):
def __init__(self, expr, lineno=None):
self.expr = expr
children.append(self.else_)
return tuple(children)
def getChildNodes(self):
nodelist = []
nodelist.append(self.assign)
nodelist.append(self.list)
nodelist.append(self.body)
if self.else_ is not None:
nodelist.append(self.else_)
return tuple(nodelist)
def __repr__(self):
return "For(%s, %s, %s, %s)" % (repr(self.assign), repr(self.list), repr(self.body), repr(self.else_))
class From(Node):
def __init__(self, modname, names, level, lineno=None):
self.modname = modname
self.names = names
self.level = level
self.lineno = lineno
def getChildren(self):
return self.modname, self.names, self.level
def getChildNodes(self):
return ()
def __repr__(self):
return "From(%s, %s, %s)" % (repr(self.modname), repr(self.names), repr(self.level))
class Function(Node):
return tuple(children)
def getChildNodes(self):
nodelist = []
if self.expr1 is not None:
nodelist.append(self.expr1)
if self.expr2 is not None:
nodelist.append(self.expr2)
if self.expr3 is not None:
nodelist.append(self.expr3)
return tuple(nodelist)
def __repr__(self):
return "Raise(%s, %s, %s)" % (repr(self.expr1), repr(self.expr2), repr(self.expr3))
class Return(Node):
def __init__(self, value, lineno=None):
self.value = value
self.lineno = lineno
def getChildren(self):
return self.value,
def getChildNodes(self):
return self.value,
def __repr__(self):
return "Return(%s)" % (repr(self.value),)
class RightShift(Node):
def __init__(self, leftright, lineno=None):
self.left = leftright[0]
return "Or(%s)" % (repr(self.nodes),)
class Pass(Node):
def __init__(self, lineno=None):
self.lineno = lineno
def getChildren(self):
return ()
def getChildNodes(self):
return ()
def __repr__(self):
return "Pass()"
class Power(Node):
def __init__(self, leftright, lineno=None):
self.left = leftright[0]
self.right = leftright[1]
self.lineno = lineno
def getChildren(self):
return self.left, self.right
def getChildNodes(self):
return self.left, self.right
def __repr__(self):
return "Power((%s, %s))" % (repr(self.left), repr(self.right))
class Print(Node):
def __init__(self, nodes, dest, lineno=None):
class TryFinally(Node):
def __init__(self, body, final, lineno=None):
self.body = body
self.final = final
self.lineno = lineno
def getChildren(self):
return self.body, self.final
def getChildNodes(self):
return self.body, self.final
def __repr__(self):
return "TryFinally(%s, %s)" % (repr(self.body), repr(self.final))
class Tuple(Node):
def __init__(self, nodes, lineno=None):
self.nodes = nodes
self.lineno = lineno
def getChildren(self):
return tuple(flatten(self.nodes))
def getChildNodes(self):
nodelist = []
nodelist.extend(flatten_nodes(self.nodes))
return tuple(nodelist)
def __repr__(self):
return "Tuple(%s)" % (repr(self.nodes),)
class UnaryAdd(Node):
def getChildren(self):
children = []
children.append(self.expr)
children.extend(flatten(self.ops))
return tuple(children)
def getChildNodes(self):
nodelist = []
nodelist.append(self.expr)
nodelist.extend(flatten_nodes(self.ops))
return tuple(nodelist)
def __repr__(self):
return "Compare(%s, %s)" % (repr(self.expr), repr(self.ops))
class Const(Node):
def __init__(self, value, lineno=None):
self.value = value
self.lineno = lineno
def getChildren(self):
return self.value,
def getChildNodes(self):
return ()
def __repr__(self):
return "Const(%s)" % (repr(self.value),)
class Continue(Node):
def __init__(self, lineno=None):
self.lineno = lineno