From 3886ccae9379d065e54e0eb7e961992ff3c0ee62 Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Sat, 5 Jan 2013 15:25:09 +1300 Subject: Provisional proxy mode support for pathod. --- libpathod/utils.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'libpathod/utils.py') diff --git a/libpathod/utils.py b/libpathod/utils.py index 70a97cff..26e9427d 100644 --- a/libpathod/utils.py +++ b/libpathod/utils.py @@ -8,6 +8,19 @@ SIZE_UNITS = dict( t = 1024**4, ) + +class MemBool: + """ + Truth-checking with a memory, for use in chained if statements. + """ + def __init__(self): + self.v = None + + def __call__(self, v): + self.v = v + return bool(v) + + def parse_size(s): try: return int(s) -- cgit v1.2.3