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

Update Examples with the str.format() syntax. #870

Merged
merged 12 commits into from Oct 20, 2017

Conversation

Projects
None yet
4 participants
@SitiSchu
Contributor

SitiSchu commented Oct 13, 2017

conversationbot.py:
Use str.format()

conversationbot2.py:
Use str.format()
make the states dict flake8 compatible.

echobot.py:
Change Docstring to a Docstring using triple quotes.
Add Docstrings to main() and echo()

echobot2.py:
Add File Description to Docstring
Add License notice to Docstring
Add Docstrings to start(), help(), echo() and main()

inlinebot.py:
Use str.format()
Add File Description to Docstring
Add License notice to Docstring
Add Docstring to start(), help(), inlinequery(), error()
Create the list "results" with the Inline Results instead of appending them.

inlinekeyboard.py:
Use str.format()
Put the Update in a main() function.

paymentbot.py:
Use str.format()
Shorten comment on how to get a provider token to avoid the comment being longer than 99 characters

timerbot.py:
Use str.format()
Add Docstrings to alarm(), set_timer(), unset()
Rename set() to set_timer() to avoud shadowing the built-in set()

Update Examples with the str.format() syntax.
conversationbot.py:
    Use `str.format()`

conversationbot2.py:
    Use `str.format()`
    make the states dict flake8 compatible.

echobot.py:
    Change Docstring to a Docstring using triple quotes.
    Add Docstrings to `main()` and `echo()`

echobot2.py:
    Add File Description to Docstring
    Add License notice to Docstring
    Add Docstrings to `start()`, `help()`, `echo()` and `main()`

inlinebot.py:
    Use `str.format()`
    Add File Description to Docstring
    Add License notice to Docstring
    Add Docstring to `start()`, `help()`, `inlinequery()`, `error()`
    Create the list "results" with the Inline Results instead of appending them.

inlinekeyboard.py:
    Use `str.format()`
    Put the Update in a `main()` function.

paymentbot.py:
    Use `str.format()`
    Shorten comment on how to get a provider token to avoid the comment being longer than 99 characters

timerbot.py:
    Use `str.format()`
    Add Docstrings to `alarm()`, `set_timer()`, `unset()`
    Rename `set()` to `set_timer()`  to avoud shadowing the built-in `set()`
@codecov

This comment has been minimized.

Show comment
Hide comment
@codecov

codecov bot Oct 14, 2017

Codecov Report

Merging #870 into master will increase coverage by 0.35%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #870      +/-   ##
==========================================
+ Coverage   91.44%   91.79%   +0.35%     
==========================================
  Files         101      101              
  Lines        3985     3985              
  Branches      603      603              
==========================================
+ Hits         3644     3658      +14     
+ Misses        195      189       -6     
+ Partials      146      138       -8
Flag Coverage Δ
#Appveyor 86.85% <ø> (+0.6%) ⬆️
#Travis 91.41% <ø> (ø) ⬆️
Impacted Files Coverage Δ
telegram/message.py 96.01% <0%> (+4.78%) ⬆️
telegram/games/game.py 100% <0%> (+5.71%) ⬆️

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 8a8b121...9e9b0bd. Read the comment docs.

codecov bot commented Oct 14, 2017

Codecov Report

Merging #870 into master will increase coverage by 0.35%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #870      +/-   ##
==========================================
+ Coverage   91.44%   91.79%   +0.35%     
==========================================
  Files         101      101              
  Lines        3985     3985              
  Branches      603      603              
==========================================
+ Hits         3644     3658      +14     
+ Misses        195      189       -6     
+ Partials      146      138       -8
Flag Coverage Δ
#Appveyor 86.85% <ø> (+0.6%) ⬆️
#Travis 91.41% <ø> (ø) ⬆️
Impacted Files Coverage Δ
telegram/message.py 96.01% <0%> (+4.78%) ⬆️
telegram/games/game.py 100% <0%> (+5.71%) ⬆️

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 8a8b121...9e9b0bd. Read the comment docs.

Use the "proper" way to format logging strings.
Thanks to @KamranMackey for making me aware of the fact that Log messages shouldnt use str.format() according to this article: http://reinout.vanrees.org/weblog/2015/06/05/logging-formatting.html

@python-telegram-bot python-telegram-bot deleted a comment from codecov bot Oct 14, 2017

@tsnoam

Hi @SitiSchu
Thanks for your contribution. In general looks good (I like str.format()) but there are some changes which I must ask you to do. Please see CR comments on the code.

Show outdated Hide outdated examples/conversationbot.py
Show outdated Hide outdated examples/conversationbot.py
Show outdated Hide outdated examples/conversationbot.py
Show outdated Hide outdated examples/conversationbot.py
Show outdated Hide outdated examples/conversationbot2.py
Show outdated Hide outdated examples/conversationbot.py
Show outdated Hide outdated examples/conversationbot2.py
Show outdated Hide outdated examples/inlinebot.py
Show outdated Hide outdated examples/paymentbot.py
Show outdated Hide outdated examples/paymentbot.py
@codecov

This comment has been minimized.

Show comment
Hide comment
@codecov

codecov bot Oct 14, 2017

Codecov Report

Merging #870 into master will increase coverage by 0.35%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #870      +/-   ##
==========================================
+ Coverage   91.44%   91.79%   +0.35%     
==========================================
  Files         101      101              
  Lines        3985     3985              
  Branches      603      603              
==========================================
+ Hits         3644     3658      +14     
+ Misses        195      189       -6     
+ Partials      146      138       -8
Flag Coverage Δ
#Appveyor 86.85% <ø> (+0.6%) ⬆️
#Travis 91.41% <ø> (ø) ⬆️
Impacted Files Coverage Δ
telegram/message.py 96.01% <0%> (+4.78%) ⬆️
telegram/games/game.py 100% <0%> (+5.71%) ⬆️

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 8a8b121...1d48a83. Read the comment docs.

codecov bot commented Oct 14, 2017

Codecov Report

Merging #870 into master will increase coverage by 0.35%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #870      +/-   ##
==========================================
+ Coverage   91.44%   91.79%   +0.35%     
==========================================
  Files         101      101              
  Lines        3985     3985              
  Branches      603      603              
==========================================
+ Hits         3644     3658      +14     
+ Misses        195      189       -6     
+ Partials      146      138       -8
Flag Coverage Δ
#Appveyor 86.85% <ø> (+0.6%) ⬆️
#Travis 91.41% <ø> (ø) ⬆️
Impacted Files Coverage Δ
telegram/message.py 96.01% <0%> (+4.78%) ⬆️
telegram/games/game.py 100% <0%> (+5.71%) ⬆️

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 8a8b121...1d48a83. Read the comment docs.

@codecov

This comment has been minimized.

Show comment
Hide comment
@codecov

codecov bot Oct 14, 2017

Codecov Report

Merging #870 into master will increase coverage by 0.29%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #870      +/-   ##
==========================================
+ Coverage   91.44%   91.73%   +0.29%     
==========================================
  Files         101      101              
  Lines        3985     4055      +70     
  Branches      603      620      +17     
==========================================
+ Hits         3644     3720      +76     
- Misses        195      197       +2     
+ Partials      146      138       -8
Flag Coverage Δ
#Appveyor 86.88% <ø> (+0.63%) ⬆️
#Travis 91.31% <ø> (-0.1%) ⬇️
Impacted Files Coverage Δ
telegram/bot.py 87.22% <0%> (-0.21%) ⬇️
telegram/inline/inputlocationmessagecontent.py 100% <0%> (ø) ⬆️
telegram/inline/inlinequeryresultlocation.py 100% <0%> (ø) ⬆️
telegram/chat.py 100% <0%> (ø) ⬆️
telegram/message.py 96.22% <0%> (+4.99%) ⬆️
telegram/games/game.py 100% <0%> (+5.71%) ⬆️

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 8a8b121...7df6c08. Read the comment docs.

codecov bot commented Oct 14, 2017

Codecov Report

Merging #870 into master will increase coverage by 0.29%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #870      +/-   ##
==========================================
+ Coverage   91.44%   91.73%   +0.29%     
==========================================
  Files         101      101              
  Lines        3985     4055      +70     
  Branches      603      620      +17     
==========================================
+ Hits         3644     3720      +76     
- Misses        195      197       +2     
+ Partials      146      138       -8
Flag Coverage Δ
#Appveyor 86.88% <ø> (+0.63%) ⬆️
#Travis 91.31% <ø> (-0.1%) ⬇️
Impacted Files Coverage Δ
telegram/bot.py 87.22% <0%> (-0.21%) ⬇️
telegram/inline/inputlocationmessagecontent.py 100% <0%> (ø) ⬆️
telegram/inline/inlinequeryresultlocation.py 100% <0%> (ø) ⬆️
telegram/chat.py 100% <0%> (ø) ⬆️
telegram/message.py 96.22% <0%> (+4.99%) ⬆️
telegram/games/game.py 100% <0%> (+5.71%) ⬆️

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 8a8b121...7df6c08. Read the comment docs.

@tsnoam

Thanks for all the changes. Unfortunately, I'm afraid I'll have to ask you a few more changes, mostly regarding indentation.

Show outdated Hide outdated examples/conversationbot2.py
Show outdated Hide outdated examples/conversationbot2.py
Show outdated Hide outdated examples/conversationbot2.py
Show outdated Hide outdated examples/inlinebot.py
Show outdated Hide outdated examples/paymentbot.py

SitiSchu added some commits Oct 15, 2017

autopep8 convobot2, fix payment bot derp
Use autopep8 on the conversationbot2.py
Fix the provide token comment (duplicated some words)
@SitiSchu

This comment has been minimized.

Show comment
Hide comment
@SitiSchu

SitiSchu Oct 15, 2017

Contributor

Did all changes except the one to inlinebot.py:inlinequery() since I'm not sure if autopep8 makes it better.

Contributor

SitiSchu commented Oct 15, 2017

Did all changes except the one to inlinebot.py:inlinequery() since I'm not sure if autopep8 makes it better.

@SitiSchu

This comment has been minimized.

Show comment
Hide comment
@SitiSchu

SitiSchu Oct 16, 2017

Contributor

I formated the InlineQuery results in inlinebot.py like @jh0ker suggested with a linebreak before the id=uuid4()
This looks better and autopep8 didnt change the formatting to something weird.

Contributor

SitiSchu commented Oct 16, 2017

I formated the InlineQuery results in inlinebot.py like @jh0ker suggested with a linebreak before the id=uuid4()
This looks better and autopep8 didnt change the formatting to something weird.

Show outdated Hide outdated examples/conversationbot.py
Show outdated Hide outdated examples/conversationbot2.py
Show outdated Hide outdated examples/echobot2.py
Show outdated Hide outdated examples/inlinebot.py
Show outdated Hide outdated examples/inlinekeyboard.py
Show outdated Hide outdated examples/paymentbot.py
Show outdated Hide outdated examples/timerbot.py
@jh0ker

This comment has been minimized.

Show comment
Hide comment
@jh0ker

jh0ker Oct 16, 2017

Member

@SitiSchu A bit more nitpicking :P

Member

jh0ker commented Oct 16, 2017

@SitiSchu A bit more nitpicking :P

@SitiSchu

This comment has been minimized.

Show comment
Hide comment
@SitiSchu

SitiSchu Oct 16, 2017

Contributor

@jh0ker PyCharm told me about this but I wasn't sure if Py2 supports it. I checked and it does support it so I'll change it today ^^.

Contributor

SitiSchu commented Oct 16, 2017

@jh0ker PyCharm told me about this but I wasn't sure if Py2 supports it. I checked and it does support it so I'll change it today ^^.

@jh0ker

This comment has been minimized.

Show comment
Hide comment
@jh0ker

jh0ker Oct 16, 2017

Member

@SitiSchu Awesome, thanks :)

Member

jh0ker commented Oct 16, 2017

@SitiSchu Awesome, thanks :)

@SitiSchu

This comment has been minimized.

Show comment
Hide comment
@SitiSchu

SitiSchu Oct 16, 2017

Contributor

I updated all error functions to the new warning syntax. I also made flake8 pass(except D103 Missing docstring in public function)

Contributor

SitiSchu commented Oct 16, 2017

I updated all error functions to the new warning syntax. I also made flake8 pass(except D103 Missing docstring in public function)

@SitiSchu

This comment has been minimized.

Show comment
Hide comment
@SitiSchu

SitiSchu Oct 16, 2017

Contributor

@jh0ker Done.

Contributor

SitiSchu commented Oct 16, 2017

@jh0ker Done.

@jh0ker

jh0ker approved these changes Oct 16, 2017

@SitiSchu

This comment has been minimized.

Show comment
Hide comment
@SitiSchu

SitiSchu Oct 20, 2017

Contributor

Any updates on this PR? :)

Contributor

SitiSchu commented Oct 20, 2017

Any updates on this PR? :)

@Eldinnie

This comment has been minimized.

Show comment
Hide comment
@Eldinnie

Eldinnie Oct 20, 2017

Member

LGTM @tsnoam any more changes requested?

Member

Eldinnie commented Oct 20, 2017

LGTM @tsnoam any more changes requested?

@tsnoam

tsnoam approved these changes Oct 20, 2017

@tsnoam tsnoam merged commit 38637ec into python-telegram-bot:master Oct 20, 2017

5 checks passed

codeclimate All good!
Details
codecov/patch Coverage not affected when comparing 8a8b121...7df6c08
Details
codecov/project 91.73% (+0.29%) compared to 8a8b121
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@tsnoam

This comment has been minimized.

Show comment
Hide comment
@tsnoam

tsnoam Oct 20, 2017

Member

@SitiSchu Thankyou for your contribution.

Member

tsnoam commented Oct 20, 2017

@SitiSchu Thankyou for your contribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment