forked from VimPlug/jedi
Replace pr with tree, #566.
This commit is contained in:
@@ -3,7 +3,7 @@ import os
|
||||
import sys
|
||||
|
||||
from jedi._compatibility import exec_function, unicode
|
||||
from jedi.parser import tree as pr
|
||||
from jedi.parser import tree
|
||||
from jedi.parser import Parser
|
||||
from jedi.evaluate.cache import memoize_default
|
||||
from jedi import debug
|
||||
@@ -71,7 +71,7 @@ def _paths_from_assignment(evaluator, expr_stmt):
|
||||
for assignee, operator in zip(expr_stmt.children[::2], expr_stmt.children[1::2]):
|
||||
try:
|
||||
assert operator in ['=', '+=']
|
||||
assert pr.is_node(assignee, 'power') and len(assignee.children) > 1
|
||||
assert tree.is_node(assignee, 'power') and len(assignee.children) > 1
|
||||
c = assignee.children
|
||||
assert c[0].type == 'name' and c[0].value == 'sys'
|
||||
trailer = c[1]
|
||||
@@ -101,8 +101,8 @@ def _paths_from_list_modifications(module_path, trailer1, trailer2):
|
||||
""" extract the path from either "sys.path.append" or "sys.path.insert" """
|
||||
# Guarantee that both are trailers, the first one a name and the second one
|
||||
# a function execution with at least one param.
|
||||
if not (pr.is_node(trailer1, 'trailer') and trailer1.children[0] == '.'
|
||||
and pr.is_node(trailer2, 'trailer') and trailer2.children[0] == '('
|
||||
if not (tree.is_node(trailer1, 'trailer') and trailer1.children[0] == '.'
|
||||
and tree.is_node(trailer2, 'trailer') and trailer2.children[0] == '('
|
||||
and len(trailer2.children) == 3):
|
||||
return []
|
||||
|
||||
@@ -120,12 +120,12 @@ def _check_module(evaluator, module):
|
||||
def get_sys_path_powers(names):
|
||||
for name in names:
|
||||
power = name.parent.parent
|
||||
if pr.is_node(power, 'power'):
|
||||
if tree.is_node(power, 'power'):
|
||||
c = power.children
|
||||
if isinstance(c[0], pr.Name) and c[0].value == 'sys' \
|
||||
and pr.is_node(c[1], 'trailer'):
|
||||
if isinstance(c[0], tree.Name) and c[0].value == 'sys' \
|
||||
and tree.is_node(c[1], 'trailer'):
|
||||
n = c[1].children[1]
|
||||
if isinstance(n, pr.Name) and n.value == 'path':
|
||||
if isinstance(n, tree.Name) and n.value == 'path':
|
||||
yield name, power
|
||||
|
||||
sys_path = list(get_sys_path()) # copy
|
||||
|
||||
Reference in New Issue
Block a user