diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2015-05-30 12:03:13 +1200 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2015-05-30 12:03:13 +1200 |
commit | 4ed5043c67848bf717e48bc509d959422c8faeb6 (patch) | |
tree | 92abe731c72d34bf6b43cbe1ecb46939953a6860 /libpathod/utils.py | |
parent | 904760c6c2927caf49b7cbe4027dd1c8dd8e9fdb (diff) | |
download | mitmproxy-4ed5043c67848bf717e48bc509d959422c8faeb6.tar.gz mitmproxy-4ed5043c67848bf717e48bc509d959422c8faeb6.tar.bz2 mitmproxy-4ed5043c67848bf717e48bc509d959422c8faeb6.zip |
Add coding style check, reformat.
Diffstat (limited to 'libpathod/utils.py')
-rw-r--r-- | libpathod/utils.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/libpathod/utils.py b/libpathod/utils.py index e1ec013f..dd0ae425 100644 --- a/libpathod/utils.py +++ b/libpathod/utils.py @@ -22,6 +22,7 @@ class MemBool: """ Truth-checking with a memory, for use in chained if statements. """ + def __init__(self): self.v = None @@ -95,18 +96,19 @@ class Data: """ fullpath = os.path.join(self.dirname, path) if not os.path.exists(fullpath): - raise ValueError, "dataPath: %s does not exist."%fullpath + raise ValueError("dataPath: %s does not exist." % fullpath) return fullpath data = Data(__name__) -def daemonize(stdin='/dev/null', stdout='/dev/null', stderr='/dev/null'): # pragma: nocover + +def daemonize(stdin='/dev/null', stdout='/dev/null', stderr='/dev/null'): # pragma: nocover try: pid = os.fork() if pid > 0: sys.exit(0) - except OSError, e: + except OSError as e: sys.stderr.write("fork #1 failed: (%d) %s\n" % (e.errno, e.strerror)) sys.exit(1) os.chdir("/") @@ -116,7 +118,7 @@ def daemonize(stdin='/dev/null', stdout='/dev/null', stderr='/dev/null'): # prag pid = os.fork() if pid > 0: sys.exit(0) - except OSError, e: + except OSError as e: sys.stderr.write("fork #2 failed: (%d) %s\n" % (e.errno, e.strerror)) sys.exit(1) si = open(stdin, 'rb') |