1
0
forked from VimPlug/jedi

Ignore stdlib paths for dynamic param inference.

This commit is contained in:
Dave Halter
2017-09-07 00:09:14 +02:00
parent 8d06e9f9c9
commit d2b4e0511f
5 changed files with 29 additions and 2 deletions

View File

@@ -1,4 +1,7 @@
import copy
import sys
import re
import os
from itertools import chain
from contextlib import contextmanager
@@ -6,6 +9,14 @@ from parso.python import tree
from jedi.parser_utils import get_parent_scope
def is_stdlib_path(path):
# Python standard library paths look like this:
# /usr/lib/python3.5/...
# TODO The implementation below is probably incorrect and not complete.
base_path = os.path.join(sys.prefix, 'lib', 'python')
return bool(re.match(re.escape(base_path) + '\d.\d', path))
def deep_ast_copy(obj):
"""
Much, much faster than copy.deepcopy, but just for parser tree nodes.