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

12
jedi/common/utils.py Normal file
View File

@@ -0,0 +1,12 @@
import os
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)