mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-26 18:18:25 +00:00
Remove __slots__ to make it possible to inherit from Options classes.
This commit is contained in:
parent
75b5c97095
commit
e608d10f45
@ -325,7 +325,7 @@ class ConsoleState(flow.State):
|
||||
|
||||
|
||||
class Options(object):
|
||||
__slots__ = [
|
||||
attributes = [
|
||||
"anticache",
|
||||
"anticomp",
|
||||
"client_replay",
|
||||
@ -352,7 +352,7 @@ class Options(object):
|
||||
def __init__(self, **kwargs):
|
||||
for k, v in kwargs.items():
|
||||
setattr(self, k, v)
|
||||
for i in self.__slots__:
|
||||
for i in self.attributes:
|
||||
if not hasattr(self, i):
|
||||
setattr(self, i, None)
|
||||
|
||||
|
@ -21,7 +21,7 @@ class DumpError(Exception): pass
|
||||
|
||||
|
||||
class Options(object):
|
||||
__slots__ = [
|
||||
attributes = [
|
||||
"anticache",
|
||||
"anticomp",
|
||||
"client_replay",
|
||||
@ -45,7 +45,7 @@ class Options(object):
|
||||
def __init__(self, **kwargs):
|
||||
for k, v in kwargs.items():
|
||||
setattr(self, k, v)
|
||||
for i in self.__slots__:
|
||||
for i in self.attributes:
|
||||
if not hasattr(self, i):
|
||||
setattr(self, i, None)
|
||||
|
||||
|
@ -101,7 +101,6 @@ class TestDumpMaster:
|
||||
def test_options(self):
|
||||
o = dump.Options(verbosity = 2)
|
||||
assert o.verbosity == 2
|
||||
libpry.raises(AttributeError, dump.Options, nonexistent = 2)
|
||||
|
||||
def test_filter(self):
|
||||
assert not "GET" in self._dummy_cycle(1, "~u foo", "", verbosity=1)
|
||||
|
@ -146,4 +146,3 @@ class TestDummyServer:
|
||||
d.start_slave()
|
||||
d.shutdown()
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user