cleanup / pep8

This commit is contained in:
David Halter
2013-01-09 22:47:21 +01:00
parent e9aadce5ae
commit 7b73072045
2 changed files with 9 additions and 7 deletions

View File

@@ -1357,10 +1357,8 @@ def follow_call_list(call_list, follow_array=False):
module = input.get_parent_until()
loop = parsing.ForFlow(module, [input], lc.stmt.start_pos,
lc.middle, True)
if parent is None:
loop.parent = lc.stmt.parent
else:
loop.parent = parent
loop.parent = lc.stmt.parent if parent is None else parent
if isinstance(nested_lc, parsing.ListComprehension):
loop = evaluate_list_comprehension(nested_lc, loop)

View File

@@ -55,6 +55,7 @@ class Base(object):
since Python 2.5 doesn't support it, I decided to do it this way.
"""
__slots__ = ()
def isinstance(self, *cls):
return isinstance(self, cls)
@@ -65,6 +66,7 @@ class Simple(Base):
the parser tree inherits from this class.
"""
__slots__ = ('parent', 'module', '_start_pos', 'use_as_parent', '_end_pos')
def __init__(self, module, start_pos, end_pos=(None, None)):
self._start_pos = start_pos
self._end_pos = end_pos
@@ -904,6 +906,7 @@ class Param(Statement):
"""
__slots__ = ('position_nr', 'is_generated', 'annotation_stmt',
'parent_function')
def __init__(self, module, code, set_vars, used_funcs, used_vars,
token_list, start_pos, end_pos):
super(Param, self).__init__(module, code, set_vars, used_funcs,
@@ -1193,6 +1196,7 @@ class Name(Simple):
would result in an array of [module, class, function]
"""
__slots__ = ('names',)
def __init__(self, module, names, start_pos, end_pos, parent=None):
super(Name, self).__init__(module, start_pos, end_pos)
self.names = tuple(n if isinstance(n, NamePart) else