mirror of
https://github.com/borgbackup/borg.git
synced 2024-12-26 17:57:59 +00:00
parseformat: unnecessary calls removed (#5169)
parseformat: unnecessary calls removed also: list item formatter: remove add_key because only use was in the constructor
This commit is contained in:
parent
08a12cc405
commit
9019b48fd5
1 changed files with 1 additions and 5 deletions
|
@ -764,16 +764,12 @@ def __init__(self, archive, format, *, json_lines=False):
|
||||||
'atime': partial(self.format_time, 'atime'),
|
'atime': partial(self.format_time, 'atime'),
|
||||||
}
|
}
|
||||||
for hash_function in self.hash_algorithms:
|
for hash_function in self.hash_algorithms:
|
||||||
self.add_key(hash_function, partial(self.hash_item, hash_function))
|
self.call_keys[hash_function] = partial(self.hash_item, hash_function)
|
||||||
self.used_call_keys = set(self.call_keys) & self.format_keys
|
self.used_call_keys = set(self.call_keys) & self.format_keys
|
||||||
|
|
||||||
def format_item_json(self, item):
|
def format_item_json(self, item):
|
||||||
return json.dumps(self.get_item_data(item), cls=BorgJsonEncoder) + '\n'
|
return json.dumps(self.get_item_data(item), cls=BorgJsonEncoder) + '\n'
|
||||||
|
|
||||||
def add_key(self, key, callable_with_item):
|
|
||||||
self.call_keys[key] = callable_with_item
|
|
||||||
self.used_call_keys = set(self.call_keys) & self.format_keys
|
|
||||||
|
|
||||||
def get_item_data(self, item):
|
def get_item_data(self, item):
|
||||||
item_data = {}
|
item_data = {}
|
||||||
item_data.update(self.item_data)
|
item_data.update(self.item_data)
|
||||||
|
|
Loading…
Reference in a new issue