@@ -111,8 +111,8 @@ def split(p: AnyStr) -> Tuple[AnyStr, AnyStr]:
111
111
112
112
def splitext (p : AnyStr ) -> Tuple [AnyStr , AnyStr ]:
113
113
if isinstance (p , bytes ):
114
- sep = b'/'
115
- extsep = b'.'
114
+ sep = b'/' # type: AnyStr
115
+ extsep = b'.' # type: AnyStr
116
116
else :
117
117
sep = '/'
118
118
extsep = '.'
@@ -240,7 +240,7 @@ def expanduser(path: AnyStr) -> AnyStr:
240
240
"""Expand ~ and ~user constructions. If user or $HOME is unknown,
241
241
do nothing."""
242
242
if isinstance (path , bytes ):
243
- tilde = b'~'
243
+ tilde = b'~' # type: AnyStr
244
244
else :
245
245
tilde = '~'
246
246
if not path .startswith (tilde ):
@@ -268,7 +268,7 @@ def expanduser(path: AnyStr) -> AnyStr:
268
268
userhome = pwent .pw_dir
269
269
if isinstance (path , bytes ):
270
270
userhome = os .fsencode (userhome )
271
- root = b'/'
271
+ root = b'/' # type: AnyStr
272
272
else :
273
273
root = '/'
274
274
userhome = userhome .rstrip (root )
@@ -293,8 +293,8 @@ def expandvars(path: AnyStr) -> AnyStr:
293
293
import re
294
294
_varprogb = re .compile (br'\$(\w+|\{[^}]*\})' , re .ASCII )
295
295
search = _varprogb .search
296
- start = b'{'
297
- end = b'}'
296
+ start = b'{' # type: AnyStr
297
+ end = b'}' # type: AnyStr
298
298
else :
299
299
if '$' not in path :
300
300
return path
@@ -337,10 +337,10 @@ def expandvars(path: AnyStr) -> AnyStr:
337
337
def normpath (path : AnyStr ) -> AnyStr :
338
338
"""Normalize path, eliminating double slashes, etc."""
339
339
if isinstance (path , bytes ):
340
- sep = b'/'
341
- empty = b''
342
- dot = b'.'
343
- dotdot = b'..'
340
+ sep = b'/' # type: AnyStr
341
+ empty = b'' # type: AnyStr
342
+ dot = b'.' # type: AnyStr
343
+ dotdot = b'..' # type: AnyStr
344
344
else :
345
345
sep = '/'
346
346
empty = ''
@@ -389,8 +389,8 @@ def realpath(filename: AnyStr) -> AnyStr:
389
389
"""Return the canonical path of the specified filename, eliminating any
390
390
symbolic links encountered in the path."""
391
391
if isinstance (filename , bytes ):
392
- sep = b'/'
393
- empty = b''
392
+ sep = b'/' # type: AnyStr
393
+ empty = b'' # type: AnyStr
394
394
else :
395
395
sep = '/'
396
396
empty = ''
@@ -443,9 +443,9 @@ def relpath(path: AnyStr, start: AnyStr = None) -> AnyStr:
443
443
raise ValueError ("no path specified" )
444
444
445
445
if isinstance (path , bytes ):
446
- curdir = b'.'
447
- sep = b'/'
448
- pardir = b'..'
446
+ curdir = b'.' # type: AnyStr
447
+ sep = b'/' # type: AnyStr
448
+ pardir = b'..' # type: AnyStr
449
449
else :
450
450
curdir = '.'
451
451
sep = '/'
0 commit comments