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

Drop if clauses from each Bot method #3396

Merged
merged 4 commits into from Dec 1, 2022
Merged

Conversation

harshil21
Copy link
Member

Simplifies the bot methods by passing all arguments in data. Since None values are dropped in Bot._post anyway, we can do this safely

Checklist for PRs

  • Added .. versionadded:: version, .. versionchanged:: version or .. deprecated:: version to the docstrings for user facing changes (for methods/class descriptions, arguments and attributes)
  • Created new or adapted existing unit tests
  • Documented code changes according to the CSI standard
  • Added myself alphabetically to AUTHORS.rst (optional)
  • Added new classes & modules to the docs and all suitable __all__ s

Copy link
Member

@Bibo-Joshi Bibo-Joshi left a comment

Choose a reason for hiding this comment

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

Left a few comments :)

BTW small script for double checking for typos:

import re
from pathlib import Path

bot = Path("telegram/_bot.py")
text = bot.read_text(encoding="utf-8")

for match in re.finditer(r"\"([\w_]+)\"\: ([^\},]+)(\}|,)", text):
    if match.group(1) != match.group(2) and not match.group(2).startswith(
        f"self._parse_file_input({match.group(1)}"
    ):
        print(f'"{match.group(1)}": {match.group(2)}')

telegram/_bot.py Outdated Show resolved Hide resolved
telegram/_bot.py Outdated Show resolved Hide resolved
tests/test_bot.py Show resolved Hide resolved
telegram/_bot.py Outdated Show resolved Hide resolved
telegram/_bot.py Outdated Show resolved Hide resolved
Copy link
Member

@Bibo-Joshi Bibo-Joshi left a comment

Choose a reason for hiding this comment

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

Sweet, then I'm happy as well 👍 If there is nothing left from your side, give me a short ping and I'll merge :)

@harshil21
Copy link
Member Author

yep all good 👍🏽

@Bibo-Joshi Bibo-Joshi merged commit 4123e7a into master Dec 1, 2022
@Bibo-Joshi Bibo-Joshi deleted the drop-if-stmts-bot-methods branch December 1, 2022 18:26
@github-actions github-actions bot locked and limited conversation to collaborators Dec 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants