Browse Source

Intern status and overwrite strings

pull/5849/head
Rapptz 5 years ago
parent
commit
f2de794bde
  1. 3
      discord/abc.py
  2. 9
      discord/member.py

3
discord/abc.py

@ -25,6 +25,7 @@ DEALINGS IN THE SOFTWARE.
"""
import abc
import sys
import copy
import asyncio
@ -169,7 +170,7 @@ class _Overwrites:
self.id = kwargs.pop('id')
self.allow = kwargs.pop('allow', 0)
self.deny = kwargs.pop('deny', 0)
self.type = kwargs.pop('type')
self.type = sys.intern(kwargs.pop('type'))
def _asdict(self):
return {

9
discord/member.py

@ -25,6 +25,7 @@ DEALINGS IN THE SOFTWARE.
"""
import itertools
import sys
from operator import attrgetter
import discord.abc
@ -221,10 +222,10 @@ class Member(discord.abc.Messageable, _BaseUser):
clone = cls(data=data, guild=guild, state=state)
to_return = cls(data=data, guild=guild, state=state)
to_return._client_status = {
key: value
sys.intern(key): sys.intern(value)
for key, value in data.get('client_status', {}).items()
}
to_return._client_status[None] = data['status']
to_return._client_status[None] = sys.intern(data['status'])
return to_return, clone
@classmethod
@ -266,10 +267,10 @@ class Member(discord.abc.Messageable, _BaseUser):
def _presence_update(self, data, user):
self.activities = tuple(map(create_activity, data.get('activities', [])))
self._client_status = {
key: value
sys.intern(key): sys.intern(value)
for key, value in data.get('client_status', {}).items()
}
self._client_status[None] = data['status']
self._client_status[None] = sys.intern(data['status'])
if len(user) > 1:
return self._update_inner_user(user)

Loading…
Cancel
Save