Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1)

Side by Side Diff: Lib/stat.py

Issue 21719: Returning Windows file attribute information via os.stat()
Patch Set: Created 5 years, 8 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Doc/library/stat.rst ('k') | Lib/test/test_os.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 """Constants/functions for interpreting results of os.stat() and os.lstat(). 1 """Constants/functions for interpreting results of os.stat() and os.lstat().
2 2
3 Suggested usage: from stat import * 3 Suggested usage: from stat import *
4 """ 4 """
5 5
6 # Indices for stat struct members in the tuple returned by os.stat() 6 # Indices for stat struct members in the tuple returned by os.stat()
7 7
8 ST_MODE = 0 8 ST_MODE = 0
9 ST_INO = 1 9 ST_INO = 1
10 ST_DEV = 2 10 ST_DEV = 2
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 """Convert a file's mode to a string of the form '-rwxrwxrwx'.""" 140 """Convert a file's mode to a string of the form '-rwxrwxrwx'."""
141 perm = [] 141 perm = []
142 for table in _filemode_table: 142 for table in _filemode_table:
143 for bit, char in table: 143 for bit, char in table:
144 if mode & bit == bit: 144 if mode & bit == bit:
145 perm.append(char) 145 perm.append(char)
146 break 146 break
147 else: 147 else:
148 perm.append("-") 148 perm.append("-")
149 return "".join(perm) 149 return "".join(perm)
150
151
152 # Windows FILE_ATTRIBUTE constants for interpreting os.stat()'s
153 # "st_file_attributes" member
154
155 FILE_ATTRIBUTE_ARCHIVE = 32
156 FILE_ATTRIBUTE_COMPRESSED = 2048
157 FILE_ATTRIBUTE_DEVICE = 64
158 FILE_ATTRIBUTE_DIRECTORY = 16
159 FILE_ATTRIBUTE_ENCRYPTED = 16384
160 FILE_ATTRIBUTE_HIDDEN = 2
161 FILE_ATTRIBUTE_INTEGRITY_STREAM = 32768
162 FILE_ATTRIBUTE_NORMAL = 128
163 FILE_ATTRIBUTE_NOT_CONTENT_INDEXED = 8192
164 FILE_ATTRIBUTE_NO_SCRUB_DATA = 131072
165 FILE_ATTRIBUTE_OFFLINE = 4096
166 FILE_ATTRIBUTE_READONLY = 1
167 FILE_ATTRIBUTE_REPARSE_POINT = 1024
168 FILE_ATTRIBUTE_SPARSE_FILE = 512
169 FILE_ATTRIBUTE_SYSTEM = 4
170 FILE_ATTRIBUTE_TEMPORARY = 256
171 FILE_ATTRIBUTE_VIRTUAL = 65536
172
150 173
151 # If available, use C implementation 174 # If available, use C implementation
152 try: 175 try:
153 from _stat import * 176 from _stat import *
154 except ImportError: 177 except ImportError:
155 pass 178 pass
OLDNEW
« no previous file with comments | « Doc/library/stat.rst ('k') | Lib/test/test_os.py » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+