Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Refactor handling of default_quote#1965

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Bibo-Joshi merged 14 commits intov13fromdefaults
Jul 19, 2020
Merged

Refactor handling of default_quote#1965

Bibo-Joshi merged 14 commits intov13fromdefaults
Jul 19, 2020

Conversation

Bibo-Joshi
Copy link
Member

@Bibo-JoshiBibo-Joshi commentedMay 26, 2020
edited
Loading

Right now,bot.defaults.quote is passed through the json data when decoding an update for it to be stored inMessage.default_quote. As@n5y pointed out offline, it would be cleaner to just useMessage.bot.defaults.quote. This is, what this PR does.

To not break backwards compatibility, I left some optionaldefault_quote args in the Webhook classes untouched and also keptdefault_quote as argument forMessage (with a warning that it will override the bots settings). That's discussable though, as nobody should have actually used that …

Closes parts of#1797

@Bibo-JoshiBibo-Joshi added the 📋 pending-reviewwork status: pending-review labelMay 26, 2020
Copy link
MemberAuthor

@Bibo-JoshiBibo-Joshi left a comment

Choose a reason for hiding this comment

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

The changes isMessage lead to errors when trying to accessmessage._default_quote after unplicking. Need to make that backwards compatible.

Also, we might wanna mark thedefault_quote arg (maybe even the attribute, too) for deprecation.

@Bibo-JoshiBibo-Joshi changed the base branch frommaster tov13June 6, 2020 10:55
@Bibo-Joshi
Copy link
MemberAuthor

Latests commits

  • RemoveMessage.default_quote all along, making it a breaking change. Hence, changed PR to the new v13 branch. Also, this way, unpickling is no problem anymore.
  • Makes sure that a bots default values are un/pickled along with it.
    • upside: the unpickled bot of an unpickledMessage still has the correct defaultquote setting
    • downside: the unpickled bot is not the same as the updaters one. If the defaults for the updater are changed, the unpickled bots don't change accordingly. Then again, this is not really new, i.e. the behaviour is the same for the token. maybe that should at least be documented somewhere …

@Bibo-Joshi
Copy link
MemberAuthor

We should postpone this after#1994

@Bibo-JoshiBibo-Joshi added this to the13.0 milestoneJun 12, 2020
@Bibo-JoshiBibo-Joshiforce-pushed thev13 branch 3 times, most recently from2a9a5b0 to1fdc197CompareJune 16, 2020 15:08
@Bibo-JoshiBibo-Joshiforce-pushed thev13 branch 2 times, most recently fromb3e9be1 tob7e635bCompareJune 25, 2020 05:56
@Bibo-Joshi
Copy link
MemberAuthor

Also, we could/should raise a warning, if bothbot anddefaults are passed toUpdater, as after this the defaults passed to the updater have no effect.

* Unify kwargs handling in Bot methods* Remove Request.get, make api_kwargs an explicit argument, move note to head of Bot class* Fix test_official* Update get_file methods
* First go on refactoring JobQueue* Temporarily enable tests for the v13 branch* Work on tests* Temporarily enable tests for the v13 branch* Increase coverage* Remove JobQueue.tick()# Was intended for interal use anyways# Fixes tests* Address review* Temporarily enable tests for the v13 branch* Address review* Dispatch errors* Fix handling of job_kwargs* Remove possibility to pass a Bot to JobQueue
* Refactor persistence of bots* User BP.set_bot in Dispatcher* Temporarily enable tests for the v13 branch* Add documentation
# Conflicts:#telegram/bot.py
Copy link
Member

@PoolitzerPoolitzer left a comment

Choose a reason for hiding this comment

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

LGTM

Comment on lines 122 to 123
warnings.warn('Passing defaults to an Updater has no effect, if a Bot is passed, '
'too. Pass it to the Bot instead.',
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
warnings.warn('Passing defaults to an Updater has no effect, if a Bot is passed,'
'too. Passit to the Bot instead.',
warnings.warn('Passing defaults to an Updater has no effect when a Bot is passed'
'as well. Passthem to the Bot instead.',

@Poolitzer
Copy link
Member

Poolitzer commentedJul 19, 2020
edited
Loading

In here are a lot of changes which I reviewed in different PRs, like the refactor of the jobqueue, the api kwargs or the persistence part. Is that intended?

@Bibo-JoshiBibo-Joshi changed the base branch fromv13 tomasterJuly 19, 2020 14:25
@Bibo-JoshiBibo-Joshi changed the base branch frommaster tov13July 19, 2020 14:25
# Conflicts:#telegram/bot.py#tests/test_persistence.py
@Bibo-JoshiBibo-Joshi merged commit8e94d0d intov13Jul 19, 2020
@Bibo-JoshiBibo-Joshi deleted the defaults branchJuly 19, 2020 15:47
Bibo-Joshi added a commit that referenced this pull requestAug 13, 2020
* Refactor handling of `default_quote`* Make it a breaking change* Pickle a bots defaults* Temporarily enable tests for the v13 branch* Temporarily enable tests for the v13 branch* Refactor handling of kwargs in Bot methods (#1924)* Unify kwargs handling in Bot methods* Remove Request.get, make api_kwargs an explicit argument, move note to head of Bot class* Fix test_official* Update get_file methods* Refactor JobQueue (#1981)* First go on refactoring JobQueue* Temporarily enable tests for the v13 branch* Work on tests* Temporarily enable tests for the v13 branch* Increase coverage* Remove JobQueue.tick()# Was intended for interal use anyways# Fixes tests* Address review* Temporarily enable tests for the v13 branch* Address review* Dispatch errors* Fix handling of job_kwargs* Remove possibility to pass a Bot to JobQueue* Refactor persistence of Bot instances (#1994)* Refactor persistence of bots* User BP.set_bot in Dispatcher* Temporarily enable tests for the v13 branch* Add documentation* Add warning to Updater for passing both defaults and bot* Address review* Fix test
Bibo-Joshi added a commit that referenced this pull requestAug 16, 2020
* Refactor handling of `default_quote`* Make it a breaking change* Pickle a bots defaults* Temporarily enable tests for the v13 branch* Temporarily enable tests for the v13 branch* Refactor handling of kwargs in Bot methods (#1924)* Unify kwargs handling in Bot methods* Remove Request.get, make api_kwargs an explicit argument, move note to head of Bot class* Fix test_official* Update get_file methods* Refactor JobQueue (#1981)* First go on refactoring JobQueue* Temporarily enable tests for the v13 branch* Work on tests* Temporarily enable tests for the v13 branch* Increase coverage* Remove JobQueue.tick()# Was intended for interal use anyways# Fixes tests* Address review* Temporarily enable tests for the v13 branch* Address review* Dispatch errors* Fix handling of job_kwargs* Remove possibility to pass a Bot to JobQueue* Refactor persistence of Bot instances (#1994)* Refactor persistence of bots* User BP.set_bot in Dispatcher* Temporarily enable tests for the v13 branch* Add documentation* Add warning to Updater for passing both defaults and bot* Address review* Fix test
@github-actionsgithub-actionsbot locked asresolvedand limited conversation to collaboratorsAug 17, 2020
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@PoolitzerPoolitzerPoolitzer requested changes

Assignees
No one assigned
Labels
📋 pending-reviewwork status: pending-review
Projects
None yet
Milestone
13.0
Development

Successfully merging this pull request may close these issues.

2 participants
@Bibo-Joshi@Poolitzer

[8]ページ先頭

©2009-2025 Movatter.jp