aboutsummaryrefslogtreecommitdiffstats
path: root/pathod/utils.py
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2016-05-21 11:53:14 +1200
committerAldo Cortesi <aldo@nullcube.com>2016-05-21 11:53:14 +1200
commit123e3b130c87e53092a4f8c66effc8605298e1d0 (patch)
treef1d7325e37bcee8cc69ff06dd0e0df7610d7e0cb /pathod/utils.py
parent84144ca0c635f4a42c8ba8a13e779fe127a81d45 (diff)
downloadmitmproxy-123e3b130c87e53092a4f8c66effc8605298e1d0.tar.gz
mitmproxy-123e3b130c87e53092a4f8c66effc8605298e1d0.tar.bz2
mitmproxy-123e3b130c87e53092a4f8c66effc8605298e1d0.zip
We don't need 3 slightly different implementations of Data
Diffstat (limited to 'pathod/utils.py')
-rw-r--r--pathod/utils.py23
1 files changed, 2 insertions, 21 deletions
diff --git a/pathod/utils.py b/pathod/utils.py
index 1e5bd9a4..d1e2dd00 100644
--- a/pathod/utils.py
+++ b/pathod/utils.py
@@ -1,5 +1,6 @@
import os
import sys
+import netlib.utils
SIZE_UNITS = dict(
@@ -75,27 +76,7 @@ def escape_unprintables(s):
return s
-class Data(object):
-
- def __init__(self, name):
- m = __import__(name)
- dirname, _ = os.path.split(m.__file__)
- self.dirname = os.path.abspath(dirname)
-
- def path(self, path):
- """
- Returns a path to the package data housed at 'path' under this
- module.Path can be a path to a file, or to a directory.
-
- This function will raise ValueError if the path does not exist.
- """
- fullpath = os.path.join(self.dirname, path)
- if not os.path.exists(fullpath):
- raise ValueError("dataPath: %s does not exist." % fullpath)
- return fullpath
-
-
-data = Data(__name__)
+data = netlib.utils.Data(__name__)
def daemonize(stdin='/dev/null', stdout='/dev/null', stderr='/dev/null'): # pragma: no cover