Utils: Fix mistake made with `KeyedDefaultDict` from #1933 that broke tracker functionality. (#3433)
This commit is contained in:
parent
70e9ccb13c
commit
cff7327558
10
Utils.py
10
Utils.py
|
@ -458,8 +458,14 @@ class KeyedDefaultDict(collections.defaultdict):
|
|||
"""defaultdict variant that uses the missing key as argument to default_factory"""
|
||||
default_factory: typing.Callable[[typing.Any], typing.Any]
|
||||
|
||||
def __init__(self, default_factory: typing.Callable[[Any], Any] = None, **kwargs):
|
||||
super().__init__(default_factory, **kwargs)
|
||||
def __init__(self,
|
||||
default_factory: typing.Callable[[Any], Any] = None,
|
||||
seq: typing.Union[typing.Mapping, typing.Iterable, None] = None,
|
||||
**kwargs):
|
||||
if seq is not None:
|
||||
super().__init__(default_factory, seq, **kwargs)
|
||||
else:
|
||||
super().__init__(default_factory, **kwargs)
|
||||
|
||||
def __missing__(self, key):
|
||||
self[key] = value = self.default_factory(key)
|
||||
|
|
Loading…
Reference in New Issue