@@ -17,6 +17,11 @@ if sys.version_info >= (3, 6):
17
17
else :
18
18
_PathType = Union [bytes , Text ]
19
19
20
+ if sys .version_info >= (3 , 3 ):
21
+ _FdOrPathType = Union [int , _PathType ]
22
+ else :
23
+ _FdOrPathType = _PathType
24
+
20
25
# ----- os.path variables -----
21
26
supports_unicode_filenames = False
22
27
# aliases (also in os)
@@ -42,21 +47,21 @@ if sys.version_info >= (3, 5):
42
47
def commonprefix (list : Sequence [AnyStr ]) -> Any : ...
43
48
44
49
def dirname (path : AnyStr ) -> AnyStr : ...
45
- def exists (path : _PathType ) -> bool : ...
50
+ def exists (path : _FdOrPathType ) -> bool : ...
46
51
def lexists (path : _PathType ) -> bool : ...
47
52
def expanduser (path : AnyStr ) -> AnyStr : ...
48
53
def expandvars (path : AnyStr ) -> AnyStr : ...
49
54
50
55
# These return float if os.stat_float_times() == True,
51
56
# but int is a subclass of float.
52
- def getatime (path : _PathType ) -> float : ...
53
- def getmtime (path : _PathType ) -> float : ...
54
- def getctime (path : _PathType ) -> float : ...
57
+ def getatime (path : _FdOrPathType ) -> float : ...
58
+ def getmtime (path : _FdOrPathType ) -> float : ...
59
+ def getctime (path : _FdOrPathType ) -> float : ...
55
60
56
- def getsize (path : _PathType ) -> int : ...
61
+ def getsize (path : _FdOrPathType ) -> int : ...
57
62
def isabs (path : _PathType ) -> bool : ...
58
- def isfile (path : _PathType ) -> bool : ...
59
- def isdir (path : _PathType ) -> bool : ...
63
+ def isfile (path : _FdOrPathType ) -> bool : ...
64
+ def isdir (path : _FdOrPathType ) -> bool : ...
60
65
def islink (path : _PathType ) -> bool : ...
61
66
def ismount (path : _PathType ) -> bool : ...
62
67
86
91
def realpath (filename : AnyStr ) -> AnyStr : ...
87
92
def relpath (path : AnyStr , start : _PathType = ...) -> AnyStr : ...
88
93
89
- def samefile (path1 : _PathType , path2 : _PathType ) -> bool : ...
94
+ def samefile (path1 : _FdOrPathType , path2 : _FdOrPathType ) -> bool : ...
90
95
def sameopenfile (fp1 : int , fp2 : int ) -> bool : ...
91
96
# TODO
92
97
# def samestat(stat1: stat_result,
0 commit comments