mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-07 14:34:31 +08:00
pep8 formatting
This commit is contained in:
@@ -54,7 +54,8 @@ class Parser(object):
|
||||
self.sys_path.insert(0, self.path)
|
||||
|
||||
temp, sys.path = sys.path, self.sys_path
|
||||
#print 'sypa', sys.path TODO reenable and check (stackoverflow ticket)
|
||||
# TODO reenable and check (stackoverflow question - pylab builtins)
|
||||
#print 'sypa', sys.path
|
||||
exec 'import %s as module' % self.name in self._content
|
||||
self.sys_path, sys.path = sys.path, temp
|
||||
|
||||
@@ -204,7 +205,7 @@ def parse_function_doc(func):
|
||||
break
|
||||
param_str = doc[start + 1:end]
|
||||
|
||||
# remove square brackets, which show an optional param ( in Python = None)
|
||||
# remove square brackets, that show an optional param ( = None)
|
||||
def change_options(m):
|
||||
args = m.group(1).split(',')
|
||||
for i, a in enumerate(args):
|
||||
|
||||
7
debug.py
7
debug.py
@@ -4,26 +4,31 @@ NOTICE = object()
|
||||
WARNING = object()
|
||||
ERROR = object()
|
||||
|
||||
|
||||
def dbg(*args):
|
||||
if debug_function:
|
||||
frm = inspect.stack()[1]
|
||||
frm = inspect.stack()[1]
|
||||
mod = inspect.getmodule(frm[0])
|
||||
if not (mod.__name__ in ignored_modules):
|
||||
debug_function(NOTICE, *args)
|
||||
|
||||
|
||||
def warning(*args):
|
||||
if debug_function:
|
||||
debug_function(WARNING, *args)
|
||||
|
||||
|
||||
def error(*args):
|
||||
if debug_function:
|
||||
debug_function(ERROR, *args)
|
||||
|
||||
|
||||
def print_to_stdout(level, *args):
|
||||
""" The default debug function """
|
||||
print(('dbg: ' if level == NOTICE else 'warning: ') +
|
||||
', '.join(str(a) for a in args))
|
||||
|
||||
|
||||
debug_function = None
|
||||
#debug_function = print_to_stdout
|
||||
ignored_modules = []
|
||||
|
||||
16
evaluate.py
16
evaluate.py
@@ -197,7 +197,8 @@ class Execution(Exec):
|
||||
result.append(param.get_name())
|
||||
else:
|
||||
new_param = copy.copy(param)
|
||||
calls = parsing.Array(parsing.Array.EMPTY, self.params.parent_stmt)
|
||||
calls = parsing.Array(parsing.Array.EMPTY,
|
||||
self.params.parent_stmt)
|
||||
calls.values = [value]
|
||||
new_param.assignment_calls = calls
|
||||
name = copy.copy(param.get_name())
|
||||
@@ -270,13 +271,12 @@ def get_scopes_for_name(scope, name, search_global=False):
|
||||
# TODO get Flow data, which is defined by the loop
|
||||
# (or with)
|
||||
pass
|
||||
elif isinstance(par, parsing.Param):
|
||||
if isinstance(par.parent.parent, parsing.Class) \
|
||||
and par.position == 0:
|
||||
# this is where self is added
|
||||
result.append(Instance(par.parent.parent))
|
||||
else:
|
||||
result.append(par)
|
||||
elif isinstance(par, parsing.Param) \
|
||||
and isinstance(par.parent.parent, parsing.Class) \
|
||||
and par.position == 0:
|
||||
# this is where self gets added
|
||||
result.append(Instance(par.parent.parent))
|
||||
result.append(par)
|
||||
else:
|
||||
result.append(par)
|
||||
debug.dbg('sfn filter', result)
|
||||
|
||||
@@ -6,7 +6,8 @@ import evaluate
|
||||
import modules
|
||||
import debug
|
||||
|
||||
__all__ = ['complete', 'get_completion_parts', 'complete_test', 'set_debug_function']
|
||||
__all__ = ['complete', 'get_completion_parts', 'set_debug_function']
|
||||
|
||||
|
||||
class FileWithCursor(modules.File):
|
||||
"""
|
||||
@@ -32,6 +33,7 @@ class FileWithCursor(modules.File):
|
||||
def get_row_path(self, column):
|
||||
""" Get the path under the cursor. """
|
||||
self._is_first = True
|
||||
|
||||
def fetch_line():
|
||||
line = self.get_line(self._row_temp)
|
||||
if self._is_first:
|
||||
@@ -159,6 +161,7 @@ def get_completion_parts(path):
|
||||
match = re.match(r'^(.*?)(\.|)(\w?[\w\d]*)$', path, flags=re.S)
|
||||
return match.groups()
|
||||
|
||||
|
||||
def complete(source, row, column, source_path):
|
||||
"""
|
||||
An auto completer for python files.
|
||||
@@ -211,5 +214,6 @@ def set_debug_function(func_cb):
|
||||
"""
|
||||
debug.debug_function = func_cb
|
||||
|
||||
|
||||
def _clear_caches():
|
||||
evaluate.clear_caches()
|
||||
|
||||
@@ -57,6 +57,7 @@ class File(object):
|
||||
File.module_cache[self.module_path] = to_cache
|
||||
return self._parser
|
||||
|
||||
|
||||
def find_module(current_module, point_path):
|
||||
"""
|
||||
Find a module with a path (of the module, like usb.backend.libusb10).
|
||||
|
||||
Reference in New Issue
Block a user