17
17
def path (
18
18
path : typing .Union [str , bytes ],
19
19
* paths : typing .Sequence [typing .Union [str , bytes ]],
20
- follow_symlink : bool = True ,
20
+ follow_symlink : bool = False ,
21
21
) -> str :
22
22
"""Expand and normalize to absolute path.
23
23
@@ -55,12 +55,10 @@ def path(
55
55
>>> file = audeer.touch("file.txt")
56
56
>>> link = path("link.txt")
57
57
>>> os.symlink(file, link)
58
- >>> file = path(link)
59
- >>> os.path.basename(file)
60
- 'file.txt'
61
- >>> file = path(link, follow_symlink=False)
62
- >>> os.path.basename(file)
58
+ >>> os.path.basename(path(link))
63
59
'link.txt'
60
+ >>> os.path.basename(path(link, follow_symlink=True))
61
+ 'file.txt'
64
62
65
63
"""
66
64
if paths :
@@ -85,7 +83,7 @@ def path(
85
83
def safe_path (
86
84
path : typing .Union [str , bytes ],
87
85
* paths : typing .Sequence [typing .Union [str , bytes ]],
88
- follow_symlink : bool = True ,
86
+ follow_symlink : bool = False ,
89
87
) -> str :
90
88
"""Expand and normalize to absolute path.
91
89
@@ -127,12 +125,10 @@ def safe_path(
127
125
>>> file = audeer.touch("file.txt")
128
126
>>> link = path("link.txt")
129
127
>>> os.symlink(file, link)
130
- >>> file = path(link)
131
- >>> os.path.basename(file)
132
- 'file.txt'
133
- >>> file = path(link, follow_symlink=False)
134
- >>> os.path.basename(file)
128
+ >>> os.path.basename(path(link))
135
129
'link.txt'
130
+ >>> os.path.basename(path(link, follow_symlink=True))
131
+ 'file.txt'
136
132
137
133
"""
138
- return _path (path , * paths )
134
+ return _path (path , * paths , follow_symlink = follow_symlink )
0 commit comments