From 5d27059631a97d5c967ad9682b9163bfa3cf80ca Mon Sep 17 00:00:00 2001 From: Rahiel Kasim Date: Sun, 21 Aug 2016 11:50:22 +0200 Subject: [PATCH] deprecate telegram.Emoji --- docs/source/telegram.emoji.rst | 7 ------- telegram/emoji.py | 24 ++++++++++++++++++++---- 2 files changed, 20 insertions(+), 11 deletions(-) delete mode 100644 docs/source/telegram.emoji.rst diff --git a/docs/source/telegram.emoji.rst b/docs/source/telegram.emoji.rst deleted file mode 100644 index f776cfe11..000000000 --- a/docs/source/telegram.emoji.rst +++ /dev/null @@ -1,7 +0,0 @@ -telegram.emoji module -===================== - -.. automodule:: telegram.emoji - :members: - :undoc-members: - :show-inheritance: diff --git a/telegram/emoji.py b/telegram/emoji.py index c3dff9aea..91af002ea 100644 --- a/telegram/emoji.py +++ b/telegram/emoji.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # flake8: noqa -# pylint: disable=C0103,R0903 +# pylint: disable=C0103,R0903,E0213 # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2016 @@ -18,14 +18,27 @@ # # You should have received a copy of the GNU Lesser Public License # along with this program. If not, see [http://www.gnu.org/licenses/]. -"""This module contains a object that represents an Emoji.""" +"""This module contains a object that represents an Emoji. -from future.utils import bytes_to_native_str as n +This module will be removed in the future. +""" + +import warnings + +from future.utils import bytes_to_native_str -class Emoji(object): +class Emoji2(object): """This object represents an Emoji.""" + def n(b): + + def e(cls): + warnings.warn("telegram.Emoji is being deprecated, please see https://git.io/v6DeB") + return bytes_to_native_str(b) + + return property(e) + GRINNING_FACE_WITH_SMILING_EYES = n(b'\xF0\x9F\x98\x81') FACE_WITH_TEARS_OF_JOY = n(b'\xF0\x9F\x98\x82') SMILING_FACE_WITH_OPEN_MOUTH = n(b'\xF0\x9F\x98\x83') @@ -879,3 +892,6 @@ class Emoji(object): CLOCK_FACE_TEN_THIRTY = n(b'\xF0\x9F\x95\xA5') CLOCK_FACE_ELEVEN_THIRTY = n(b'\xF0\x9F\x95\xA6') CLOCK_FACE_TWELVE_THIRTY = n(b'\xF0\x9F\x95\xA7') + + +Emoji = Emoji2()