Browse Source

[commands] Case insensitivity uses casefold instead of lower

There seems to be very little performance regression in doing so (+5ns)
so might as well go for the more correct behaviour.
pull/2305/head
Rapptz 5 years ago
parent
commit
9f2018f439
  1. 12
      discord/ext/commands/core.py

12
discord/ext/commands/core.py

@ -105,22 +105,22 @@ def _convert_to_bool(argument):
class _CaseInsensitiveDict(dict):
def __contains__(self, k):
return super().__contains__(k.lower())
return super().__contains__(k.casefold())
def __delitem__(self, k):
return super().__delitem__(k.lower())
return super().__delitem__(k.casefold())
def __getitem__(self, k):
return super().__getitem__(k.lower())
return super().__getitem__(k.casefold())
def get(self, k, default=None):
return super().get(k.lower(), default)
return super().get(k.casefold(), default)
def pop(self, k, default=None):
return super().pop(k.lower(), default)
return super().pop(k.casefold(), default)
def __setitem__(self, k, v):
super().__setitem__(k.lower(), v)
super().__setitem__(k.casefold(), v)
class Command(_BaseCommand):
r"""A class that implements the protocol for a bot text command.

Loading…
Cancel
Save