1
0
forked from VimPlug/jedi

Add the travere_parents function to a utility directory

This commit is contained in:
Dave Halter
2018-02-16 21:07:36 +01:00
parent 81a30d61d6
commit 24adebb69d
3 changed files with 14 additions and 13 deletions

View File

@@ -5,9 +5,9 @@ from jedi._compatibility import unicode, force_unicode
from jedi.evaluate.cache import evaluator_method_cache
from jedi.evaluate.base_context import ContextualizedNode
from jedi.evaluate.helpers import is_string
from jedi.common.utils import traverse_parents
from jedi import settings
from jedi import debug
from jedi.evaluate.utils import ignored
def _abs_path(module_context, path):
@@ -160,17 +160,6 @@ def _get_paths_from_buildout_script(evaluator, buildout_script_path):
yield path
def traverse_parents(path, include_current=False):
if not include_current:
path = os.path.dirname(path)
previous = None
while previous != path:
yield path
previous = path
path = os.path.dirname(path)
def _get_parent_dir_with_file(path, filename):
for parent in traverse_parents(path):
if os.path.isfile(os.path.join(parent, filename)):