diff options
Diffstat (limited to 'libmproxy/stateobject.py')
-rw-r--r-- | libmproxy/stateobject.py | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/libmproxy/stateobject.py b/libmproxy/stateobject.py index 2cbec068..7d91519d 100644 --- a/libmproxy/stateobject.py +++ b/libmproxy/stateobject.py @@ -1,13 +1,17 @@ class StateObject(object): - def _get_state(self): + def _get_state(self): # pragma: nocover raise NotImplementedError - def _load_state(self, state): + def _load_state(self, state): # pragma: nocover raise NotImplementedError @classmethod - def _from_state(cls, state): + def _from_state(cls, state): # pragma: nocover raise NotImplementedError + # Usually, this function roughly equals to the following code: + # f = cls() + # f._load_state(state) + # return f def __eq__(self, other): try: @@ -66,10 +70,4 @@ class SimpleStateObject(StateObject): elif hasattr(cls, "_from_state"): setattr(self, attr, cls._from_state(state[attr])) else: - setattr(self, attr, cls(state[attr])) - - @classmethod - def _from_state(cls, state): - f = cls() # the default implementation assumes an empty constructor. Override accordingly. - f._load_state(state) - return f
\ No newline at end of file + setattr(self, attr, cls(state[attr]))
\ No newline at end of file |