Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __init__(self, source):
super(StatementsDict, self).__init__()
self.source = source
def __init__(self, *args, **kwargs):
super(Source, self).__init__(*args, **kwargs)
if self.tree:
self.lines = self.text.splitlines()
self.highlighted = ArgDefaultDict(
lambda style: raw_highlight(self.text, style).splitlines()
)
else:
self.lines = defaultdict(lambda: u'SOURCE IS UNAVAILABLE')
self.highlighted = defaultdict(lambda: self.lines)
self.statements = StatementsDict(self)
self.nodes = []
if self.tree:
self.tree._depth = 0
for node in ast.walk(self.tree):
node._tree_index = len(self.nodes)
self.nodes.append(node)
for child in ast.iter_child_nodes(node):
child._depth = node._depth + 1
def __init__(self, *args, **kwargs):
super(Source, self).__init__(*args, **kwargs)
if self.tree and self.text:
self.highlighted = ArgDefaultDict(
lambda style: raw_highlight(self.text, style).splitlines()
)
else:
self.lines = defaultdict(lambda: u'SOURCE IS UNAVAILABLE')
self.highlighted = defaultdict(lambda: self.lines)
self.statements = StatementsDict(self)
self.nodes = []
if self.tree:
self.tree._depth = 0
for node in ast.walk(self.tree):
node._tree_index = len(self.nodes)
self.nodes.append(node)
for child in ast.iter_child_nodes(node):
child._depth = node._depth + 1
def __init__(self, source):
super(StatementsDict, self).__init__()
self.source = source