1
1
# created from https://docs.python.org/2/library/os.html
2
2
3
- import sys
4
3
from typing import (
5
4
Mapping , MutableMapping , Dict , List , Any , Tuple , Iterator , overload , Union , AnyStr ,
6
5
Optional , Generic , Set , Callable , Text , Sequence , IO , NamedTuple
@@ -95,58 +94,10 @@ WUNTRACED = 0 # Unix only
95
94
96
95
TMP_MAX = 0 # Undocumented, but used by tempfile
97
96
_PathType = Union [bytes , Text ]
98
-
99
- class stat_result (NamedTuple ('stat_result' , [
100
- ('st_mode' , int ),
101
- ('st_ino' , int ),
102
- ('st_dev' , int ),
103
- ('st_nlink' , int ),
104
- ('st_uid' , int ),
105
- ('st_gid' , int ),
106
- ('st_size' , int ),
107
- ('st_atime' , float ),
108
- ('st_mtime' , float ),
109
- ('st_ctime' , float )])):
110
-
111
- # For backward compatibility, the return value of stat() is also
112
- # accessible as a tuple of at least 10 integers giving the most important
113
- # (and portable) members of the stat structure, in the order st_mode,
114
- # st_ino, st_dev, st_nlink, st_uid, st_gid, st_size, st_atime, st_mtime,
115
- # st_ctime. More items may be added at the end by some implementations.
116
-
117
- if sys .version_info >= (3 , 3 ):
118
- st_atime_ns = ... # type: int
119
- st_mtime_ns = ... # type: int
120
- st_ctime_ns = ... # type: int
121
-
122
- # On some Unix systems (such as Linux), the following attributes may also
123
- # be available:
124
- st_blocks = ... # type: int
125
- st_blksize = ... # type: int
126
- st_rdev = ... # type: int
127
- st_flags = ... # type: int
128
-
129
- # On other Unix systems (such as FreeBSD), the following attributes may be
130
- # available (but may be only filled out if root tries to use them):
131
- st_gen = ... # type: int
132
- st_birthtime = ... # type: int
133
-
134
- # On Mac OS systems, the following attributes may also be available:
135
- st_rsize = ... # type: int
136
- st_creator = ... # type: int
137
- st_type = ... # type: int
138
-
139
- statvfs_result = NamedTuple ('statvfs_result' , [
140
- ('f_bsize' , int ),
141
- ('f_frsize' , int ),
142
- ('f_blocks' , int ),
143
- ('f_bfree' , int ),
144
- ('f_bavail' , int ),
145
- ('f_files' , int ),
146
- ('f_ffree' , int ),
147
- ('f_favail' , int ),
148
- ('f_flag' , int ),
149
- ('f_namemax' , int )])
97
+ _StatVFS = NamedTuple ('_StatVFS' , [('f_bsize' , int ), ('f_frsize' , int ), ('f_blocks' , int ),
98
+ ('f_bfree' , int ), ('f_bavail' , int ), ('f_files' , int ),
99
+ ('f_ffree' , int ), ('f_favail' , int ), ('f_flag' , int ),
100
+ ('f_namemax' , int )])
150
101
def ctermid () -> str : ... # Unix only
151
102
def getegid () -> int : ... # Unix only
152
103
def geteuid () -> int : ... # Unix only
@@ -189,8 +140,8 @@ def fchmod(fd: int, mode: int) -> None: ... # Unix only
189
140
def fchown (fd : int , uid : int , gid : int ) -> None : ... # Unix only
190
141
def fdatasync (fd : int ) -> None : ... # Unix only, not Mac
191
142
def fpathconf (fd : int , name : Union [str , int ]) -> int : ... # Unix only
192
- def fstat (fd : int ) -> stat_result : ...
193
- def fstatvfs (fd : int ) -> statvfs_result : ... # Unix only
143
+ def fstat (fd : int ) -> Any : ...
144
+ def fstatvfs (fd : int ) -> _StatVFS : ... # Unix only
194
145
def fsync (fd : int ) -> None : ...
195
146
def ftruncate (fd : int , length : int ) -> None : ... # Unix only
196
147
def isatty (fd : int ) -> bool : ... # Unix only
@@ -217,7 +168,7 @@ def lchmod(path: _PathType, mode: int) -> None: ... # Unix only
217
168
def lchown (path : _PathType , uid : int , gid : int ) -> None : ... # Unix only
218
169
def link (src : _PathType , link_name : _PathType ) -> None : ...
219
170
def listdir (path : AnyStr ) -> List [AnyStr ]: ...
220
- def lstat (path : _PathType ) -> stat_result : ...
171
+ def lstat (path : _PathType ) -> Any : ...
221
172
def mkfifo (path : _PathType , mode : int = ...) -> None : ... # Unix only
222
173
def mknod (filename : _PathType , mode : int = ..., device : int = ...) -> None : ...
223
174
def major (device : int ) -> int : ...
@@ -232,12 +183,12 @@ def removedirs(path: _PathType) -> None: ...
232
183
def rename (src : _PathType , dst : _PathType ) -> None : ...
233
184
def renames (old : _PathType , new : _PathType ) -> None : ...
234
185
def rmdir (path : _PathType ) -> None : ...
186
+ def stat (path : _PathType ) -> Any : ...
235
187
@overload
236
- def stat_float_times (newvalue : bool ) -> None : ...
188
+ def stat_float_times (newvalue : bool = ... ) -> None : ...
237
189
@overload
238
190
def stat_float_times () -> bool : ...
239
- def stat (path : _PathType ) -> stat_result : ...
240
- def statvfs (path : _PathType ) -> statvfs_result : ... # Unix only
191
+ def statvfs (path : _PathType ) -> _StatVFS : ... # Unix only
241
192
def symlink (source : _PathType , link_name : _PathType ) -> None : ...
242
193
def unlink (path : _PathType ) -> None : ...
243
194
def utime (path : _PathType , times : Optional [Tuple [float , float ]]) -> None : ...
0 commit comments