flake8 beautifications

This commit is contained in:
Alexander 'Leo' Bergolth 2016-12-21 16:40:07 +01:00
parent e4283f86dd
commit 3fdc631064
3 changed files with 4 additions and 5 deletions

View File

@ -895,7 +895,7 @@ class Archiver:
helptext = collections.OrderedDict()
helptext['patterns'] = textwrap.dedent('''
File patterns support four separate styles, fnmatch, shell, regular
expressions and path prefixes. By default, fnmatch is used for
expressions and path prefixes. By default, fnmatch is used for
`--exclude` patterns and shell-style is used for `--pattern`. If followed
by a colon (':') the first two characters of a pattern are used as a
style selector. Explicit style selection is necessary when a

View File

@ -518,6 +518,7 @@ _PATTERN_STYLE_BY_PREFIX = dict((i.PREFIX, i) for i in _PATTERN_STYLES)
InclExclPattern = namedtuple('InclExclPattern', 'pattern ptype')
RootPath = object()
def parse_pattern(pattern, fallback=FnmatchPattern):
"""Read pattern from string and return an instance of the appropriate implementation class.
"""

View File

@ -462,7 +462,6 @@ def test_exclude_patterns_from_file(tmpdir, lines, expected):
])
def test_load_patterns_from_file(tmpdir, lines, expected_roots, expected_numpatterns):
def evaluate(filename):
matcher = PatternMatcher(fallback=True)
roots, inclexclpatterns = load_patterns(open(filename, "rt"))
return roots, len(inclexclpatterns)
patternfile = tmpdir.join("exclude.txt")
@ -476,8 +475,8 @@ def test_load_patterns_from_file(tmpdir, lines, expected_roots, expected_numpatt
@pytest.mark.parametrize("lines", [
(["X /data"]), # illegal pattern type prefix
(["/data"]), # need a pattern type prefix
(["X /data"]), # illegal pattern type prefix
(["/data"]), # need a pattern type prefix
])
def test_load_invalid_patterns_from_file(tmpdir, lines):
patternfile = tmpdir.join("exclude.txt")
@ -485,7 +484,6 @@ def test_load_invalid_patterns_from_file(tmpdir, lines):
fh.write("\n".join(lines))
filename = str(patternfile)
with pytest.raises(argparse.ArgumentTypeError):
matcher = PatternMatcher(fallback=True)
roots, inclexclpatterns = load_patterns(open(filename, "rt"))