Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
a6beddef
Kaydet (Commit)
a6beddef
authored
May 14, 2012
tarafından
Giampaolo Rodola'
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue 14800: add comments explaining stat.py constants + docstring for S_* functions.
üst
1b634c26
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
38 deletions
+51
-38
stat.py
Lib/stat.py
+51
-38
No files found.
Lib/stat.py
Dosyayı görüntüle @
a6beddef
...
...
@@ -19,78 +19,91 @@ ST_CTIME = 9
# Extract bits from the mode
def
S_IMODE
(
mode
):
"""Return the portion of the file's mode that can be set by
os.chmod().
"""
return
mode
&
0
o7777
def
S_IFMT
(
mode
):
"""Return the portion of the file's mode that describes the
file type.
"""
return
mode
&
0
o170000
# Constants used as S_IFMT() for various file types
# (not all are implemented on all systems)
S_IFDIR
=
0
o040000
S_IFCHR
=
0
o020000
S_IFBLK
=
0
o060000
S_IFREG
=
0
o100000
S_IFIFO
=
0
o010000
S_IFLNK
=
0
o120000
S_IFSOCK
=
0
o140000
S_IFDIR
=
0
o040000
# directory
S_IFCHR
=
0
o020000
# character device
S_IFBLK
=
0
o060000
# block device
S_IFREG
=
0
o100000
# regular file
S_IFIFO
=
0
o010000
# fifo (named pipe)
S_IFLNK
=
0
o120000
# symbolic link
S_IFSOCK
=
0
o140000
# socket file
# Functions to test for each file type
def
S_ISDIR
(
mode
):
"""Return True if mode is from a directory."""
return
S_IFMT
(
mode
)
==
S_IFDIR
def
S_ISCHR
(
mode
):
"""Return True if mode is from a character special device file."""
return
S_IFMT
(
mode
)
==
S_IFCHR
def
S_ISBLK
(
mode
):
"""Return True if mode is from a block special device file."""
return
S_IFMT
(
mode
)
==
S_IFBLK
def
S_ISREG
(
mode
):
"""Return True if mode is from a regular file."""
return
S_IFMT
(
mode
)
==
S_IFREG
def
S_ISFIFO
(
mode
):
"""Return True if mode is from a FIFO (named pipe)."""
return
S_IFMT
(
mode
)
==
S_IFIFO
def
S_ISLNK
(
mode
):
"""Return True if mode is from a symbolic link."""
return
S_IFMT
(
mode
)
==
S_IFLNK
def
S_ISSOCK
(
mode
):
"""Return True if mode is from a socket."""
return
S_IFMT
(
mode
)
==
S_IFSOCK
# Names for permission bits
S_ISUID
=
0
o4000
S_ISGID
=
0
o2000
S_ENFMT
=
S_ISGID
S_ISVTX
=
0
o1000
S_IREAD
=
0
o0400
S_IWRITE
=
0
o0200
S_IEXEC
=
0
o0100
S_IRWXU
=
0
o0700
S_IRUSR
=
0
o0400
S_IWUSR
=
0
o0200
S_IXUSR
=
0
o0100
S_IRWXG
=
0
o0070
S_IRGRP
=
0
o0040
S_IWGRP
=
0
o0020
S_IXGRP
=
0
o0010
S_IRWXO
=
0
o0007
S_IROTH
=
0
o0004
S_IWOTH
=
0
o0002
S_IXOTH
=
0
o0001
S_ISUID
=
0
o4000
# set UID bit
S_ISGID
=
0
o2000
# set GID bit
S_ENFMT
=
S_ISGID
# file locking enforcement
S_ISVTX
=
0
o1000
# sticky bit
S_IREAD
=
0
o0400
# Unix V7 synonym for S_IRUSR
S_IWRITE
=
0
o0200
# Unix V7 synonym for S_IWUSR
S_IEXEC
=
0
o0100
# Unix V7 synonym for S_IXUSR
S_IRWXU
=
0
o0700
# mask for owner permissions
S_IRUSR
=
0
o0400
# read by owner
S_IWUSR
=
0
o0200
# write by owner
S_IXUSR
=
0
o0100
# execute by owner
S_IRWXG
=
0
o0070
# mask for group permissions
S_IRGRP
=
0
o0040
# read by group
S_IWGRP
=
0
o0020
# write by group
S_IXGRP
=
0
o0010
# execute by group
S_IRWXO
=
0
o0007
# mask for others (not in group) permissions
S_IROTH
=
0
o0004
# read by others
S_IWOTH
=
0
o0002
# write by others
S_IXOTH
=
0
o0001
# execute by others
# Names for file flags
UF_NODUMP
=
0x00000001
UF_IMMUTABLE
=
0x00000002
UF_APPEND
=
0x00000004
UF_OPAQUE
=
0x00000008
UF_NOUNLINK
=
0x00000010
UF_COMPRESSED
=
0x00000020
# OS X: file is hfs-compressed
UF_HIDDEN
=
0x00008000
# OS X: file should not be displayed
SF_ARCHIVED
=
0x00010000
SF_IMMUTABLE
=
0x00020000
SF_APPEND
=
0x00040000
SF_NOUNLINK
=
0x00100000
SF_SNAPSHOT
=
0x00200000
UF_NODUMP
=
0x00000001
# do not dump file
UF_IMMUTABLE
=
0x00000002
# file may not be changed
UF_APPEND
=
0x00000004
# file may only be appended to
UF_OPAQUE
=
0x00000008
# directory is opaque when viewed through a union stack
UF_NOUNLINK
=
0x00000010
# file may not be renamed or deleted
UF_COMPRESSED
=
0x00000020
# OS X: file is hfs-compressed
UF_HIDDEN
=
0x00008000
# OS X: file should not be displayed
SF_ARCHIVED
=
0x00010000
# file may be archived
SF_IMMUTABLE
=
0x00020000
# file may not be changed
SF_APPEND
=
0x00040000
# file may only be appended to
SF_NOUNLINK
=
0x00100000
# file may not be renamed or deleted
SF_SNAPSHOT
=
0x00200000
# file is a snapshot file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment