aboutsummaryrefslogtreecommitdiffstats
path: root/libpathod/utils.py
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2013-01-05 15:25:09 +1300
committerAldo Cortesi <aldo@nullcube.com>2013-01-05 15:25:09 +1300
commit3886ccae9379d065e54e0eb7e961992ff3c0ee62 (patch)
tree33db7b5c057f508ce02aebac562e58fecfe7ddf2 /libpathod/utils.py
parentd7f641c6ee1033232110c9b42c3b48cc5b719520 (diff)
downloadmitmproxy-3886ccae9379d065e54e0eb7e961992ff3c0ee62.tar.gz
mitmproxy-3886ccae9379d065e54e0eb7e961992ff3c0ee62.tar.bz2
mitmproxy-3886ccae9379d065e54e0eb7e961992ff3c0ee62.zip
Provisional proxy mode support for pathod.
Diffstat (limited to 'libpathod/utils.py')
-rw-r--r--libpathod/utils.py13
1 files changed, 13 insertions, 0 deletions
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)