Skip to content
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

remove unnecessary to_dict() #834

Merged
merged 2 commits into from
Feb 19, 2018
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
2 changes: 2 additions & 0 deletions telegram/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ def to_dict(self):
else:
data[key] = value

if data.get('from_user'):
data['from'] = data.pop('from_user', None)
return data

def __eq__(self, other):
Expand Down
7 changes: 0 additions & 7 deletions telegram/callbackquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,6 @@ def de_json(cls, data, bot):

return cls(bot=bot, **data)

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

# Required
data['from'] = data.pop('from_user', None)
return data

def answer(self, *args, **kwargs):
"""Shortcut for::

Expand Down
8 changes: 0 additions & 8 deletions telegram/choseninlineresult.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,3 @@ def de_json(cls, data, bot):
data['location'] = Location.de_json(data.get('location'), bot)

return cls(**data)

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

# Required
data['from'] = data.pop('from_user', None)

return data
8 changes: 0 additions & 8 deletions telegram/inline/inlinequery.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,6 @@ def de_json(cls, data, bot):

return cls(bot=bot, **data)

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

# Required
data['from'] = data.pop('from_user', None)

return data

def answer(self, *args, **kwargs):
"""Shortcut for::

Expand Down
1 change: 0 additions & 1 deletion telegram/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,6 @@ def to_dict(self):
data = super(Message, self).to_dict()

# Required
data['from'] = data.pop('from_user', None)
data['date'] = to_timestamp(self.date)
# Optionals
if self.forward_date:
Expand Down
7 changes: 0 additions & 7 deletions telegram/payment/precheckoutquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,6 @@ def de_json(cls, data, bot):

return cls(**data)

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

data['from'] = data.pop('from_user', None)

return data

def answer(self, *args, **kwargs):
"""Shortcut for::

Expand Down
7 changes: 0 additions & 7 deletions telegram/payment/shippingquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,6 @@ def de_json(cls, data, bot):

return cls(**data)

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

data['from'] = data.pop('from_user', None)

return data

def answer(self, *args, **kwargs):
"""Shortcut for::

Expand Down