mirror of
https://github.com/python/cpython.git
synced 2025-09-27 18:59:43 +00:00
Removed deprecated use_statcache argument.
This commit is contained in:
parent
664347be94
commit
f3fa9460de
3 changed files with 8 additions and 16 deletions
|
@ -11,13 +11,12 @@ directories, with various optional time/correctness trade-offs.
|
||||||
|
|
||||||
The \module{filecmp} module defines the following functions:
|
The \module{filecmp} module defines the following functions:
|
||||||
|
|
||||||
\begin{funcdesc}{cmp}{f1, f2\optional{, shallow\optional{, use_statcache}}}
|
\begin{funcdesc}{cmp}{f1, f2\optional{, shallow}}
|
||||||
Compare the files named \var{f1} and \var{f2}, returning \code{True} if
|
Compare the files named \var{f1} and \var{f2}, returning \code{True} if
|
||||||
they seem equal, \code{False} otherwise.
|
they seem equal, \code{False} otherwise.
|
||||||
|
|
||||||
Unless \var{shallow} is given and is false, files with identical
|
Unless \var{shallow} is given and is false, files with identical
|
||||||
\function{os.stat()} signatures are taken to be equal.
|
\function{os.stat()} signatures are taken to be equal.
|
||||||
\versionchanged[\var{use_statcache} is obsolete and ignored.]{2.3}
|
|
||||||
|
|
||||||
Files that were compared using this function will not be compared again
|
Files that were compared using this function will not be compared again
|
||||||
unless their \function{os.stat()} signature changes.
|
unless their \function{os.stat()} signature changes.
|
||||||
|
@ -27,7 +26,7 @@ portability and efficiency.
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
\begin{funcdesc}{cmpfiles}{dir1, dir2, common\optional{,
|
\begin{funcdesc}{cmpfiles}{dir1, dir2, common\optional{,
|
||||||
shallow\optional{, use_statcache}}}
|
shallow}}
|
||||||
Returns three lists of file names: \var{match}, \var{mismatch},
|
Returns three lists of file names: \var{match}, \var{mismatch},
|
||||||
\var{errors}. \var{match} contains the list of files match in both
|
\var{errors}. \var{match} contains the list of files match in both
|
||||||
directories, \var{mismatch} includes the names of those that don't,
|
directories, \var{mismatch} includes the names of those that don't,
|
||||||
|
@ -37,8 +36,8 @@ lack permission to read them or many other reasons, but always that
|
||||||
the comparison could not be done for some reason.
|
the comparison could not be done for some reason.
|
||||||
|
|
||||||
The \var{common} parameter is a list of file names found in both directories.
|
The \var{common} parameter is a list of file names found in both directories.
|
||||||
The \var{shallow} and \var{use_statcache} parameters have the same
|
The \var{shallow} parameter has the same
|
||||||
meanings and default values as for \function{filecmp.cmp()}.
|
meaning and default value as for \function{filecmp.cmp()}.
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
|
@ -19,7 +19,7 @@ __all__ = ["cmp","dircmp","cmpfiles"]
|
||||||
_cache = {}
|
_cache = {}
|
||||||
BUFSIZE=8*1024
|
BUFSIZE=8*1024
|
||||||
|
|
||||||
def cmp(f1, f2, shallow=1, use_statcache=None):
|
def cmp(f1, f2, shallow=1):
|
||||||
"""Compare two files.
|
"""Compare two files.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
|
@ -31,8 +31,6 @@ def cmp(f1, f2, shallow=1, use_statcache=None):
|
||||||
shallow -- Just check stat signature (do not read the files).
|
shallow -- Just check stat signature (do not read the files).
|
||||||
defaults to 1.
|
defaults to 1.
|
||||||
|
|
||||||
use_statcache -- obsolete argument.
|
|
||||||
|
|
||||||
Return value:
|
Return value:
|
||||||
|
|
||||||
True if the files are the same, False otherwise.
|
True if the files are the same, False otherwise.
|
||||||
|
@ -41,9 +39,6 @@ def cmp(f1, f2, shallow=1, use_statcache=None):
|
||||||
with a cache invalidation mechanism relying on stale signatures.
|
with a cache invalidation mechanism relying on stale signatures.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
if use_statcache is not None:
|
|
||||||
warnings.warn("use_statcache argument is deprecated",
|
|
||||||
DeprecationWarning)
|
|
||||||
|
|
||||||
s1 = _sig(os.stat(f1))
|
s1 = _sig(os.stat(f1))
|
||||||
s2 = _sig(os.stat(f2))
|
s2 = _sig(os.stat(f2))
|
||||||
|
@ -244,13 +239,12 @@ class dircmp:
|
||||||
self.methodmap[attr](self)
|
self.methodmap[attr](self)
|
||||||
return getattr(self, attr)
|
return getattr(self, attr)
|
||||||
|
|
||||||
def cmpfiles(a, b, common, shallow=1, use_statcache=None):
|
def cmpfiles(a, b, common, shallow=1):
|
||||||
"""Compare common files in two directories.
|
"""Compare common files in two directories.
|
||||||
|
|
||||||
a, b -- directory names
|
a, b -- directory names
|
||||||
common -- list of file names found in both directories
|
common -- list of file names found in both directories
|
||||||
shallow -- if true, do comparison based solely on stat() information
|
shallow -- if true, do comparison based solely on stat() information
|
||||||
use_statcache -- obsolete argument
|
|
||||||
|
|
||||||
Returns a tuple of three lists:
|
Returns a tuple of three lists:
|
||||||
files that compare equal
|
files that compare equal
|
||||||
|
@ -258,9 +252,6 @@ def cmpfiles(a, b, common, shallow=1, use_statcache=None):
|
||||||
filenames that aren't regular files.
|
filenames that aren't regular files.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
if use_statcache is not None:
|
|
||||||
warnings.warn("use_statcache argument is deprecated",
|
|
||||||
DeprecationWarning)
|
|
||||||
res = ([], [], [])
|
res = ([], [], [])
|
||||||
for x in common:
|
for x in common:
|
||||||
ax = os.path.join(a, x)
|
ax = os.path.join(a, x)
|
||||||
|
|
|
@ -21,6 +21,8 @@ Extension Modules
|
||||||
Library
|
Library
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
- the filecmp module no longer uses the deprecated use_statcache argument.
|
||||||
|
|
||||||
- unittest.TestCase.run() and unittest.TestSuite.run() can now be successfully
|
- unittest.TestCase.run() and unittest.TestSuite.run() can now be successfully
|
||||||
extended or overridden by subclasses. Formerly, the subclassed method would
|
extended or overridden by subclasses. Formerly, the subclassed method would
|
||||||
be ignored by the rest of the module. (Bug #1078905).
|
be ignored by the rest of the module. (Bug #1078905).
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue