aboutsummaryrefslogtreecommitdiffstats
path: root/netlib/utils.py
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2016-10-20 09:35:55 +1300
committerAldo Cortesi <aldo@nullcube.com>2016-10-20 09:35:55 +1300
commit069119364d6490e52ba26f2d8001c6b2bf50ab7b (patch)
treea6308ebd4d1337db08784295eba328a8e8f05514 /netlib/utils.py
parent7440232f6036bb29d1c142cd32a9bb27458b30d1 (diff)
downloadmitmproxy-069119364d6490e52ba26f2d8001c6b2bf50ab7b.tar.gz
mitmproxy-069119364d6490e52ba26f2d8001c6b2bf50ab7b.tar.bz2
mitmproxy-069119364d6490e52ba26f2d8001c6b2bf50ab7b.zip
Create mitmproxy.utils hierarchy
- Add mitproxy.utils.lrucache, mitproxy.utils.data
Diffstat (limited to 'netlib/utils.py')
-rw-r--r--netlib/utils.py30
1 files changed, 0 insertions, 30 deletions
diff --git a/netlib/utils.py b/netlib/utils.py
index 8cd9ba6e..12b94d74 100644
--- a/netlib/utils.py
+++ b/netlib/utils.py
@@ -1,7 +1,4 @@
-import os.path
import re
-import importlib
-import inspect
def setbit(byte, offset, value):
@@ -48,33 +45,6 @@ class BiDi:
return self.values.get(n, default)
-class Data:
-
- def __init__(self, name):
- m = importlib.import_module(name)
- dirname = os.path.dirname(inspect.getsourcefile(m))
- self.dirname = os.path.abspath(dirname)
-
- def push(self, subpath):
- """
- Change the data object to a path relative to the module.
- """
- self.dirname = os.path.join(self.dirname, subpath)
- return self
-
- 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
-
-
_label_valid = re.compile(b"(?!-)[A-Z\d-]{1,63}(?<!-)$", re.IGNORECASE)