Rename .entities -> ._entities from 7e9d19d to avoid collision

This commit is contained in:
Lonami Exo 2018-03-29 00:56:05 +02:00
parent 395e702586
commit dede5520dd
2 changed files with 9 additions and 12 deletions

View File

@ -301,7 +301,7 @@ class NewMessage(_EventBuilder):
else: else:
return return
event._entities = update.entities event._entities = update._entities
return self._message_filter_event(event) return self._message_filter_event(event)
def _message_filter_event(self, event): def _message_filter_event(self, event):
@ -691,7 +691,7 @@ class ChatAction(_EventBuilder):
else: else:
return return
event._entities = update.entities event._entities = update._entities
return self._filter_event(event) return self._filter_event(event)
class Event(_EventCommon): class Event(_EventCommon):
@ -936,7 +936,7 @@ class UserUpdate(_EventBuilder):
else: else:
return return
event._entities = update.entities event._entities = update._entities
return self._filter_event(event) return self._filter_event(event)
class Event(_EventCommon): class Event(_EventCommon):
@ -1085,7 +1085,7 @@ class MessageEdited(NewMessage):
else: else:
return return
event._entities = update.entities event._entities = update._entities
return self._message_filter_event(event) return self._message_filter_event(event)
class Event(NewMessage.Event): class Event(NewMessage.Event):
@ -1111,7 +1111,7 @@ class MessageDeleted(_EventBuilder):
else: else:
return return
event._entities = update.entities event._entities = update._entities
return self._filter_event(event) return self._filter_event(event)
class Event(_EventCommon): class Event(_EventCommon):
@ -1162,7 +1162,7 @@ class MessageRead(_EventBuilder):
if self.inbox == event.outbox: if self.inbox == event.outbox:
return return
event._entities = update.entities event._entities = update._entities
return self._filter_event(event) return self._filter_event(event)
class Event(_EventCommon): class Event(_EventCommon):

View File

@ -129,12 +129,9 @@ class UpdateState:
# After running the script for over an hour and receiving over # After running the script for over an hour and receiving over
# 1000 updates, the only duplicates received were users going # 1000 updates, the only duplicates received were users going
# online or offline. We can trust the server until new reports. # online or offline. We can trust the server until new reports.
#
# TODO Note somewhere that all updates are modified to include
# .entities, which is a dictionary you can access but may be empty.
# This should only be used as read-only. # This should only be used as read-only.
if isinstance(update, tl.UpdateShort): if isinstance(update, tl.UpdateShort):
update.update.entities = {} update.update._entities = {}
self._updates.put(update.update) self._updates.put(update.update)
# Expand "Updates" into "Update", and pass these to callbacks. # Expand "Updates" into "Update", and pass these to callbacks.
# Since .users and .chats have already been processed, we # Since .users and .chats have already been processed, we
@ -143,9 +140,9 @@ class UpdateState:
entities = {utils.get_peer_id(x): x for x in entities = {utils.get_peer_id(x): x for x in
itertools.chain(update.users, update.chats)} itertools.chain(update.users, update.chats)}
for u in update.updates: for u in update.updates:
u.entities = entities u._entities = entities
self._updates.put(u) self._updates.put(u)
# TODO Handle "tl.UpdatesTooLong" # TODO Handle "tl.UpdatesTooLong"
else: else:
update.entities = {} update._entities = {}
self._updates.put(update) self._updates.put(update)