[Misc] Add __setitem__ for LazyDict (#10469)
Signed-off-by: Yanyi Liu <wolfsonliu@163.com>
This commit is contained in:
parent
d200972e7f
commit
9e05252b46
@ -1491,6 +1491,9 @@ class LazyDict(Mapping, Generic[T]):
|
||||
self._dict[key] = self._factory[key]()
|
||||
return self._dict[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Callable[[], T]):
|
||||
self._factory[key] = value
|
||||
|
||||
def __iter__(self):
|
||||
return iter(self._factory)
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user