forked from VimPlug/jedi
renamed code -> source
This commit is contained in:
@@ -136,16 +136,16 @@ class Module(parsing.Simple, parsing.Module):
|
|||||||
|
|
||||||
class CachedFastParser(type):
|
class CachedFastParser(type):
|
||||||
""" This is a metaclass for caching `FastParser`. """
|
""" This is a metaclass for caching `FastParser`. """
|
||||||
def __call__(self, code, module_path=None, user_position=None):
|
def __call__(self, source, module_path=None, user_position=None):
|
||||||
if not settings.fast_parser:
|
if not settings.fast_parser:
|
||||||
return parsing.PyFuzzyParser(code, module_path, user_position)
|
return parsing.PyFuzzyParser(source, module_path, user_position)
|
||||||
if module_path is None or module_path not in cache.parser_cache:
|
if module_path is None or module_path not in cache.parser_cache:
|
||||||
p = super(CachedFastParser, self).__call__(code, module_path,
|
p = super(CachedFastParser, self).__call__(source, module_path,
|
||||||
user_position)
|
user_position)
|
||||||
cache.parser_cache[module_path] = p
|
cache.parser_cache[module_path] = p
|
||||||
else:
|
else:
|
||||||
p = cache.parser_cache[module_path]
|
p = cache.parser_cache[module_path]
|
||||||
p.update(code, user_position)
|
p.update(source, user_position)
|
||||||
return p
|
return p
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1240,8 +1240,8 @@ class PyFuzzyParser(object):
|
|||||||
This class is used to parse a Python file, it then divides them into a
|
This class is used to parse a Python file, it then divides them into a
|
||||||
class structure of different scopes.
|
class structure of different scopes.
|
||||||
|
|
||||||
:param code: The codebase for the parser.
|
:param source: The codebase for the parser.
|
||||||
:type code: str
|
:type source: str
|
||||||
:param module_path: The path of the module in the file system, may be None.
|
:param module_path: The path of the module in the file system, may be None.
|
||||||
:type module_path: str
|
:type module_path: str
|
||||||
:param user_position: The line/column, the user is currently on.
|
:param user_position: The line/column, the user is currently on.
|
||||||
@@ -1250,7 +1250,7 @@ class PyFuzzyParser(object):
|
|||||||
:param stop_on_scope: Stop if a scope appears -> for fast_parser
|
:param stop_on_scope: Stop if a scope appears -> for fast_parser
|
||||||
:param top_module: Use this module as a parent instead of `self.module`.
|
:param top_module: Use this module as a parent instead of `self.module`.
|
||||||
"""
|
"""
|
||||||
def __init__(self, code, module_path=None, user_position=None,
|
def __init__(self, source, module_path=None, user_position=None,
|
||||||
no_docstr=False, line_offset=0, stop_on_scope=None,
|
no_docstr=False, line_offset=0, stop_on_scope=None,
|
||||||
top_module=None):
|
top_module=None):
|
||||||
self.user_position = user_position
|
self.user_position = user_position
|
||||||
@@ -1269,8 +1269,8 @@ class PyFuzzyParser(object):
|
|||||||
# any errors of tokenize and just parse ahead.
|
# any errors of tokenize and just parse ahead.
|
||||||
self._line_offset = line_offset
|
self._line_offset = line_offset
|
||||||
|
|
||||||
code = code + '\n' # end with \n, because the parser needs it
|
source = source + '\n' # end with \n, because the parser needs it
|
||||||
buf = StringIO(code)
|
buf = StringIO(source)
|
||||||
self._gen = common.NoErrorTokenizer(buf.readline, line_offset,
|
self._gen = common.NoErrorTokenizer(buf.readline, line_offset,
|
||||||
stop_on_scope)
|
stop_on_scope)
|
||||||
self.top_module = top_module or self.module
|
self.top_module = top_module or self.module
|
||||||
|
|||||||
Reference in New Issue
Block a user