Add a cache for get_event

This commit is contained in:
Mark Haines 2015-02-11 15:01:15 +00:00
parent d8324d5a2b
commit f5a70e0d2e
6 changed files with 43 additions and 5 deletions

View file

@ -27,6 +27,16 @@ class Config(object):
def __init__(self, args):
pass
@staticmethod
def parse_size(string):
sizes = {"K": 1024, "M": 1024 * 1024}
size = 1
suffix = string[-1]
if suffix in sizes:
string = string[:-1]
size = sizes[suffix]
return int(string) * size
@staticmethod
def abspath(file_path):
return os.path.abspath(file_path) if file_path else file_path