diff options
| author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2024-07-14 23:17:26 (GMT) |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-07-14 23:17:26 (GMT) |
| commit | 55ff124b9c724cfcadd65195b7531279ed8cb170 (patch) | |
| tree | bd0cd613cd80206e07032e689c48f638a0597409 /Lib/filecmp.py | |
| parent | da58e93e4c0a3c6974eeff12d6d92b805a283e8a (diff) | |
| download | cpython-55ff124b9c724cfcadd65195b7531279ed8cb170.zip cpython-55ff124b9c724cfcadd65195b7531279ed8cb170.tar.gz cpython-55ff124b9c724cfcadd65195b7531279ed8cb170.tar.bz2 | |
[3.13] gh-57141: Make shallow argument to filecmp.dircmp keyword-only (GH-121767) (#121777)
It is our general practice to make new optional parameters keyword-only,
even if the existing parameters are all positional-or-keyword. Passing
this parameter as positional would look confusing and could be error-prone
if additional parameters are added in the future.
(cherry picked from commit 50eec501fef46f0887df6f2f47d74f4defb35515)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Diffstat (limited to 'Lib/filecmp.py')
| -rw-r--r-- | Lib/filecmp.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Lib/filecmp.py b/Lib/filecmp.py index 6ffc71f..020ea69 100644 --- a/Lib/filecmp.py +++ b/Lib/filecmp.py @@ -88,7 +88,7 @@ def _do_cmp(f1, f2): class dircmp: """A class that manages the comparison of 2 directories. - dircmp(a, b, ignore=None, hide=None, shallow=True) + dircmp(a, b, ignore=None, hide=None, *, shallow=True) A and B are directories. IGNORE is a list of names to ignore, defaults to DEFAULT_IGNORES. @@ -124,7 +124,7 @@ class dircmp: in common_dirs. """ - def __init__(self, a, b, ignore=None, hide=None, shallow=True): # Initialize + def __init__(self, a, b, ignore=None, hide=None, *, shallow=True): # Initialize self.left = a self.right = b if hide is None: @@ -201,7 +201,7 @@ class dircmp: a_x = os.path.join(self.left, x) b_x = os.path.join(self.right, x) self.subdirs[x] = self.__class__(a_x, b_x, self.ignore, self.hide, - self.shallow) + shallow=self.shallow) def phase4_closure(self): # Recursively call phase4() on subdirectories self.phase4() |
