1
0
forked from VimPlug/jedi

(Mostly) whitespace fixes

This commit is contained in:
Laurens Van Houtven
2013-07-10 14:45:47 +02:00
parent 8dae2049c9
commit cdc41128b4
18 changed files with 165 additions and 162 deletions

View File

@@ -45,7 +45,7 @@ class CachedModule(object):
""" get the parser lazy """
if self._parser is None:
self._parser = cache.load_module(self.path, self.name) \
or self._load_module()
or self._load_module()
return self._parser
def _get_source(self):
@@ -113,10 +113,10 @@ class ModuleWithCursor(Module):
# Also, the position is here important (which will not be used by
# default), therefore fill the cache here.
self._parser = fast_parser.FastParser(self.source, self.path,
self.position)
self.position)
# don't pickle that module, because it's changing fast
cache.save_module(self.path, self.name, self._parser,
pickling=False)
pickling=False)
return self._parser
def get_path_until_cursor(self):
@@ -163,7 +163,7 @@ class ModuleWithCursor(Module):
last_type = None
try:
for token_type, tok, start, end, line in gen:
#print 'tok', token_type, tok, force_point
# print 'tok', token_type, tok, force_point
if last_type == token_type == tokenize.NAME:
string += ' '
@@ -214,7 +214,7 @@ class ModuleWithCursor(Module):
after = re.match("[^\w\s]+", line[self.position[1]:])
before = re.match("[^\w\s]+", line[:self.position[1]][::-1])
return (before.group(0) if before is not None else '') \
+ (after.group(0) if after is not None else '')
+ (after.group(0) if after is not None else '')
def get_context(self):
pos = self._start_cursor_pos
@@ -375,7 +375,7 @@ def source_to_unicode(source, encoding=None):
first_two_lines = re.match(r'(?:[^\n]*\n){0,2}', str(source)).group(0)
possible_encoding = re.search(r"coding[=:]\s*([-\w.]+)",
first_two_lines)
first_two_lines)
if possible_encoding:
return possible_encoding.group(1)
else: