70750d8b1ae909039c1e95d37ccab60b2f0096b0
"""Constants/functions for interpreting results of os.stat() and os.lstat().
Suggested usage: from stat import *
# XXX Strictly spoken, this module may have to be adapted for each POSIX
# implementation; in practice, however, the numeric constants used by
# stat() are almost universal (even for stat() emulations on non-UNIX
# Indices for stat struct members in tuple returned by os.stat()
# Extract bits from the mode
# Constants used as S_IFMT() for various file types
# (not all are implemented on all systems)
# Functions to test for each file type
return S_IFMT(mode
) == S_IFDIR
return S_IFMT(mode
) == S_IFCHR
return S_IFMT(mode
) == S_IFBLK
return S_IFMT(mode
) == S_IFREG
return S_IFMT(mode
) == S_IFIFO
return S_IFMT(mode
) == S_IFLNK
return S_IFMT(mode
) == S_IFSOCK
# Names for permission bits