Bugfix for "Available In" Admonitions (#4413)

This commit is contained in:
Harshil 2024-08-03 16:47:38 -04:00 committed by GitHub
parent 9c50a38512
commit 1787586902
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 3 deletions

View file

@ -140,7 +140,7 @@ class AdmonitionInserter:
r"^\s*(?P<attr_name>[a-z_]+)" # Any number of spaces, named group for attribute r"^\s*(?P<attr_name>[a-z_]+)" # Any number of spaces, named group for attribute
r"\s?\(" # Optional whitespace, opening parenthesis r"\s?\(" # Optional whitespace, opening parenthesis
r".*" # Any number of characters (that could denote a built-in type) r".*" # Any number of characters (that could denote a built-in type)
r":class:`.+`" # Marker of a classref, class name in backticks r":(class|obj):`.+`" # Marker of a classref, class name in backticks
r".*\):" # Any number of characters, closing parenthesis, colon. r".*\):" # Any number of characters, closing parenthesis, colon.
# The ^ colon above along with parenthesis is important because it makes sure that # The ^ colon above along with parenthesis is important because it makes sure that
# the class is mentioned in the attribute description, not in free text. # the class is mentioned in the attribute description, not in free text.
@ -149,11 +149,11 @@ class AdmonitionInserter:
) )
# for properties: there is no attr name in docstring. Just check if there's a class name. # for properties: there is no attr name in docstring. Just check if there's a class name.
prop_docstring_pattern = re.compile(r":class:`.+`.*:") prop_docstring_pattern = re.compile(r":(class|obj):`.+`.*:")
# pattern for iterating over potentially many class names in docstring for one attribute. # pattern for iterating over potentially many class names in docstring for one attribute.
# Tilde is optional (sometimes it is in the docstring, sometimes not). # Tilde is optional (sometimes it is in the docstring, sometimes not).
single_class_name_pattern = re.compile(r":class:`~?(?P<class_name>[\w.]*)`") single_class_name_pattern = re.compile(r":(class|obj):`~?(?P<class_name>[\w.]*)`")
classes_to_inspect = inspect.getmembers(telegram, inspect.isclass) + inspect.getmembers( classes_to_inspect = inspect.getmembers(telegram, inspect.isclass) + inspect.getmembers(
telegram.ext, inspect.isclass telegram.ext, inspect.isclass
@ -366,6 +366,7 @@ class AdmonitionInserter:
# to ".. admonition: Examples": # to ".. admonition: Examples":
".. admonition:: Examples", ".. admonition:: Examples",
".. version", ".. version",
"Args:",
# The space after ":param" is important because docstring can contain # The space after ":param" is important because docstring can contain
# ":paramref:" in its plain text in the beginning of a line (e.g. ExtBot): # ":paramref:" in its plain text in the beginning of a line (e.g. ExtBot):
":param ", ":param ",

View file

@ -30,6 +30,8 @@ class RefundedPayment(TelegramObject):
Objects of this class are comparable in terms of equality. Two objects of this class are Objects of this class are comparable in terms of equality. Two objects of this class are
considered equal, if their :attr:`telegram_payment_charge_id` is equal. considered equal, if their :attr:`telegram_payment_charge_id` is equal.
.. versionadded:: 21.4
Args: Args:
currency (:obj:`str`): Three-letter ISO 4217 `currency currency (:obj:`str`): Three-letter ISO 4217 `currency
<https://core.telegram.org/bots/payments#supported-currencies>`_ code, or ``XTR`` for <https://core.telegram.org/bots/payments#supported-currencies>`_ code, or ``XTR`` for