Skip to content

remove de_json() #789

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 1, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions telegram/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -2801,12 +2801,6 @@ def delete_sticker_from_set(self, sticker, timeout=None, **kwargs):

return result

@classmethod
def de_json(cls, data, bot):
data = super(Bot, cls).de_json(data, bot)

return cls(**data)

def to_dict(self):
data = {'id': self.id, 'username': self.username, 'first_name': self.username}

Expand Down
7 changes: 0 additions & 7 deletions telegram/forcereply.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,3 @@ def __init__(self, force_reply=True, selective=False, **kwargs):
self.force_reply = bool(force_reply)
# Optionals
self.selective = bool(selective)

@classmethod
def de_json(cls, data, bot):
if not data:
return None

return cls(**data)
20 changes: 0 additions & 20 deletions telegram/inline/inlinekeyboardbutton.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,23 +88,3 @@ def __init__(self,
self.switch_inline_query_current_chat = switch_inline_query_current_chat
self.callback_game = callback_game
self.pay = pay

@classmethod
def de_json(cls, data, bot):
data = super(InlineKeyboardButton, cls).de_json(data, bot)

if not data:
return None

return cls(**data)

@classmethod
def de_list(cls, data, bot):
if not data:
return []

inline_keyboards = list()
for inline_keyboard in data:
inline_keyboards.append(cls.de_json(inline_keyboard, bot))

return inline_keyboards
16 changes: 1 addition & 15 deletions telegram/inline/inlinekeyboardmarkup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# along with this program. If not, see [http://www.gnu.org/licenses/].
"""This module contains an object that represents a Telegram InlineKeyboardMarkup."""

from telegram import ReplyMarkup, InlineKeyboardButton
from telegram import ReplyMarkup


class InlineKeyboardMarkup(ReplyMarkup):
Expand All @@ -39,20 +39,6 @@ def __init__(self, inline_keyboard, **kwargs):
# Required
self.inline_keyboard = inline_keyboard

@classmethod
def de_json(cls, data, bot):
data = super(InlineKeyboardMarkup, cls).de_json(data, bot)

if not data:
return None

data['inline_keyboard'] = [
InlineKeyboardButton.de_list(inline_keyboard, bot)
for inline_keyboard in data['inline_keyboard']
]

return cls(**data)

def to_dict(self):
data = super(InlineKeyboardMarkup, self).to_dict()

Expand Down
15 changes: 1 addition & 14 deletions telegram/inline/inlinequeryresultarticle.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"""This module contains the classes that represent Telegram
InlineQueryResultArticle"""

from telegram import InlineQueryResult, InlineKeyboardMarkup, InputMessageContent
from telegram import InlineQueryResult


class InlineQueryResultArticle(InlineQueryResult):
Expand Down Expand Up @@ -91,16 +91,3 @@ def __init__(self,
self.thumb_width = thumb_width
if thumb_height:
self.thumb_height = thumb_height

@classmethod
def de_json(cls, data, bot):
data = super(InlineQueryResultArticle, cls).de_json(data, bot)

if not data:
return None

data['reply_markup'] = InlineKeyboardMarkup.de_json(data.get('reply_markup'), bot)
data['input_message_content'] = InputMessageContent.de_json(
data.get('input_message_content'), bot)

return cls(**data)
15 changes: 1 addition & 14 deletions telegram/inline/inlinequeryresultaudio.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"""This module contains the classes that represent Telegram
InlineQueryResultAudio"""

from telegram import InlineQueryResult, InlineKeyboardMarkup, InputMessageContent
from telegram import InlineQueryResult


class InlineQueryResultAudio(InlineQueryResult):
Expand Down Expand Up @@ -82,16 +82,3 @@ def __init__(self,
self.reply_markup = reply_markup
if input_message_content:
self.input_message_content = input_message_content

@classmethod
def de_json(cls, data, bot):
data = super(InlineQueryResultAudio, cls).de_json(data, bot)

if not data:
return None

data['reply_markup'] = InlineKeyboardMarkup.de_json(data.get('reply_markup'), bot)
data['input_message_content'] = InputMessageContent.de_json(
data.get('input_message_content'), bot)

return cls(**data)
15 changes: 1 addition & 14 deletions telegram/inline/inlinequeryresultcachedaudio.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"""This module contains the classes that represent Telegram
InlineQueryResultCachedAudio"""

from telegram import InlineQueryResult, InlineKeyboardMarkup, InputMessageContent
from telegram import InlineQueryResult


class InlineQueryResultCachedAudio(InlineQueryResult):
Expand Down Expand Up @@ -67,16 +67,3 @@ def __init__(self,
self.reply_markup = reply_markup
if input_message_content:
self.input_message_content = input_message_content

@classmethod
def de_json(cls, data, bot):
data = super(InlineQueryResultCachedAudio, cls).de_json(data, bot)

if not data:
return None

data['reply_markup'] = InlineKeyboardMarkup.de_json(data.get('reply_markup'), bot)
data['input_message_content'] = InputMessageContent.de_json(
data.get('input_message_content'), bot)

return cls(**data)
15 changes: 1 addition & 14 deletions telegram/inline/inlinequeryresultcacheddocument.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# along with this program. If not, see [http://www.gnu.org/licenses/].
"""This module contains the classes that represent Telegram InlineQueryResultCachedDocument"""

from telegram import InlineQueryResult, InlineKeyboardMarkup, InputMessageContent
from telegram import InlineQueryResult


class InlineQueryResultCachedDocument(InlineQueryResult):
Expand Down Expand Up @@ -75,16 +75,3 @@ def __init__(self,
self.reply_markup = reply_markup
if input_message_content:
self.input_message_content = input_message_content

@classmethod
def de_json(cls, data, bot):
data = super(InlineQueryResultCachedDocument, cls).de_json(data, bot)

if not data:
return None

data['reply_markup'] = InlineKeyboardMarkup.de_json(data.get('reply_markup'), bot)
data['input_message_content'] = InputMessageContent.de_json(
data.get('input_message_content'), bot)

return cls(**data)
15 changes: 1 addition & 14 deletions telegram/inline/inlinequeryresultcachedgif.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"""This module contains the classes that represent Telegram
InlineQueryResultCachedGif"""

from telegram import InlineQueryResult, InlineKeyboardMarkup, InputMessageContent
from telegram import InlineQueryResult


class InlineQueryResultCachedGif(InlineQueryResult):
Expand Down Expand Up @@ -73,16 +73,3 @@ def __init__(self,
self.reply_markup = reply_markup
if input_message_content:
self.input_message_content = input_message_content

@classmethod
def de_json(cls, data, bot):
data = super(InlineQueryResultCachedGif, cls).de_json(data, bot)

if not data:
return None

data['reply_markup'] = InlineKeyboardMarkup.de_json(data.get('reply_markup'), bot)
data['input_message_content'] = InputMessageContent.de_json(
data.get('input_message_content'), bot)

return cls(**data)
15 changes: 1 addition & 14 deletions telegram/inline/inlinequeryresultcachedmpeg4gif.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"""This module contains the classes that represent Telegram
InlineQueryResultMpeg4Gif"""

from telegram import InlineQueryResult, InlineKeyboardMarkup, InputMessageContent
from telegram import InlineQueryResult


class InlineQueryResultCachedMpeg4Gif(InlineQueryResult):
Expand Down Expand Up @@ -73,16 +73,3 @@ def __init__(self,
self.reply_markup = reply_markup
if input_message_content:
self.input_message_content = input_message_content

@classmethod
def de_json(cls, data, bot):
data = super(InlineQueryResultCachedMpeg4Gif, cls).de_json(data, bot)

if not data:
return None

data['reply_markup'] = InlineKeyboardMarkup.de_json(data.get('reply_markup'), bot)
data['input_message_content'] = InputMessageContent.de_json(
data.get('input_message_content'), bot)

return cls(**data)
15 changes: 1 addition & 14 deletions telegram/inline/inlinequeryresultcachedphoto.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# along with this program. If not, see [http://www.gnu.org/licenses/].
"""This module contains the classes that represent Telegram InlineQueryResultPhoto"""

from telegram import InlineQueryResult, InlineKeyboardMarkup, InputMessageContent
from telegram import InlineQueryResult


class InlineQueryResultCachedPhoto(InlineQueryResult):
Expand Down Expand Up @@ -77,16 +77,3 @@ def __init__(self,
self.reply_markup = reply_markup
if input_message_content:
self.input_message_content = input_message_content

@classmethod
def de_json(cls, data, bot):
data = super(InlineQueryResultCachedPhoto, cls).de_json(data, bot)

if not data:
return None

data['reply_markup'] = InlineKeyboardMarkup.de_json(data.get('reply_markup'), bot)
data['input_message_content'] = InputMessageContent.de_json(
data.get('input_message_content'), bot)

return cls(**data)
15 changes: 1 addition & 14 deletions telegram/inline/inlinequeryresultcachedsticker.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# along with this program. If not, see [http://www.gnu.org/licenses/].
"""This module contains the classes that represent Telegram InlineQueryResultCachedSticker"""

from telegram import InlineQueryResult, InlineKeyboardMarkup, InputMessageContent
from telegram import InlineQueryResult


class InlineQueryResultCachedSticker(InlineQueryResult):
Expand Down Expand Up @@ -61,16 +61,3 @@ def __init__(self,
self.reply_markup = reply_markup
if input_message_content:
self.input_message_content = input_message_content

@classmethod
def de_json(cls, data, bot):
data = super(InlineQueryResultCachedSticker, cls).de_json(data, bot)

if not data:
return None

data['reply_markup'] = InlineKeyboardMarkup.de_json(data.get('reply_markup'), bot)
data['input_message_content'] = InputMessageContent.de_json(
data.get('input_message_content'), bot)

return cls(**data)
15 changes: 1 addition & 14 deletions telegram/inline/inlinequeryresultcachedvideo.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# along with this program. If not, see [http://www.gnu.org/licenses/].
"""This module contains the classes that represent Telegram InlineQueryResultCachedVideo"""

from telegram import InlineQueryResult, InlineKeyboardMarkup, InputMessageContent
from telegram import InlineQueryResult


class InlineQueryResultCachedVideo(InlineQueryResult):
Expand Down Expand Up @@ -76,16 +76,3 @@ def __init__(self,
self.reply_markup = reply_markup
if input_message_content:
self.input_message_content = input_message_content

@classmethod
def de_json(cls, data, bot):
data = super(InlineQueryResultCachedVideo, cls).de_json(data, bot)

if not data:
return None

data['reply_markup'] = InlineKeyboardMarkup.de_json(data.get('reply_markup'), bot)
data['input_message_content'] = InputMessageContent.de_json(
data.get('input_message_content'), bot)

return cls(**data)
15 changes: 1 addition & 14 deletions telegram/inline/inlinequeryresultcachedvoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# along with this program. If not, see [http://www.gnu.org/licenses/].
"""This module contains the classes that represent Telegram InlineQueryResultCachedVoice"""

from telegram import InlineQueryResult, InlineKeyboardMarkup, InputMessageContent
from telegram import InlineQueryResult


class InlineQueryResultCachedVoice(InlineQueryResult):
Expand Down Expand Up @@ -70,16 +70,3 @@ def __init__(self,
self.reply_markup = reply_markup
if input_message_content:
self.input_message_content = input_message_content

@classmethod
def de_json(cls, data, bot):
data = super(InlineQueryResultCachedVoice, cls).de_json(data, bot)

if not data:
return None

data['reply_markup'] = InlineKeyboardMarkup.de_json(data.get('reply_markup'), bot)
data['input_message_content'] = InputMessageContent.de_json(
data.get('input_message_content'), bot)

return cls(**data)
15 changes: 1 addition & 14 deletions telegram/inline/inlinequeryresultcontact.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# along with this program. If not, see [http://www.gnu.org/licenses/].
"""This module contains the classes that represent Telegram InlineQueryResultContact"""

from telegram import InlineQueryResult, InlineKeyboardMarkup, InputMessageContent
from telegram import InlineQueryResult


class InlineQueryResultContact(InlineQueryResult):
Expand Down Expand Up @@ -86,16 +86,3 @@ def __init__(self,
self.thumb_width = thumb_width
if thumb_height:
self.thumb_height = thumb_height

@classmethod
def de_json(cls, data, bot):
data = super(InlineQueryResultContact, cls).de_json(data, bot)

if not data:
return None

data['reply_markup'] = InlineKeyboardMarkup.de_json(data.get('reply_markup'), bot)
data['input_message_content'] = InputMessageContent.de_json(
data.get('input_message_content'), bot)

return cls(**data)
15 changes: 1 addition & 14 deletions telegram/inline/inlinequeryresultdocument.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# along with this program. If not, see [http://www.gnu.org/licenses/].
"""This module contains the classes that represent Telegram InlineQueryResultDocument"""

from telegram import InlineQueryResult, InlineKeyboardMarkup, InputMessageContent
from telegram import InlineQueryResult


class InlineQueryResultDocument(InlineQueryResult):
Expand Down Expand Up @@ -97,16 +97,3 @@ def __init__(self,
self.thumb_width = thumb_width
if thumb_height:
self.thumb_height = thumb_height

@classmethod
def de_json(cls, data, bot):
data = super(InlineQueryResultDocument, cls).de_json(data, bot)

if not data:
return None

data['reply_markup'] = InlineKeyboardMarkup.de_json(data.get('reply_markup'), bot)
data['input_message_content'] = InputMessageContent.de_json(
data.get('input_message_content'), bot)

return cls(**data)
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy