mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Replaced obsolete stat module constants with equivalent attributes
This commit is contained in:
parent
16e3c427f3
commit
32200aeac6
18 changed files with 59 additions and 79 deletions
|
@ -175,18 +175,15 @@ def commonprefix(m):
|
|||
|
||||
def getsize(filename):
|
||||
"""Return the size of a file, reported by os.stat()"""
|
||||
st = os.stat(filename)
|
||||
return st[stat.ST_SIZE]
|
||||
return os.stat(filename).st_size
|
||||
|
||||
def getmtime(filename):
|
||||
"""Return the last modification time of a file, reported by os.stat()"""
|
||||
st = os.stat(filename)
|
||||
return st[stat.ST_MTIME]
|
||||
return os.stat(filename).st_mtime
|
||||
|
||||
def getatime(filename):
|
||||
"""Return the last access time of a file, reported by os.stat()"""
|
||||
st = os.stat(filename)
|
||||
return st[stat.ST_ATIME]
|
||||
return os.stat(filename).st_atime
|
||||
|
||||
|
||||
# Is a path a symbolic link?
|
||||
|
@ -217,7 +214,7 @@ def isdir(path):
|
|||
st = os.stat(path)
|
||||
except os.error:
|
||||
return False
|
||||
return stat.S_ISDIR(st[stat.ST_MODE])
|
||||
return stat.S_ISDIR(st.st_mode)
|
||||
|
||||
|
||||
# Is a path a regular file?
|
||||
|
@ -230,7 +227,7 @@ def isfile(path):
|
|||
st = os.stat(path)
|
||||
except os.error:
|
||||
return False
|
||||
return stat.S_ISREG(st[stat.ST_MODE])
|
||||
return stat.S_ISREG(st.st_mode)
|
||||
|
||||
|
||||
# Is a path a mount point? Either a root (with or without drive letter)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue