From bd7cc38d6e567c4717f9a35a2331fb57dc91b809 Mon Sep 17 00:00:00 2001 From: Frank Sachsenheim Date: Thu, 1 Sep 2016 17:36:37 +0200 Subject: [PATCH] Changes arg processor names to camelcase --- src/borg/archiver.py | 18 +++++++++--------- src/borg/helpers.py | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/borg/archiver.py b/src/borg/archiver.py index 39bc37ce9..66a2e62d5 100644 --- a/src/borg/archiver.py +++ b/src/borg/archiver.py @@ -30,7 +30,7 @@ from .constants import * # NOQA from .helpers import EXIT_SUCCESS, EXIT_WARNING, EXIT_ERROR from .helpers import Error, NoManifestError from .helpers import location_validator, archivename_validator, ChunkerParams, CompressionSpec -from .helpers import prefix_spec, sort_by_spec, HUMAN_SORT_KEYS +from .helpers import PrefixSpec, SortBySpec, HUMAN_SORT_KEYS from .helpers import BaseFormatter, ItemFormatter, ArchiveFormatter, format_time, format_file_size, format_archive from .helpers import safe_encode, remove_surrogates, bin_to_hex from .helpers import prune_within, prune_split @@ -1656,7 +1656,7 @@ class Archiver: subparser.add_argument('--last', dest='last', type=int, default=None, metavar='N', help='only check last N archives (Default: all)') - subparser.add_argument('-P', '--prefix', dest='prefix', type=prefix_spec, + subparser.add_argument('-P', '--prefix', dest='prefix', type=PrefixSpec, help='only consider archive names starting with this prefix') subparser.add_argument('-p', '--progress', dest='progress', action='store_true', default=False, @@ -2213,7 +2213,7 @@ class Archiver: help='number of monthly archives to keep') subparser.add_argument('-y', '--keep-yearly', dest='yearly', type=int, default=0, help='number of yearly archives to keep') - subparser.add_argument('-P', '--prefix', dest='prefix', type=prefix_spec, + subparser.add_argument('-P', '--prefix', dest='prefix', type=PrefixSpec, help='only consider archive names starting with this prefix') subparser.add_argument('--save-space', dest='save_space', action='store_true', default=False, @@ -2606,19 +2606,19 @@ class Archiver: @staticmethod def add_archives_filters_args(subparser): filters_group = subparser.add_argument_group('filters', 'Archive filters can be applied to repository targets.') - filters_group.add_argument('-P', '--prefix', dest='prefix', type=prefix_spec, default='', + filters_group.add_argument('-P', '--prefix', dest='prefix', type=PrefixSpec, default='', help='only consider archive names starting with this prefix') sort_by_default = 'timestamp' - filters_group.add_argument('--sort-by', dest='sort_by', type=sort_by_spec, default=sort_by_default, - help='Comma-separated list of sorting keys; valid keys are: {}; default is: {}' - .format(', '.join(HUMAN_SORT_KEYS), sort_by_default)) + filters_group.add_argument('--sort-by', dest='sort_by', type=SortBySpec, default=sort_by_default, + help='Comma-separated list of sorting keys; valid keys are: {}; default is: {}' + .format(', '.join(HUMAN_SORT_KEYS), sort_by_default)) group = filters_group.add_mutually_exclusive_group() group.add_argument('--first', dest='first', metavar='N', default=0, type=int, - help='select first N archives') + help='consider first N archives after other filter args were applied') group.add_argument('--last', dest='last', metavar='N', default=0, type=int, - help='delete last N archives') + help='consider last N archives after other filter args were applied') def get_args(self, argv, cmd): """usually, just returns argv, except if we deal with a ssh forced command for borg serve.""" diff --git a/src/borg/helpers.py b/src/borg/helpers.py index 27ce121b9..541c832eb 100644 --- a/src/borg/helpers.py +++ b/src/borg/helpers.py @@ -654,14 +654,14 @@ def replace_placeholders(text): } return format_line(text, data) -prefix_spec = replace_placeholders +PrefixSpec = replace_placeholders HUMAN_SORT_KEYS = ['timestamp'] + list(ArchiveInfo._fields) HUMAN_SORT_KEYS.remove('ts') -def sort_by_spec(text): +def SortBySpec(text): for token in text.split(','): if token not in HUMAN_SORT_KEYS: raise ValueError('Invalid sort key: %s' % token)