harshil21 · GitHub

@harshil21

Copy link Copy Markdown

Member

Closes #2467

Notes:

  • Made Telegram{User, Deprecation}Warning public and is accessible by telegram.utils.deprecate. We can change it later depending on Clear up imports policy #2468. Edit: Review now made it accessible via telegram.utils.warnings

  • some warnings don't have stacklevels because they take place in another thread so its not possible to get the caller

  • update some warning messages to be more descriptive.

Bibo-Joshi

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.

Looks good so far! Comments:

  • Even if import policy is changed in #2468, we should probably rename utils.deprecate to utils.warnings already since that file is now no longer exclusively for deprecation
  • Just a thought: Maybe it's worth adding a function utils.warnings.warn, which acts as a shortcut for warnings.warn with a default category=TelegramUserWarning?
  • Another thought: Maybe PTB*Warning is better than TG*Warning b/c the warnings are issued by PTB and not by TG?

Merged

4 tasks

@harshil21

Bibo-Joshi

Bibo-Joshi

@Bibo-Joshi

@Bibo-Joshi

Read the original on github.com ↗