From 43ce3ce4b001d93a4acd85c3f41f89322c8e9432 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 1 Apr 2018 12:33:18 +0530 Subject: [PATCH] Forgot to add _replace() method to new Options class --- kitty/config_utils.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/kitty/config_utils.py b/kitty/config_utils.py index 9ff1a1206..1f7214a68 100644 --- a/kitty/config_utils.py +++ b/kitty/config_utils.py @@ -90,7 +90,12 @@ def create_options_class(keys): def _asdict(self): return {k: getattr(self, k) for k in self._fields} - ans = type('Options', (), {'__slots__': slots, '__init__': __init__, '_asdict': _asdict}) + def _replace(self, **kw): + ans = self._asdict() + ans.update(kw) + return self.__class__(ans) + + ans = type('Options', (), {'__slots__': slots, '__init__': __init__, '_asdict': _asdict, '_replace': _replace}) ans._fields = keys return ans