1
0
forked from VimPlug/jedi

PEP8 whitespace fixes

This commit is contained in:
Laurens Van Houtven
2013-07-10 18:55:48 +02:00
parent cdc41128b4
commit ad932815b9
5 changed files with 20 additions and 18 deletions

View File

@@ -18,7 +18,7 @@ is_py33 = sys.hexversion >= 0x03030000
def find_module_py33(string, path=None): def find_module_py33(string, path=None):
loader = importlib.machinery.PathFinder.find_module(string, path) loader = importlib.machinery.PathFinder.find_module(string, path)
if loader is None and path is None: # Fallback to find builtins if loader is None and path is None: # Fallback to find builtins
loader = importlib.find_loader(string) loader = importlib.find_loader(string)
if loader is None: if loader is None:

View File

@@ -254,8 +254,8 @@ def _generate_code(scope, mixin_funcs={}, depth=0):
code += get_doc(scope) code += get_doc(scope)
names = set(dir(scope)) - set(['__file__', '__name__', '__doc__', names = set(dir(scope)) - set(['__file__', '__name__', '__doc__',
'__path__', '__package__']) \ '__path__', '__package__']) \
| set(['mro']) | set(['mro'])
classes, funcs, stmts, members = get_scope_objects(names) classes, funcs, stmts, members = get_scope_objects(names)
@@ -337,11 +337,11 @@ def _generate_code(scope, mixin_funcs={}, depth=0):
code += '%s = %s\n' % (name, value) code += '%s = %s\n' % (name, value)
if depth == 0: if depth == 0:
#with open('writeout.py', 'w') as f: # with open('writeout.py', 'w') as f:
# f.write(code) # f.write(code)
#import sys # import sys
#sys.stdout.write(code) # sys.stdout.write(code)
#exit() # exit()
pass pass
return code return code

View File

@@ -334,7 +334,7 @@ def _check_array_additions(compare_array, module, is_list):
settings.dynamic_params_for_other_modules = False settings.dynamic_params_for_other_modules = False
search_names = ['append', 'extend', 'insert'] if is_list else \ search_names = ['append', 'extend', 'insert'] if is_list else \
['add', 'update'] ['add', 'update']
comp_arr_parent = get_execution_parent(compare_array, er.Execution) comp_arr_parent = get_execution_parent(compare_array, er.Execution)
possible_stmts = [] possible_stmts = []
@@ -351,7 +351,7 @@ def _check_array_additions(compare_array, module, is_list):
# literally copy the contents of a function. # literally copy the contents of a function.
if isinstance(comp_arr_parent, er.Execution): if isinstance(comp_arr_parent, er.Execution):
stmt = comp_arr_parent. \ stmt = comp_arr_parent. \
get_statement_for_position(stmt.start_pos) get_statement_for_position(stmt.start_pos)
if stmt is None: if stmt is None:
continue continue
# InstanceElements are special, because they don't get copied, # InstanceElements are special, because they don't get copied,
@@ -403,7 +403,9 @@ class ArrayInstance(pr.Base):
if self.var_args.start_pos != array.var_args.start_pos: if self.var_args.start_pos != array.var_args.start_pos:
items += array.iter_content() items += array.iter_content()
else: else:
debug.warning('ArrayInstance recursion', self.var_args) debug.warning(
'ArrayInstance recursion',
self.var_args)
continue continue
items += evaluate.get_iterator_types([typ]) items += evaluate.get_iterator_types([typ])

View File

@@ -197,8 +197,8 @@ class InstanceElement(use_metaclass(cache.CachedMetaClass)):
def parent(self): def parent(self):
par = self.var.parent par = self.var.parent
if isinstance(par, Class) and par == self.instance.base \ if isinstance(par, Class) and par == self.instance.base \
or isinstance(par, pr.Class) \ or isinstance(par, pr.Class) \
and par == self.instance.base.base: and par == self.instance.base.base:
par = self.instance par = self.instance
elif not isinstance(par, pr.Module): elif not isinstance(par, pr.Module):
par = InstanceElement(self.instance, par, self.is_class_var) par = InstanceElement(self.instance, par, self.is_class_var)
@@ -417,7 +417,7 @@ class Execution(Executable):
debug.warning('jedi getattr is too simple') debug.warning('jedi getattr is too simple')
key = arr_name.var_args[0] key = arr_name.var_args[0]
stmts += evaluate.follow_path(iter([key]), obj, stmts += evaluate.follow_path(iter([key]), obj,
self.base) self.base)
return stmts return stmts
elif func_name == 'type': elif func_name == 'type':
# otherwise it would be a metaclass # otherwise it would be a metaclass
@@ -430,7 +430,7 @@ class Execution(Executable):
func = self.var_args.get_parent_until(accept) func = self.var_args.get_parent_until(accept)
if func.isinstance(*accept): if func.isinstance(*accept):
cls = func.get_parent_until(accept + (pr.Class,), cls = func.get_parent_until(accept + (pr.Class,),
include_current=False) include_current=False)
if isinstance(cls, pr.Class): if isinstance(cls, pr.Class):
cls = Class(cls) cls = Class(cls)
su = cls.get_super_classes() su = cls.get_super_classes()
@@ -802,8 +802,8 @@ class Array(use_metaclass(cache.CachedMetaClass, pr.Base)):
# otherwise it just ignores the index (e.g. [1+1]). # otherwise it just ignores the index (e.g. [1+1]).
index = index_possibilities[0] index = index_possibilities[0]
if isinstance(index, Instance) \ if isinstance(index, Instance) \
and str(index.name) in ['int', 'str'] \ and str(index.name) in ['int', 'str'] \
and len(index.var_args) == 1: and len(index.var_args) == 1:
with common.ignored(KeyError, IndexError): with common.ignored(KeyError, IndexError):
return self.get_exact_index_types(index.var_args[0]) return self.get_exact_index_types(index.var_args[0])

View File

@@ -345,8 +345,8 @@ class Parser(object):
tok_list = [] tok_list = []
while not (tok in always_break while not (tok in always_break
or tok in not_first_break and not tok_list or tok in not_first_break and not tok_list
or tok in breaks and level <= 0): or tok in breaks and level <= 0):
try: try:
# print 'parse_stmt', tok, tokenize.tok_name[token_type] # print 'parse_stmt', tok, tokenize.tok_name[token_type]
tok_list.append(self.current + (self.start_pos,)) tok_list.append(self.current + (self.start_pos,))