소스 검색

Code cleanup

Jonas Borgström 14 년 전
부모
커밋
7e288c0b5c
2개의 변경된 파일18개의 추가작업 그리고 16개의 파일을 삭제
  1. 4 16
      dedupestore/archiver.py
  2. 14 0
      dedupestore/helpers.py

+ 4 - 16
dedupestore/archiver.py

@@ -8,25 +8,13 @@ import stat
 from datetime import datetime
 
 import msgpack
-from chunkifier import chunkify
-from cache import Cache, NS_ARCHIVES, NS_CHUNKS
-from bandstore import BandStore
-from helpers import location_validator, pretty_size
+from .chunkifier import chunkify
+from .cache import Cache, NS_ARCHIVES, NS_CHUNKS
+from .bandstore import BandStore
+from .helpers import location_validator, pretty_size, LevelFilter
 
 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):
 
     def __init__(self, store, cache, name=None):

+ 14 - 0
dedupestore/helpers.py

@@ -1,7 +1,21 @@
+import logging
 import argparse
 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):
 
     loc_re = re.compile(r'^((?:(?P<user>[^@]+)@)?(?P<host>[^:]+):)?'