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

remove unnecessary to_dict() #834

merged 2 commits into from
Feb 19, 2018

Conversation

Eldinnie
Copy link
Member

We have some objects that have exactly the same to_dict() method, only specifying that from_user should be from in the data-dict. I refractored this logic to TelegramObject and removed those to_dicts() from the code.

We have some objects that have exactly the same to_dict() method, only specifying that `from_user` should be `from` in the `data`-dict. I refractored this logic to `TelegramObject` and removed those to_dicts() from the code.
@codecov
Copy link

codecov bot commented Sep 16, 2017

Codecov Report

Merging #834 into master will decrease coverage by 0.21%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #834      +/-   ##
==========================================
- Coverage   91.44%   91.23%   -0.22%     
==========================================
  Files         101      101              
  Lines        4023     4004      -19     
  Branches      614      615       +1     
==========================================
- Hits         3679     3653      -26     
- Misses        200      208       +8     
+ Partials      144      143       -1
Flag Coverage Δ
#Appveyor 86.28% <100%> (-0.07%) ⬇️
#Travis 90.85% <100%> (-0.22%) ⬇️
Impacted Files Coverage Δ
telegram/payment/shippingquery.py 100% <ø> (ø) ⬆️
telegram/payment/precheckoutquery.py 100% <ø> (ø) ⬆️
telegram/inline/inlinequery.py 100% <ø> (ø) ⬆️
telegram/callbackquery.py 100% <ø> (ø) ⬆️
telegram/choseninlineresult.py 100% <ø> (ø) ⬆️
telegram/message.py 96% <ø> (-0.02%) ⬇️
telegram/base.py 100% <100%> (ø) ⬆️
telegram/error.py 86.48% <0%> (-5.41%) ⬇️
telegram/utils/request.py 63.7% <0%> (-4.04%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5614af1...d789562. Read the comment docs.

Copy link
Member

@jsmnbom jsmnbom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a bit conflicted with this change. On one hand it's a lot less duplicated code which is good most of the time. But on the other hand it's a bit unintuitive to have "from/from_user" be the only thing special thing that's handled in the base. I personally think it makes more sense to have it where it was before, despite the duplicated code.

@@ -180,7 +173,8 @@ def edit_message_reply_markup(self, *args, **kwargs):

or::

bot.edit_message_reply_markup(inline_message_id=update.callback_query.inline_message_id,
bot.edit_message_reply_markup(
inline_message_id=update.callback_query.inline_message_id,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix the indentation here :)

@Eldinnie
Copy link
Member Author

@bomjacob I fixed the indentation as you requested.
The reason I think from/from_user is an exception, is because it's the only one we rename in the library. And because it's the only one occurring more then once where it's the only reason to_dict exists.

Copy link
Member

@jsmnbom jsmnbom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, I can see that, LGTM then :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants