Skip to content

telegram: add delete() when leave=False - #1189

Merged
casperdcl merged 2 commits into
tqdm:develfrom
raulsaavedr:raulsaavedr-tqdm
Jun 30, 2021
Merged

casperdcl merged 2 commits into
tqdm:develfrom
raulsaavedr:raulsaavedr-tqdm

Conversation

@raulsaavedr

Copy link
Copy Markdown
Contributor

Add an option for delete bar message with the deleteMessage method in Bot API.

Add an option for delete bar message with the deleteMessage method in Bot API.
@raulsaavedr
raulsaavedr requested a review from casperdcl as a code owner June 19, 2021 19:53
@raulsaavedr

Copy link
Copy Markdown
Contributor Author

This would be the behaviour

telegram_delete_method_pull

@casperdcl

Copy link
Copy Markdown
Member

Ideally this would be used when leave=False?

@casperdcl casperdcl self-assigned this Jun 20, 2021
@casperdcl casperdcl added p3-enhancement 🔥 Much new such feature submodule ⊂ Periphery/subclasses to-review 🔍 Awaiting final confirmation labels Jun 20, 2021
@casperdcl casperdcl added this to the Non-breaking milestone Jun 20, 2021
@codecov

codecov Bot commented Jun 20, 2021 •

Copy link
Copy Markdown

Codecov Report

Merging #1189 (c36a011) into master (c1ec3b1) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master    #1189   +/-   ##
=======================================
  Coverage   89.88%   89.88%           
=======================================
  Files          26       26           
  Lines        1710     1710           
  Branches      284      284           
=======================================
  Hits         1537     1537           
  Misses        128      128           
  Partials       45       45           

Comment thread tqdm/contrib/telegram.py
if self.disable:
return
super(tqdm_telegram, self).close()
if not (self.leave or (self.leave is None and self.pos == 0)):

@casperdcl casperdcl Jun 20, 2021 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

borrowing usual leave=None|False|True logic here.

Potential future issue is if people want different behaviour for terminal & telegram outputs (leave one but not the other). They'd have to override the close() method. Don't think we need to explicitly support/worry about that case for now.

What do you think?

@raulsaavedr raulsaavedr Jun 30, 2021 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think the leave variable is perfect, it fits our needs, and yes the default behaviour would be leave = False. In the meantime we don't worry about that case for terminal and telegram outputs. When the close() method is called just delete the message from telegram and stop the bar from terminal.

@casperdcl casperdcl changed the title Update telegram.py to add a delete method telegram: add delete() when leave=False Jun 20, 2021
- also misc minor tidy
@casperdcl
casperdcl changed the base branch from master to devel June 30, 2021 16:57
@casperdcl
casperdcl merged commit 4735e81 into tqdm:devel Jun 30, 2021
@casperdcl casperdcl added to-merge ↰ Imminent and removed to-review 🔍 Awaiting final confirmation labels Jun 30, 2021
@casperdcl casperdcl mentioned this pull request Jun 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

p3-enhancement 🔥 Much new such feature submodule ⊂ Periphery/subclasses to-merge ↰ Imminent

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants