Add typing hints to CaseInsensitiveDict, fix it's __setitem__ signature, call
.items() on `other` in ctor
This commit is contained in:
parent
8cc1168589
commit
1c546a8244
1 changed files with 5 additions and 5 deletions
|
@ -173,9 +173,9 @@ def top_10(items: typing.Dict[typing.Any, typing.Any],
|
|||
return top_10_items
|
||||
|
||||
class CaseInsensitiveDict(dict):
|
||||
def __init__(self, other):
|
||||
dict.__init__(self, ((k.lower(), v) for k, v in other))
|
||||
def __getitem__(self, key):
|
||||
def __init__(self, other: typing.Dict[str, typing.Any]):
|
||||
dict.__init__(self, ((k.lower(), v) for k, v in other.items()))
|
||||
def __getitem__(self, key: str) -> typing.Any:
|
||||
return dict.__getitem__(self, key.lower())
|
||||
def __setitem__(self, key):
|
||||
return dict.__setitem__(self, key.lower())
|
||||
def __setitem__(self, key: str, value: typing.Any) -> typing.Any:
|
||||
return dict.__setitem__(self, key.lower(), value)
|
||||
|
|
Loading…
Reference in a new issue