Add lru_cache decorator to .get_entity()

This commit is contained in:
Lonami Exo 2017-09-11 12:53:39 +02:00
parent 83f9cafabf
commit a76c31ede2

View File

@ -1,6 +1,7 @@
import os import os
import threading import threading
from datetime import datetime, timedelta from datetime import datetime, timedelta
from functools import lru_cache
from mimetypes import guess_type from mimetypes import guess_type
from threading import Thread from threading import Thread
@ -850,6 +851,7 @@ class TelegramClient(TelegramBareClient):
# region Small utilities to make users' life easier # region Small utilities to make users' life easier
@lru_cache()
def get_entity(self, entity): def get_entity(self, entity):
"""Turns an entity into a valid Telegram user or chat. """Turns an entity into a valid Telegram user or chat.
If "entity" is a string, and starts with '+', or if If "entity" is a string, and starts with '+', or if