diff Lib/macpath.py @ 23625:65cf478950ff legacy-trunk

Replaced obsolete stat module constants with equivalent attributes
author Raymond Hettinger <python@rcn.com>
date Sat, 01 Jun 2002 19:51:15 +0000
parents a90faa5f9417
children 4a825b902310
line wrap: on
line diff
--- a/Lib/macpath.py	Sat Jun 01 16:07:16 2002 +0000
+++ b/Lib/macpath.py	Sat Jun 01 19:51:15 2002 +0000
@@ -100,25 +100,22 @@
         st = os.stat(s)
     except os.error:
         return 0
-    return S_ISDIR(st[ST_MODE])
+    return S_ISDIR(st.st_mode)
 
 
 # Get size, mtime, atime of files.
 
 def getsize(filename):
     """Return the size of a file, reported by os.stat()."""
-    st = os.stat(filename)
-    return st[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[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[ST_ATIME]
+    return os.stat(filename).st_atime
 
 
 def islink(s):
@@ -138,7 +135,7 @@
         st = os.stat(s)
     except os.error:
         return False
-    return S_ISREG(st[ST_MODE])
+    return S_ISREG(st.st_mode)
 
 
 def exists(s):