mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-19 12:01:12 +08:00
Respect settings.fast_parser
This commit is contained in:
@@ -56,7 +56,7 @@ class Script(object):
|
|||||||
:type source_encoding: str
|
:type source_encoding: str
|
||||||
"""
|
"""
|
||||||
def __init__(self, source, line, column, source_path,
|
def __init__(self, source, line, column, source_path,
|
||||||
source_encoding='utf-8', fast=True):
|
source_encoding='utf-8', fast=None):
|
||||||
api_classes._clear_caches()
|
api_classes._clear_caches()
|
||||||
debug.reset_time()
|
debug.reset_time()
|
||||||
self.source = modules.source_to_unicode(source, source_encoding)
|
self.source = modules.source_to_unicode(source, source_encoding)
|
||||||
|
|||||||
@@ -91,9 +91,13 @@ class ModuleWithCursor(Module):
|
|||||||
:param path: The module path of the file or None.
|
:param path: The module path of the file or None.
|
||||||
:param position: The position, the user is currently in. Only important \
|
:param position: The position, the user is currently in. Only important \
|
||||||
for the main file.
|
for the main file.
|
||||||
|
:param fast: Use `fast_parser.FastParser` or not. If None, respect
|
||||||
|
`settings.fast_parser`.
|
||||||
"""
|
"""
|
||||||
def __init__(self, path, source, position, fast=True):
|
def __init__(self, path, source, position, fast=None):
|
||||||
super(ModuleWithCursor, self).__init__(path, source)
|
super(ModuleWithCursor, self).__init__(path, source)
|
||||||
|
if fast is None:
|
||||||
|
fast = settings.fast_parser
|
||||||
self._parserclass = fast_parser.FastParser if fast else \
|
self._parserclass = fast_parser.FastParser if fast else \
|
||||||
parsing.Parser
|
parsing.Parser
|
||||||
self.position = position
|
self.position = position
|
||||||
|
|||||||
Reference in New Issue
Block a user