FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

bpo-42958: Align docstring and filecmp.cmp() for shallow compare by AlexVndnblcke · Pull Request #24246 · python/cpython · GitHub

Repository navigation

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (1) .rst  (2) All 2 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
9 changes: 7 additions & 2 deletions Doc/library/filecmp.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,13 @@ The :mod:`filecmp` module defines the following functions:
Compare the files named *f1* and *f2*, returning ``True`` if they seem equal,
``False`` otherwise.

If *shallow* is true, files with identical :func:`os.stat` signatures are
taken to be equal. Otherwise, the contents of the files are compared.
If *shallow* is true, files with identical :func:`os.stat` signatures (file
type, size and modification time) are taken to be equal.

If the files have a different size ``False`` will be returned.

Comparisons with ``shallow=False`` or different signatures imply that the
contents of the files are compared.

Note that no external programs are called from this function, giving it
portability and efficiency.
Expand Down
8 changes: 7 additions & 1 deletion Lib/filecmp.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,13 @@ def cmp(f1, f2, shallow=True):

f2 -- Second file name

shallow -- Just check stat signature (do not read the files).
shallow -- Check file signatures instead of contents, the
signature contains the file its mode, size and
mtime.
If the size differs, the files are considerd to be
different.
If other parts of the signature indicate that the files
differ, a deep compare is performed.
defaults to True.

Return value:
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Clarify filecmp.cmp() docstring and documentation

Back | FazBrowse Home | New Git URL