mirror of
https://github.com/borgbackup/borg.git
synced 2024-12-25 09:19:31 +00:00
Code cleanup
This commit is contained in:
parent
5cb2d80cb5
commit
7e288c0b5c
2 changed files with 18 additions and 16 deletions
|
@ -8,25 +8,13 @@
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
import msgpack
|
import msgpack
|
||||||
from chunkifier import chunkify
|
from .chunkifier import chunkify
|
||||||
from cache import Cache, NS_ARCHIVES, NS_CHUNKS
|
from .cache import Cache, NS_ARCHIVES, NS_CHUNKS
|
||||||
from bandstore import BandStore
|
from .bandstore import BandStore
|
||||||
from helpers import location_validator, pretty_size
|
from .helpers import location_validator, pretty_size, LevelFilter
|
||||||
|
|
||||||
CHUNK_SIZE = 55001
|
CHUNK_SIZE = 55001
|
||||||
|
|
||||||
class LevelFilter(logging.Filter):
|
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
|
||||||
logging.Filter.__init__(self, *args, **kwargs)
|
|
||||||
self.count = {}
|
|
||||||
|
|
||||||
def filter(self, record):
|
|
||||||
self.count.setdefault(record.levelname, 0)
|
|
||||||
self.count[record.levelname] += 1
|
|
||||||
return record
|
|
||||||
|
|
||||||
|
|
||||||
class Archive(object):
|
class Archive(object):
|
||||||
|
|
||||||
def __init__(self, store, cache, name=None):
|
def __init__(self, store, cache, name=None):
|
||||||
|
|
|
@ -1,7 +1,21 @@
|
||||||
|
import logging
|
||||||
import argparse
|
import argparse
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
|
||||||
|
class LevelFilter(logging.Filter):
|
||||||
|
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
logging.Filter.__init__(self, *args, **kwargs)
|
||||||
|
self.count = {}
|
||||||
|
|
||||||
|
def filter(self, record):
|
||||||
|
self.count.setdefault(record.levelname, 0)
|
||||||
|
self.count[record.levelname] += 1
|
||||||
|
return record
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Location(object):
|
class Location(object):
|
||||||
|
|
||||||
loc_re = re.compile(r'^((?:(?P<user>[^@]+)@)?(?P<host>[^:]+):)?'
|
loc_re = re.compile(r'^((?:(?P<user>[^@]+)@)?(?P<host>[^:]+):)?'
|
||||||
|
|
Loading…
Reference in a new issue