mirror of https://github.com/borgbackup/borg.git
flake8 beautifications
This commit is contained in:
parent
e4283f86dd
commit
3fdc631064
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
"""
|
||||
|
|
|
@ -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"))
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue