File tree Expand file tree Collapse file tree 4 files changed +12
-10
lines changed
Expand file tree Collapse file tree 4 files changed +12
-10
lines changed Original file line number Diff line number Diff line change @@ -117,13 +117,13 @@ the :mod:`glob` module.)
117117 >>> os.path.commonpath(['/usr/lib', '/usr/local/lib'])
118118 '/usr'
119119
120- .. versionchanged :: 3.15
121- Deprecated in favor of :func: `os.path.commonpath ` for path prefixes and
122- :func: `string.commonprefix ` for string prefixes.
123-
124120 .. versionchanged :: 3.6
125121 Accepts a :term: `path-like object `.
126122
123+ .. deprecated :: next
124+ Deprecated in favor of :func: `os.path.commonpath ` for path prefixes and
125+ :func: `string.commonprefix ` for string prefixes.
126+
127127
128128.. function :: dirname(path, /)
129129
Original file line number Diff line number Diff line change @@ -994,9 +994,9 @@ Helper functions
994994.. function :: commonprefix(list, /)
995995
996996 Return the longest string prefix (taken character-by-character) that is a
997- prefix of all string in *list *. If *list * is empty, return the empty string
998- (``'' ``).
997+ prefix of all the strings in *list *. If *list * is empty, return the empty
998+ string (``'' ``).
999999
1000- .. versionadded :: 3.15
1000+ .. versionadded :: next
10011001
10021002 Moved to the :mod: `string ` module from the :mod: `os.path ` module.
Original file line number Diff line number Diff line change @@ -107,7 +107,8 @@ def commonprefix(m, /):
107107 "Given a list of pathnames, returns the longest common leading component"
108108 import warnings
109109 warnings .warn ('os.path.commonprefix() is deprecated. Use '
110- 'os.path.commonpath() or string.commonprefix() instead.' ,
110+ 'os.path.commonpath() for longest path prefix, or '
111+ 'string.commonprefix() for longest string prefix.' ,
111112 category = DeprecationWarning ,
112113 stacklevel = 2 )
113114 import string
Original file line number Diff line number Diff line change @@ -49,8 +49,9 @@ def capwords(s, sep=None):
4949
5050
5151def commonprefix (m , / ):
52- "Given a list of strings, returns the longest common leading component"
53- if not m : return ''
52+ """Given a list of strings, returns the longest common leading component."""
53+ if not m :
54+ return ''
5455 # Note that previously this function was in the 'os.path' module, hence the
5556 # handling for paths. Maintain compatibility so users have a 1-to-1 drop-in.
5657 # Some people pass in a list of pathname parts to operate in an OS-agnostic
You can’t perform that action at this time.
0 commit comments