add a string representation for Include/ExcludePattern

it just gives the original string that was used.
This commit is contained in:
Thomas Waldmann 2015-09-19 18:03:53 +02:00
parent 08417b52ec
commit 15b003e344
1 changed files with 8 additions and 0 deletions

View File

@ -250,6 +250,7 @@ class IncludePattern:
path match as well. A trailing slash makes no difference.
"""
def __init__(self, pattern):
self.pattern_orig = pattern
self.match_count = 0
if sys.platform in ('darwin',):
@ -267,12 +268,16 @@ class IncludePattern:
def __repr__(self):
return '%s(%s)' % (type(self), self.pattern)
def __str__(self):
return self.pattern_orig
class ExcludePattern(IncludePattern):
"""Shell glob patterns to exclude. A trailing slash means to
exclude the contents of a directory, but not the directory itself.
"""
def __init__(self, pattern):
self.pattern_orig = pattern
self.match_count = 0
if pattern.endswith(os.path.sep):
@ -297,6 +302,9 @@ class ExcludePattern(IncludePattern):
def __repr__(self):
return '%s(%s)' % (type(self), self.pattern)
def __str__(self):
return self.pattern_orig
def timestamp(s):
"""Convert a --timestamp=s argument to a datetime object"""