From 3fdc631064490f335540e9591d83f4467cab8965 Mon Sep 17 00:00:00 2001 From: Alexander 'Leo' Bergolth Date: Wed, 21 Dec 2016 16:40:07 +0100 Subject: [PATCH] flake8 beautifications --- borg/archiver.py | 2 +- borg/helpers.py | 1 + borg/testsuite/helpers.py | 6 ++---- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/borg/archiver.py b/borg/archiver.py index 3264b1b4a..3cda6c0aa 100644 --- a/borg/archiver.py +++ b/borg/archiver.py @@ -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 diff --git a/borg/helpers.py b/borg/helpers.py index bef4cf2a2..303f91f8f 100644 --- a/borg/helpers.py +++ b/borg/helpers.py @@ -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. """ diff --git a/borg/testsuite/helpers.py b/borg/testsuite/helpers.py index ae02754da..1d4bc2520 100644 --- a/borg/testsuite/helpers.py +++ b/borg/testsuite/helpers.py @@ -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"))