mirror of
https://github.com/jlu5/PyLink.git
synced 2024-12-25 04:02:45 +01:00
structures: support a 'data' keyword argument in (IRC)CaseInsensitiveDict
This commit is contained in:
parent
a02fa45d96
commit
f34198647e
@ -30,8 +30,12 @@ class CaseInsensitiveDict(collections.abc.MutableMapping):
|
||||
"""
|
||||
A dictionary storing items case insensitively.
|
||||
"""
|
||||
def __init__(self):
|
||||
self._data = {}
|
||||
def __init__(self, *, data=None):
|
||||
if data is not None:
|
||||
assert isinstance(data, dict)
|
||||
self._data = data
|
||||
else:
|
||||
self._data = {}
|
||||
|
||||
def _keymangle(self, key):
|
||||
"""Converts the given key to lowercase."""
|
||||
@ -67,8 +71,8 @@ class IRCCaseInsensitiveDict(CaseInsensitiveDict):
|
||||
"""
|
||||
A dictionary storing channels case insensitively. Channel objects are initialized on access.
|
||||
"""
|
||||
def __init__(self, irc):
|
||||
super().__init__()
|
||||
def __init__(self, irc, *, data=None):
|
||||
super().__init__(data=data)
|
||||
self._irc = irc
|
||||
|
||||
def _keymangle(self, key):
|
||||
|
Loading…
Reference in New Issue
Block a user