1 """Constants/functions for interpreting results of os.stat() and os.lstat().
3 Suggested usage: from stat import *
6 # XXX Strictly spoken, this module may have to be adapted for each POSIX
7 # implementation; in practice, however, the numeric constants used by
8 # stat() are almost universal (even for stat() emulations on non-UNIX
9 # systems like MS-DOS).
11 # Indices for stat struct members in tuple returned by os.stat()
24 # Extract bits from the mode
32 # Constants used as S_IFMT() for various file types
33 # (not all are implemented on all systems)
43 # Functions to test for each file type
46 return S_IFMT(mode
) == S_IFDIR
49 return S_IFMT(mode
) == S_IFCHR
52 return S_IFMT(mode
) == S_IFBLK
55 return S_IFMT(mode
) == S_IFREG
58 return S_IFMT(mode
) == S_IFIFO
61 return S_IFMT(mode
) == S_IFLNK
64 return S_IFMT(mode
) == S_IFSOCK
66 # Names for permission bits