-
Notifications
You must be signed in to change notification settings - Fork 5.7k
refactor: add enum constants #3351
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
Conversation
* add constants for `max_connections` * expand docstring for `secret_token`
* add limits for heading * add minimum proximity_alert_radius (as it is non-zero) * fix docstrings that link to HEADING constant twice instead of PROXIMITY_ALERT_RADIUS (and hence 360 was displayed instead of 100000)
This is not part of the code I'm changing, but I was just creating a class with limits for |
BTW, class |
This comment was marked as resolved.
This comment was marked as resolved.
* add links to/from `InlineQueryResultLocation` and `InputLocationMessageContent` that were not added in previous commits * note that `Location` class does not have limits specified for `live_period` and `proximity_alert_radius` but `InlineQueryResultLocation` and `InputLocationMessageContent` do
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I remember that adding class constants to Bot
is not optimal, but shouldn't I fully implement the approach laid out in description for #3107 in Dice
? Which would mean introducing class constants for emoji
and value
in Dice
class directly and linking them to constants.py
.
+ make sure the order of constants is kept in docs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you're being thorough, nice! :)
note that this approach leads to similar constants in multiple classes
Typo: "Minimum" instead of "Maximum"
reverting changes made to telegram.dice.rst in cbe20e6
Do you think I should also replace "emoji literals" in |
these are allowed lengths of strings, not allowed values
use existing class `BotCommandLimit`
minimum length is only specified in 1 class and 1 method
Saving comments by @Bibo-Joshi here: I vote to keep Putting title limits into a I also vote to keep the current
|
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
* InlineQueryResultContact* InputContactMessageContent
This comment was marked as outdated.
This comment was marked as outdated.
@@ -93,3 +106,45 @@ def __init__(self, value: int, emoji: str, *, api_kwargs: JSONDict = None): | |||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment is about the lines above this one. I didn't add any .. versionadded
to class constants that I didn't create, though I think this needs to be done. I also think that the version marking in the line immediately above this one (for BOWLING
) might be wrong: a bowling emoji was added in 13.4, but the constant itself is being introduced in 20.0. So maybe all constants referring to DiceEmoji
should also get the 20.0
marking.
(Since I wasn't changing those lines, I couldn't add a comment to them directly)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR is very high effort and simply insane. It was excruciating for me to just review over the past few days! Well done!
# Conflicts: # telegram/_bot.py # telegram/constants.py
Addresses #3107. This PR replaces #3336 that was a PR from my own fork. Instead, now it's a PR within the repository.
constants.py
::paramref:
s.. versionadded:: 20.0
to every added constant in "target" classes (e.g. like it's done for class constants inInlineQuery
)