mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
Close #15442: Expand the list of default directories ignored by filecmp.dircmp and expose it as a module attribute
This commit is contained in:
parent
60a0c71031
commit
eb2884a875
4 changed files with 32 additions and 12 deletions
|
@ -13,11 +13,15 @@ import os
|
|||
import stat
|
||||
from itertools import filterfalse
|
||||
|
||||
__all__ = ["cmp", "dircmp", "cmpfiles"]
|
||||
__all__ = ['cmp', 'dircmp', 'cmpfiles', 'DEFAULT_IGNORES']
|
||||
|
||||
_cache = {}
|
||||
BUFSIZE = 8*1024
|
||||
|
||||
DEFAULT_IGNORES = [
|
||||
'RCS', 'CVS', 'tags', '.git', '.hg', '.bzr', '_darcs', '__pycache__']
|
||||
|
||||
|
||||
def cmp(f1, f2, shallow=True):
|
||||
"""Compare two files.
|
||||
|
||||
|
@ -80,7 +84,7 @@ class dircmp:
|
|||
dircmp(a, b, ignore=None, hide=None)
|
||||
A and B are directories.
|
||||
IGNORE is a list of names to ignore,
|
||||
defaults to ['RCS', 'CVS', 'tags'].
|
||||
defaults to DEFAULT_IGNORES.
|
||||
HIDE is a list of names to hide,
|
||||
defaults to [os.curdir, os.pardir].
|
||||
|
||||
|
@ -116,7 +120,7 @@ class dircmp:
|
|||
else:
|
||||
self.hide = hide
|
||||
if ignore is None:
|
||||
self.ignore = ['RCS', 'CVS', 'tags'] # Names ignored in comparison
|
||||
self.ignore = DEFAULT_IGNORES
|
||||
else:
|
||||
self.ignore = ignore
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue