Forgot to add _replace() method to new Options class
This commit is contained in:
parent
910cebeeb5
commit
43ce3ce4b0
1 changed files with 6 additions and 1 deletions
|
|
@ -90,7 +90,12 @@ def __init__(self, kw):
|
|||
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
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue