File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed
Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -34,7 +34,6 @@ def resolve_level(target_level, cwd=None):
3434 pl = ["." ]
3535 for i in range (0 , this_idx - target_idx + 1 ):
3636 pl .append (".." )
37- print (pl )
3837 return os .path .join (* pl )
3938
4039
@@ -76,3 +75,16 @@ def get_level_name(target_level, cwd=None):
7675 cw , pp = os .path .split (cw )
7776 i -= 1
7877 return pp
78+
79+ def get_level_path (target_level , cwd = None ):
80+ """
81+ Return the full path to requested level
82+ """
83+ if cwd is None :
84+ cwd = os .getwd ()
85+ q = ""
86+ for ll in levels :
87+ q = os .path .join (q , get_level_name (ll , cwd ))
88+ if ll == target_level :
89+ break
90+ return q
Original file line number Diff line number Diff line change @@ -34,3 +34,6 @@ def test_level():
3434 dir1 = "Pancake/20130923/session01/array02/channel33"
3535 ln = DPT .levels .get_level_name ("session" , dir1 )
3636 assert ln == "session01"
37+
38+ level_path = DPT .levels .get_level_path ("session" , dir1 )
39+ assert level_path == "Pancake/20130923/session01"
You can’t perform that action at this time.
0 commit comments