1
0
forked from VimPlug/jedi

All modules now have a code_lines attribute, see #1062

This commit is contained in:
Dave Halter
2018-03-16 10:20:14 +01:00
parent 24e1f7e6f0
commit 90a226f898
11 changed files with 102 additions and 33 deletions

View File

@@ -1,8 +1,10 @@
import textwrap
from inspect import cleandoc
from jedi._compatibility import literal_eval, force_unicode
from parso.python import tree
from parso.cache import parser_cache
from jedi._compatibility import literal_eval, force_unicode
_EXECUTE_NODES = {'funcdef', 'classdef', 'import_from', 'import_name', 'test',
'or_test', 'and_test', 'not_test', 'comparison', 'expr',
@@ -238,3 +240,11 @@ def get_parent_scope(node, include_flows=False):
break
scope = scope.parent
return scope
def get_cached_code_lines(grammar, path):
"""
Basically access the cached code lines in parso. This is not the nicest way
to do this, but we avoid splitting all the lines again.
"""
return parser_cache[grammar._hashed][path].lines