diff --git a/jedi/parser/__init__.py b/jedi/parser/__init__.py index fb96b3ef..2b841f1c 100644 --- a/jedi/parser/__init__.py +++ b/jedi/parser/__init__.py @@ -34,15 +34,12 @@ class Parser(object): :type source: str :param module_path: The path of the module in the file system, may be None. :type module_path: str - :param user_position: The line/column, the user is currently on. - :type user_position: tuple(int, int) :param no_docstr: If True, a string at the beginning is not a docstr. :param is_fast_parser: -> for fast_parser :param top_module: Use this module as a parent instead of `self.module`. """ - def __init__(self, source, module_path=None, user_position=None, - no_docstr=False, offset=(0, 0), is_fast_parser=None, - top_module=None): + def __init__(self, source, module_path=None, no_docstr=False, + offset=(0, 0), is_fast_parser=None, top_module=None): self.no_docstr = no_docstr self.start_pos = self.end_pos = 1 + offset[0], offset[1] diff --git a/jedi/parser/fast.py b/jedi/parser/fast.py index 2ae68b6b..7f75d0b4 100644 --- a/jedi/parser/fast.py +++ b/jedi/parser/fast.py @@ -57,17 +57,16 @@ class Module(pr.Simple, pr.Module): class CachedFastParser(type): """ This is a metaclass for caching `FastParser`. """ - def __call__(self, source, module_path=None, user_position=None): + def __call__(self, source, module_path=None): if not settings.fast_parser: - return Parser(source, module_path, user_position) + return Parser(source, module_path) pi = cache.parser_cache.get(module_path, None) if pi is None or isinstance(pi.parser, Parser): - p = super(CachedFastParser, self).__call__(source, module_path, - user_position) + p = super(CachedFastParser, self).__call__(source, module_path) else: p = pi.parser # pi is a `cache.ParserCacheItem` - p.update(source, user_position) + p.update(source) return p @@ -182,7 +181,7 @@ class ParserNode(object): class FastParser(use_metaclass(CachedFastParser)): - def __init__(self, code, module_path=None, user_position=None): + def __init__(self, code, module_path=None): # set values like `pr.Module`. self.module_path = module_path @@ -198,8 +197,7 @@ class FastParser(use_metaclass(CachedFastParser)): self.parsers[:] = [] raise - def update(self, code, user_position=None): - self.user_position = user_position + def update(self, code): self.reset_caches() try: diff --git a/jedi/parser/user_context.py b/jedi/parser/user_context.py index daf6a5b1..2efd4bc9 100644 --- a/jedi/parser/user_context.py +++ b/jedi/parser/user_context.py @@ -192,9 +192,9 @@ class UserContextParser(object): def _parser(self): cache.invalidate_star_import_cache(self._path) if self._no_docstr: - parser = Parser(self._source, self._path, self._position, no_docstr=self._no_docstr) + parser = Parser(self._source, self._path, no_docstr=self._no_docstr) else: - parser = FastParser(self._source, self._path, self._position) + parser = FastParser(self._source, self._path) # Don't pickle that module, because the main module is changing quickly cache.save_parser(self._path, None, parser, pickling=False) return parser