From 18bed5951e8293908091d0e175f64da45f254abe Mon Sep 17 00:00:00 2001 From: Hinrich Mahler <22366557+Bibo-Joshi@users.noreply.github.com> Date: Sun, 10 Dec 2023 12:20:54 +0100 Subject: [PATCH 1/7] Explain generic slots for `ExtBot` and `Application.` Skipping `ApplicationBuilder` and `ContextTypes` b/c it's unlikely that users will have to specify these types somewhere in their code. --- telegram/ext/_application.py | 12 ++++++++++++ telegram/ext/_extbot.py | 4 ++++ 2 files changed, 16 insertions(+) diff --git a/telegram/ext/_application.py b/telegram/ext/_application.py index c5834f9c867..64021f69876 100644 --- a/telegram/ext/_application.py +++ b/telegram/ext/_application.py @@ -151,6 +151,18 @@ class Application(Generic[BT, CCT, UD, CD, BD, JQ], AsyncContextManager["Applica .. seealso:: :meth:`__aenter__` and :meth:`__aexit__`. + This class is a :class:`~typing.Generic` class and accepts five type variables: + + 1. The type of :attr:`bot`. Must be :class:`telegram.Bot` or a subclass of that class. + 2. The type of the argument ``context`` of callback functions for (error) handlers and jobs. + Must be :class:`telegram.ext.CallbackContext` or a subclass of that class. This must be + consistent with the following types. + 2. The type of the values of :attr:`user_data`. + 3. The type of the values of :attr:`chat_data`. + 4. The type of :attr:`bot_data`. + 5. The type of :attr:`job_queue`. Must either be :class:`telegram.ext.JobQueue` or a subclass + of that or :obj:`None`. + Examples: :any:`Echo Bot ` diff --git a/telegram/ext/_extbot.py b/telegram/ext/_extbot.py index 87ea704aed5..b757d858b61 100644 --- a/telegram/ext/_extbot.py +++ b/telegram/ext/_extbot.py @@ -123,6 +123,10 @@ class ExtBot(Bot, Generic[RLARGS]): This can be used to pass additional information to the rate limiter, specifically to :paramref:`telegram.ext.BaseRateLimiter.process_request.rate_limit_args`. + This class is a :class:`~typing.Generic` class and accepts one type variable that specifies + the generic type of the :attr:`rate_limiter` used by the bot. Use :obj:`None` if no rate + limiter is used. + Warning: * The keyword argument ``rate_limit_args`` can `not` be used, if :attr:`rate_limiter` is :obj:`None`. From 51ce3b89f235b53c4243c219d0b2156297d5d6ce Mon Sep 17 00:00:00 2001 From: Hinrich Mahler <22366557+Bibo-Joshi@users.noreply.github.com> Date: Sun, 10 Dec 2023 12:32:40 +0100 Subject: [PATCH 2/7] Fix sphinx --- telegram/ext/_application.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/telegram/ext/_application.py b/telegram/ext/_application.py index 64021f69876..66d7ca84014 100644 --- a/telegram/ext/_application.py +++ b/telegram/ext/_application.py @@ -151,17 +151,17 @@ class Application(Generic[BT, CCT, UD, CD, BD, JQ], AsyncContextManager["Applica .. seealso:: :meth:`__aenter__` and :meth:`__aexit__`. - This class is a :class:`~typing.Generic` class and accepts five type variables: + This class is a :class:`~typing.Generic` class and accepts six type variables: 1. The type of :attr:`bot`. Must be :class:`telegram.Bot` or a subclass of that class. 2. The type of the argument ``context`` of callback functions for (error) handlers and jobs. Must be :class:`telegram.ext.CallbackContext` or a subclass of that class. This must be consistent with the following types. - 2. The type of the values of :attr:`user_data`. - 3. The type of the values of :attr:`chat_data`. - 4. The type of :attr:`bot_data`. - 5. The type of :attr:`job_queue`. Must either be :class:`telegram.ext.JobQueue` or a subclass - of that or :obj:`None`. + 3. The type of the values of :attr:`user_data`. + 4. The type of the values of :attr:`chat_data`. + 5. The type of :attr:`bot_data`. + 6. The type of :attr:`job_queue`. Must either be :class:`telegram.ext.JobQueue` or a subclass + of that or :obj:`None`. Examples: :any:`Echo Bot ` From 2866a0c7c77b93b6e3b90415fca495daf73cfa70 Mon Sep 17 00:00:00 2001 From: Hinrich Mahler <22366557+Bibo-Joshi@users.noreply.github.com> Date: Thu, 4 Jan 2024 19:11:04 +0100 Subject: [PATCH 3/7] Hide unnecessary dunder methods in constants module --- docs/source/telegram.constants.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/source/telegram.constants.rst b/docs/source/telegram.constants.rst index 1249514650f..78d5af89944 100644 --- a/docs/source/telegram.constants.rst +++ b/docs/source/telegram.constants.rst @@ -4,3 +4,4 @@ telegram.constants Module .. automodule:: telegram.constants :members: :show-inheritance: + :inherited-members: Enum, EnumMeta From deae078eff1594ea1074643978fe5af6ba5b3905 Mon Sep 17 00:00:00 2001 From: Poolitzer Date: Mon, 8 Jan 2024 10:24:02 +0100 Subject: [PATCH 4/7] Found a misplaced ) --- telegram/_bot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/telegram/_bot.py b/telegram/_bot.py index db11b6f9758..0d339c553c4 100644 --- a/telegram/_bot.py +++ b/telegram/_bot.py @@ -4249,7 +4249,7 @@ async def send_invoice( `@BotFather `_. currency (:obj:`str`): Three-letter ISO 4217 currency code, see `more on currencies `_. - prices (Sequence[:class:`telegram.LabeledPrice`)]: Price breakdown, a sequence + prices (Sequence[:class:`telegram.LabeledPrice`]): Price breakdown, a sequence of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.). From cb478b1a1bed2ea18be5106cd1b674ed690c8c5f Mon Sep 17 00:00:00 2001 From: Kenji Tagawa <61639117+kenjitagawa@users.noreply.github.com> Date: Tue, 23 Jan 2024 18:46:15 -0500 Subject: [PATCH 5/7] Add option to download docs as zipped html (#4079) Co-authored-by: Kenji Tagawa --- .readthedocs.yml | 1 + AUTHORS.rst | 1 + 2 files changed, 2 insertions(+) diff --git a/.readthedocs.yml b/.readthedocs.yml index bd9f8c51f93..51706328d8e 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -12,6 +12,7 @@ sphinx: # Optionally build your docs in additional formats such as PDF formats: - pdf + - htmlzip # Optionally set the version of Python and requirements required to build your docs python: diff --git a/AUTHORS.rst b/AUTHORS.rst index f4e76fce889..3e4eb57e74d 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -69,6 +69,7 @@ The following wonderful people contributed directly or indirectly to this projec - `Joscha Götzer `_ - `jossalgon `_ - `JRoot3D `_ +- `kenjitagawa `_ - `kennethcheo `_ - `Kirill Vasin `_ - `Kjwon15 `_ From 488f3c5165ede9449370aba0d7054e11e1f2f2db Mon Sep 17 00:00:00 2001 From: Hinrich Mahler <22366557+Bibo-Joshi@users.noreply.github.com> Date: Sun, 4 Feb 2024 15:47:50 +0100 Subject: [PATCH 6/7] Add note on `file.seek` to `download_to_memory` --- telegram/_files/file.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/telegram/_files/file.py b/telegram/_files/file.py index 3a980152004..0b58cec9c05 100644 --- a/telegram/_files/file.py +++ b/telegram/_files/file.py @@ -231,6 +231,10 @@ async def download_to_memory( .. seealso:: :wiki:`Working with Files and Media ` + Hint: + If you want to immediately read the data from ``out`` after calling this method, you + should call ``out.seek(0)`` first. See also :meth:`io.IOBase.seek`. + .. versionadded:: 20.0 Args: From b5f5aff28b8f0b7f3b75f942f92e419d652789d6 Mon Sep 17 00:00:00 2001 From: Alexandre Rodrigues Batista <40678306+xTudoS@users.noreply.github.com> Date: Wed, 7 Feb 2024 08:56:54 -0300 Subject: [PATCH 7/7] Fix documentation version to 20.7 (#4104) --- AUTHORS.rst | 1 + CHANGES.rst | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/AUTHORS.rst b/AUTHORS.rst index 3e4eb57e74d..12867f1a062 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -25,6 +25,7 @@ The following wonderful people contributed directly or indirectly to this projec - `Abshar `_ - `Alateas `_ - `Ales Dokshanin `_ +- `Alexandre `_ - `Alizia `_ - `Ambro17 `_ - `Andrej Zhilenkov `_ diff --git a/CHANGES.rst b/CHANGES.rst index 6d793ebdaff..19c62c1926f 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -4,12 +4,12 @@ Changelog ========= -Version 20.6 +Version 20.7 ============ *Released 2023-11-27* -This is the technical changelog for version 20.6. More elaborate release notes can be found in the news channel `@pythontelegrambotchannel `__. +This is the technical changelog for version 20.7. More elaborate release notes can be found in the news channel `@pythontelegrambotchannel `__. New Features ------------