aboutsummaryrefslogtreecommitdiffstats
path: root/mitmproxy/optmanager.py
diff options
context:
space:
mode:
Diffstat (limited to 'mitmproxy/optmanager.py')
-rw-r--r--mitmproxy/optmanager.py13
1 files changed, 4 insertions, 9 deletions
diff --git a/mitmproxy/optmanager.py b/mitmproxy/optmanager.py
index fd777d74..61421ba7 100644
--- a/mitmproxy/optmanager.py
+++ b/mitmproxy/optmanager.py
@@ -54,15 +54,6 @@ class OptManager(metaclass=_DefaultsMeta):
# ._initialized = True as the final operation.
instance = super().__new__(cls)
instance.__dict__["_opts"] = {}
-
- defaults = {}
- for klass in reversed(inspect.getmro(cls)):
- for p in inspect.signature(klass.__init__).parameters.values():
- if p.kind in (p.KEYWORD_ONLY, p.POSITIONAL_OR_KEYWORD):
- if not p.default == p.empty:
- defaults[p.name] = p.default
- instance.__dict__["_defaults"] = defaults
-
return instance
def __init__(self):
@@ -143,6 +134,10 @@ class OptManager(metaclass=_DefaultsMeta):
"""
self.update(**self._defaults)
+ @classmethod
+ def default(klass, opt):
+ return copy.deepcopy(klass._defaults[opt])
+
def update(self, **kwargs):
updated = set(kwargs.keys())
for k, v in kwargs.items():