mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-23 18:44:04 +01:00
Allow None in IrcDict and InsensitivePreservingDicts.
This commit is contained in:
parent
133f6a8aff
commit
26771923f6
@ -493,7 +493,10 @@ class IrcString(str):
|
|||||||
|
|
||||||
class IrcDict(utils.InsensitivePreservingDict):
|
class IrcDict(utils.InsensitivePreservingDict):
|
||||||
"""Subclass of dict to make key comparison IRC-case insensitive."""
|
"""Subclass of dict to make key comparison IRC-case insensitive."""
|
||||||
key = staticmethod(toLower)
|
def key(self, s):
|
||||||
|
if s is not None:
|
||||||
|
s = toLower(s)
|
||||||
|
return s
|
||||||
|
|
||||||
|
|
||||||
class IrcSet(utils.NormalizingSet):
|
class IrcSet(utils.NormalizingSet):
|
||||||
|
@ -641,7 +641,12 @@ def isIPV6(s):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
class InsensitivePreservingDict(UserDict.DictMixin, object):
|
class InsensitivePreservingDict(UserDict.DictMixin, object):
|
||||||
key = staticmethod(str.lower)
|
def key(self, s):
|
||||||
|
"""Override this if you wish."""
|
||||||
|
if s is not None:
|
||||||
|
s = s.lower()
|
||||||
|
return s
|
||||||
|
|
||||||
def __init__(self, dict=None, key=None):
|
def __init__(self, dict=None, key=None):
|
||||||
if key is not None:
|
if key is not None:
|
||||||
self.key = key
|
self.key = key
|
||||||
|
Loading…
Reference in New Issue
Block a user