mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-09 23:34:45 +08:00
Make it possible to use the parse functions without file_io
This commit is contained in:
@@ -67,6 +67,7 @@ from functools import partial
|
|||||||
from parso.python import tree
|
from parso.python import tree
|
||||||
import parso
|
import parso
|
||||||
from parso import python_bytes_to_unicode
|
from parso import python_bytes_to_unicode
|
||||||
|
from parso.file_io import FileIO
|
||||||
|
|
||||||
from jedi import debug
|
from jedi import debug
|
||||||
from jedi import parser_utils
|
from jedi import parser_utils
|
||||||
@@ -453,7 +454,8 @@ class Evaluator(object):
|
|||||||
use_latest_grammar=False, file_io=None, **kwargs):
|
use_latest_grammar=False, file_io=None, **kwargs):
|
||||||
if self.allow_different_encoding:
|
if self.allow_different_encoding:
|
||||||
if code is None:
|
if code is None:
|
||||||
assert file_io is not None
|
if file_io is None:
|
||||||
|
file_io = FileIO(path)
|
||||||
code = file_io.read()
|
code = file_io.read()
|
||||||
code = python_bytes_to_unicode(code, encoding=encoding, errors='replace')
|
code = python_bytes_to_unicode(code, encoding=encoding, errors='replace')
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user