Skip to content

Commit a9f51c7

Browse files
committed
Address review
1 parent 4f64f8f commit a9f51c7

File tree

5 files changed

+16
-16
lines changed

5 files changed

+16
-16
lines changed

Lib/genericpath.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,28 +81,28 @@ def isdevdrive(path):
8181
return False
8282

8383

84-
def getsize(filename):
84+
def getsize(filename, /):
8585
"""Return the size of a file, reported by os.stat()."""
8686
return os.stat(filename).st_size
8787

8888

89-
def getmtime(filename):
89+
def getmtime(filename, /):
9090
"""Return the last modification time of a file, reported by os.stat()."""
9191
return os.stat(filename).st_mtime
9292

9393

94-
def getatime(filename):
94+
def getatime(filename, /):
9595
"""Return the last access time of a file, reported by os.stat()."""
9696
return os.stat(filename).st_atime
9797

9898

99-
def getctime(filename):
99+
def getctime(filename, /):
100100
"""Return the metadata change time of a file, reported by os.stat()."""
101101
return os.stat(filename).st_ctime
102102

103103

104104
# Return the longest prefix of all list elements.
105-
def commonprefix(m):
105+
def commonprefix(m, /):
106106
"Given a list of pathnames, returns the longest common leading component"
107107
if not m: return ''
108108
# Some people pass in a list of pathname parts to operate in an OS-agnostic
@@ -120,14 +120,14 @@ def commonprefix(m):
120120

121121
# Are two stat buffers (obtained from stat, fstat or lstat)
122122
# describing the same file?
123-
def samestat(s1, s2):
123+
def samestat(s1, s2, /):
124124
"""Test whether two stat buffers reference the same file"""
125125
return (s1.st_ino == s2.st_ino and
126126
s1.st_dev == s2.st_dev)
127127

128128

129129
# Are two filenames really pointing to the same file?
130-
def samefile(f1, f2):
130+
def samefile(f1, f2, /):
131131
"""Test whether two pathnames reference the same actual file or directory
132132
133133
This is determined by the device number and i-node number and

Lib/ntpath.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def isabs(s, /):
9696

9797

9898
# Join two (or more) paths.
99-
def join(path, *paths):
99+
def join(path, /, *paths):
100100
path = os.fspath(path)
101101
if isinstance(path, bytes):
102102
sep = b'\\'
@@ -601,7 +601,7 @@ def abspath(path):
601601
from nt import _findfirstfile, _getfinalpathname, readlink as _nt_readlink
602602
except ImportError:
603603
# realpath is a no-op on systems without _getfinalpathname support.
604-
def realpath(path, *, strict=False):
604+
def realpath(path, /, *, strict=False):
605605
return abspath(path)
606606
else:
607607
def _readlink_deep(path, ignored_error=OSError):
@@ -702,7 +702,7 @@ def _getfinalpathname_nonstrict(path, ignored_error=OSError):
702702
tail = join(name, tail) if tail else name
703703
return tail
704704

705-
def realpath(path, *, strict=False):
705+
def realpath(path, /, *, strict=False):
706706
path = normpath(path)
707707
if isinstance(path, bytes):
708708
prefix = b'\\\\?\\'

Lib/posixpath.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def isabs(s, /):
6969
# Ignore the previous parts if a part is absolute.
7070
# Insert a '/' unless the first part is empty or already ends in '/'.
7171

72-
def join(a, *p):
72+
def join(a, /, *p):
7373
"""Join two or more pathname components, inserting '/' as needed.
7474
If any component is an absolute path, all previous path components
7575
will be discarded. An empty last part will result in a path that
@@ -388,7 +388,7 @@ def abspath(path):
388388
# Return a canonical path (i.e. the absolute location of a file on the
389389
# filesystem).
390390

391-
def realpath(filename, *, strict=False):
391+
def realpath(filename, /, *, strict=False):
392392
"""Return the canonical path of the specified filename, eliminating any
393393
symbolic links encountered in the path."""
394394
filename = os.fspath(filename)

Modules/clinic/posixmodule.c.h

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/posixmodule.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5535,7 +5535,7 @@ os__path_lexists_impl(PyObject *module, path_t *path)
55355535
/*[clinic input]
55365536
os._path_isdir -> bool
55375537
5538-
s as path: path_t(allow_fd=True, suppress_value_error=True),
5538+
path: path_t(allow_fd=True, suppress_value_error=True),
55395539
/
55405540
55415541
Return true if the pathname refers to an existing directory.
@@ -5544,7 +5544,7 @@ Return true if the pathname refers to an existing directory.
55445544

55455545
static int
55465546
os__path_isdir_impl(PyObject *module, path_t *path)
5547-
/*[clinic end generated code: output=d5786196f9e2fa7a input=6d3c18234e720b19]*/
5547+
/*[clinic end generated code: output=d5786196f9e2fa7a input=0d3fd790564d244b]*/
55485548
{
55495549
return _testFileType(path, PY_IFDIR);
55505550
}

0 commit comments

Comments
 (0)