From 17875869022050e724b0d2c6163196f03e7b79b1 Mon Sep 17 00:00:00 2001 From: Harshil <37377066+harshil21@users.noreply.github.com> Date: Sat, 3 Aug 2024 16:47:38 -0400 Subject: [PATCH] Bugfix for "Available In" Admonitions (#4413) --- docs/auxil/admonition_inserter.py | 7 ++++--- telegram/_payment/refundedpayment.py | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/docs/auxil/admonition_inserter.py b/docs/auxil/admonition_inserter.py index 4227a8453..945502533 100644 --- a/docs/auxil/admonition_inserter.py +++ b/docs/auxil/admonition_inserter.py @@ -140,7 +140,7 @@ class AdmonitionInserter: r"^\s*(?P[a-z_]+)" # Any number of spaces, named group for attribute r"\s?\(" # Optional whitespace, opening parenthesis 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. # 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. @@ -149,11 +149,11 @@ class AdmonitionInserter: ) # 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. # Tilde is optional (sometimes it is in the docstring, sometimes not). - single_class_name_pattern = re.compile(r":class:`~?(?P[\w.]*)`") + single_class_name_pattern = re.compile(r":(class|obj):`~?(?P[\w.]*)`") classes_to_inspect = inspect.getmembers(telegram, inspect.isclass) + inspect.getmembers( telegram.ext, inspect.isclass @@ -366,6 +366,7 @@ class AdmonitionInserter: # to ".. admonition: Examples": ".. admonition:: Examples", ".. version", + "Args:", # The space after ":param" is important because docstring can contain # ":paramref:" in its plain text in the beginning of a line (e.g. ExtBot): ":param ", diff --git a/telegram/_payment/refundedpayment.py b/telegram/_payment/refundedpayment.py index 19bdfe846..28d522262 100644 --- a/telegram/_payment/refundedpayment.py +++ b/telegram/_payment/refundedpayment.py @@ -30,6 +30,8 @@ class RefundedPayment(TelegramObject): 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. + .. versionadded:: 21.4 + Args: currency (:obj:`str`): Three-letter ISO 4217 `currency `_ code, or ``XTR`` for