forked from VimPlug/jedi
Add the travere_parents function to a utility directory
This commit is contained in:
12
jedi/common/utils.py
Normal file
12
jedi/common/utils.py
Normal 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)
|
||||
Reference in New Issue
Block a user