mirror of
https://github.com/python/cpython.git
synced 2025-10-19 16:03:42 +00:00
gh-136437: Make several functions in os.path
pos-only (#136949)
This commit is contained in:
parent
e41c1ce585
commit
99cdf1deb6
5 changed files with 51 additions and 147 deletions
|
@ -81,28 +81,28 @@ def isdevdrive(path):
|
|||
return False
|
||||
|
||||
|
||||
def getsize(filename):
|
||||
def getsize(filename, /):
|
||||
"""Return the size of a file, reported by os.stat()."""
|
||||
return os.stat(filename).st_size
|
||||
|
||||
|
||||
def getmtime(filename):
|
||||
def getmtime(filename, /):
|
||||
"""Return the last modification time of a file, reported by os.stat()."""
|
||||
return os.stat(filename).st_mtime
|
||||
|
||||
|
||||
def getatime(filename):
|
||||
def getatime(filename, /):
|
||||
"""Return the last access time of a file, reported by os.stat()."""
|
||||
return os.stat(filename).st_atime
|
||||
|
||||
|
||||
def getctime(filename):
|
||||
def getctime(filename, /):
|
||||
"""Return the metadata change time of a file, reported by os.stat()."""
|
||||
return os.stat(filename).st_ctime
|
||||
|
||||
|
||||
# Return the longest prefix of all list elements.
|
||||
def commonprefix(m):
|
||||
def commonprefix(m, /):
|
||||
"Given a list of pathnames, returns the longest common leading component"
|
||||
if not m: return ''
|
||||
# Some people pass in a list of pathname parts to operate in an OS-agnostic
|
||||
|
@ -120,14 +120,14 @@ def commonprefix(m):
|
|||
|
||||
# Are two stat buffers (obtained from stat, fstat or lstat)
|
||||
# describing the same file?
|
||||
def samestat(s1, s2):
|
||||
def samestat(s1, s2, /):
|
||||
"""Test whether two stat buffers reference the same file"""
|
||||
return (s1.st_ino == s2.st_ino and
|
||||
s1.st_dev == s2.st_dev)
|
||||
|
||||
|
||||
# Are two filenames really pointing to the same file?
|
||||
def samefile(f1, f2):
|
||||
def samefile(f1, f2, /):
|
||||
"""Test whether two pathnames reference the same actual file or directory
|
||||
|
||||
This is determined by the device number and i-node number and
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue