1
0
forked from VimPlug/jedi

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)
@@ -1539,7 +1537,7 @@ def goto(stmt, call_path=None):
scope = stmt.parent
pos = stmt.start_pos
call_path, search = call_path[:-1], call_path[-1]
pos = pos[0], pos[1]+1
pos = pos[0], pos[1] + 1
if call_path:
scopes = follow_call_path(iter(call_path), scope, pos)

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,
@@ -1168,7 +1171,7 @@ class NamePart(str):
"""
# Unfortunately there's no way to use slots for str (non-zero __itemsize__)
# -> http://utcc.utoronto.ca/~cks/space/blog/python/IntSlotsPython3k
#__slots__ = ('_start_pos', 'parent')
#__slots__ = ('_start_pos', 'parent')
def __new__(cls, s, parent, start_pos):
self = super(NamePart, cls).__new__(cls, s)
self._start_pos = start_pos
@@ -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
@@ -1564,7 +1568,7 @@ class PyFuzzyParser(object):
elif tok == 'lambda':
params = []
start_pos = self.start_pos
while tok !=':':
while tok != ':':
param, tok = self._parse_statement(
added_breaks=[':', ','], stmt_class=Param)
if param is None: