mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-18 19:45:57 +08:00
cleanup / pep8
This commit is contained in:
@@ -1357,10 +1357,8 @@ def follow_call_list(call_list, follow_array=False):
|
|||||||
module = input.get_parent_until()
|
module = input.get_parent_until()
|
||||||
loop = parsing.ForFlow(module, [input], lc.stmt.start_pos,
|
loop = parsing.ForFlow(module, [input], lc.stmt.start_pos,
|
||||||
lc.middle, True)
|
lc.middle, True)
|
||||||
if parent is None:
|
|
||||||
loop.parent = lc.stmt.parent
|
loop.parent = lc.stmt.parent if parent is None else parent
|
||||||
else:
|
|
||||||
loop.parent = parent
|
|
||||||
|
|
||||||
if isinstance(nested_lc, parsing.ListComprehension):
|
if isinstance(nested_lc, parsing.ListComprehension):
|
||||||
loop = evaluate_list_comprehension(nested_lc, loop)
|
loop = evaluate_list_comprehension(nested_lc, loop)
|
||||||
@@ -1539,7 +1537,7 @@ def goto(stmt, call_path=None):
|
|||||||
scope = stmt.parent
|
scope = stmt.parent
|
||||||
pos = stmt.start_pos
|
pos = stmt.start_pos
|
||||||
call_path, search = call_path[:-1], call_path[-1]
|
call_path, search = call_path[:-1], call_path[-1]
|
||||||
pos = pos[0], pos[1]+1
|
pos = pos[0], pos[1] + 1
|
||||||
|
|
||||||
if call_path:
|
if call_path:
|
||||||
scopes = follow_call_path(iter(call_path), scope, pos)
|
scopes = follow_call_path(iter(call_path), scope, pos)
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ class Base(object):
|
|||||||
since Python 2.5 doesn't support it, I decided to do it this way.
|
since Python 2.5 doesn't support it, I decided to do it this way.
|
||||||
"""
|
"""
|
||||||
__slots__ = ()
|
__slots__ = ()
|
||||||
|
|
||||||
def isinstance(self, *cls):
|
def isinstance(self, *cls):
|
||||||
return isinstance(self, cls)
|
return isinstance(self, cls)
|
||||||
|
|
||||||
@@ -65,6 +66,7 @@ class Simple(Base):
|
|||||||
the parser tree inherits from this class.
|
the parser tree inherits from this class.
|
||||||
"""
|
"""
|
||||||
__slots__ = ('parent', 'module', '_start_pos', 'use_as_parent', '_end_pos')
|
__slots__ = ('parent', 'module', '_start_pos', 'use_as_parent', '_end_pos')
|
||||||
|
|
||||||
def __init__(self, module, start_pos, end_pos=(None, None)):
|
def __init__(self, module, start_pos, end_pos=(None, None)):
|
||||||
self._start_pos = start_pos
|
self._start_pos = start_pos
|
||||||
self._end_pos = end_pos
|
self._end_pos = end_pos
|
||||||
@@ -904,6 +906,7 @@ class Param(Statement):
|
|||||||
"""
|
"""
|
||||||
__slots__ = ('position_nr', 'is_generated', 'annotation_stmt',
|
__slots__ = ('position_nr', 'is_generated', 'annotation_stmt',
|
||||||
'parent_function')
|
'parent_function')
|
||||||
|
|
||||||
def __init__(self, module, code, set_vars, used_funcs, used_vars,
|
def __init__(self, module, code, set_vars, used_funcs, used_vars,
|
||||||
token_list, start_pos, end_pos):
|
token_list, start_pos, end_pos):
|
||||||
super(Param, self).__init__(module, code, set_vars, used_funcs,
|
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]
|
would result in an array of [module, class, function]
|
||||||
"""
|
"""
|
||||||
__slots__ = ('names',)
|
__slots__ = ('names',)
|
||||||
|
|
||||||
def __init__(self, module, names, start_pos, end_pos, parent=None):
|
def __init__(self, module, names, start_pos, end_pos, parent=None):
|
||||||
super(Name, self).__init__(module, start_pos, end_pos)
|
super(Name, self).__init__(module, start_pos, end_pos)
|
||||||
self.names = tuple(n if isinstance(n, NamePart) else
|
self.names = tuple(n if isinstance(n, NamePart) else
|
||||||
@@ -1564,7 +1568,7 @@ class PyFuzzyParser(object):
|
|||||||
elif tok == 'lambda':
|
elif tok == 'lambda':
|
||||||
params = []
|
params = []
|
||||||
start_pos = self.start_pos
|
start_pos = self.start_pos
|
||||||
while tok !=':':
|
while tok != ':':
|
||||||
param, tok = self._parse_statement(
|
param, tok = self._parse_statement(
|
||||||
added_breaks=[':', ','], stmt_class=Param)
|
added_breaks=[':', ','], stmt_class=Param)
|
||||||
if param is None:
|
if param is None:
|
||||||
|
|||||||
Reference in New Issue
Block a user