From c486c396da87e45578333a3fb023cc845bcc4425 Mon Sep 17 00:00:00 2001 From: Bibo-Joshi <22366557+Bibo-Joshi@users.noreply.github.com> Date: Fri, 1 Oct 2021 16:51:03 +0200 Subject: [PATCH] Doc Fixes (#2597) Co-authored-by: Harshil <37377066+harshil21@users.noreply.github.com> Co-authored-by: poolitzer <25934244+Poolitzer@users.noreply.github.com> --- README.rst | 2 +- README_RAW.rst | 2 +- docs/requirements-docs.txt | 2 +- docs/source/conf.py | 2 +- examples/README.md | 2 +- telegram/bot.py | 17 ++++++++--------- telegram/constants.py | 14 +++++++------- telegram/ext/jobqueue.py | 5 +---- telegram/files/inputfile.py | 1 + telegram/files/location.py | 2 +- 10 files changed, 23 insertions(+), 26 deletions(-) diff --git a/README.rst b/README.rst index f14d8942c..06be5a4b9 100644 --- a/README.rst +++ b/README.rst @@ -144,7 +144,7 @@ Optional Dependencies PTB can be installed with optional dependencies: * ``pip install python-telegram-bot[passport]`` installs the `cryptography `_ library. Use this, if you want to use Telegram Passport related functionality. -* ``pip install python-telegram-bot[ujson]`` installs the `ujson `_ library. It will then be used for JSON de- & encoding, which can bring speed up compared to the standard `json `_ library. +* ``pip install python-telegram-bot[json]`` installs the `ujson `_ library. It will then be used for JSON de- & encoding, which can bring speed up compared to the standard `json `_ library. * ``pip install python-telegram-bot[socks]`` installs the `PySocks `_ library. Use this, if you want to work behind a Socks5 server. =============== diff --git a/README_RAW.rst b/README_RAW.rst index 33cfcfbd4..405877701 100644 --- a/README_RAW.rst +++ b/README_RAW.rst @@ -144,7 +144,7 @@ Optional Dependencies PTB can be installed with optional dependencies: * ``pip install python-telegram-bot-raw[passport]`` installs the `cryptography `_ library. Use this, if you want to use Telegram Passport related functionality. -* ``pip install python-telegram-bot-raw[ujson]`` installs the `ujson `_ library. It will then be used for JSON de- & encoding, which can bring speed up compared to the standard `json `_ library. +* ``pip install python-telegram-bot-raw[json]`` installs the `ujson `_ library. It will then be used for JSON de- & encoding, which can bring speed up compared to the standard `json `_ library. =============== Getting started diff --git a/docs/requirements-docs.txt b/docs/requirements-docs.txt index 0c35bfae7..7c297765d 100644 --- a/docs/requirements-docs.txt +++ b/docs/requirements-docs.txt @@ -1,4 +1,4 @@ -sphinx==3.5.4 +sphinx==4.2.0 sphinx-pypi-upload # When bumping this, make sure to rebuild the dark-mode CSS # More instructions at source/_static/dark.css diff --git a/docs/source/conf.py b/docs/source/conf.py index 02e53b031..2f2eec292 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -23,7 +23,7 @@ sys.path.insert(0, os.path.abspath('../..')) # -- General configuration ------------------------------------------------ # If your documentation needs a minimal Sphinx version, state it here. -needs_sphinx = '3.5.2' +needs_sphinx = '4.2.0' # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom diff --git a/examples/README.md b/examples/README.md index 7deb05ff3..617f259e3 100644 --- a/examples/README.md +++ b/examples/README.md @@ -25,7 +25,7 @@ A even more complex example of a bot that uses the nested `ConversationHandler`s A basic example of a bot store conversation state and user_data over multiple restarts. ### [`inlinekeyboard.py`](https://github.com/python-telegram-bot/python-telegram-bot/blob/master/examples/inlinekeyboard.py) -This example sheds some light on inline keyboards, callback queries and message editing. A wikipedia site explaining this examples lives at https://git.io/JOmFw. +This example sheds some light on inline keyboards, callback queries and message editing. A wiki site explaining this examples lives at https://git.io/JOmFw. ### [`inlinekeyboard2.py`](https://github.com/python-telegram-bot/python-telegram-bot/blob/master/examples/inlinekeyboard2.py) A more complex example about inline keyboards, callback queries and message editing. This example showcases how an interactive menu could be build using inline keyboards. diff --git a/telegram/bot.py b/telegram/bot.py index 579716954..d79f6944c 100644 --- a/telegram/bot.py +++ b/telegram/bot.py @@ -1780,8 +1780,8 @@ class Bot(TelegramObject): Telegram API. Returns: - :class:`telegram.Message`: On success, if edited message is sent by the bot, the - sent Message is returned, otherwise :obj:`True` is returned. + :class:`telegram.Message`: On success, if edited message is not an inline message, the + edited message is returned, otherwise :obj:`True` is returned. """ data: JSONDict = {} @@ -2810,7 +2810,7 @@ class Bot(TelegramObject): Use this method to edit animation, audio, document, photo, or video messages. If a message is part of a message album, then it can be edited only to an audio for audio albums, only to a document for document albums and to a photo or a video otherwise. When an inline - message is edited, a new file can't be uploaded. Use a previously uploaded file via its + message is edited, a new file can't be uploaded; use a previously uploaded file via its ``file_id`` or specify a URL. Args: @@ -2832,8 +2832,8 @@ class Bot(TelegramObject): Telegram API. Returns: - :class:`telegram.Message`: On success, if edited message is not an inline message, the - edited Message is returned, otherwise :obj:`True` is returned. + :class:`telegram.Message`: On success, if the edited message is not an inline message + , the edited Message is returned, otherwise :obj:`True` is returned. Raises: :class:`telegram.error.TelegramError` @@ -3398,7 +3398,7 @@ class Bot(TelegramObject): api_kwargs: JSONDict = None, ) -> Union[Message, bool]: """ - Use this method to set the score of the specified user in a game. + Use this method to set the score of the specified user in a game message. Args: user_id (:obj:`int`): User identifier. @@ -3420,7 +3420,7 @@ class Bot(TelegramObject): Telegram API. Returns: - :class:`telegram.Message`: The edited message, or if the message wasn't sent by the bot + :class:`telegram.Message`: The edited message. If the message is not an inline message , :obj:`True`. Raises: @@ -5211,8 +5211,7 @@ class Bot(TelegramObject): Telegram API. Returns: - :class:`telegram.Poll`: On success, the stopped Poll with the final results is - returned. + :class:`telegram.Poll`: On success, the stopped Poll is returned. Raises: :class:`telegram.error.TelegramError` diff --git a/telegram/constants.py b/telegram/constants.py index c157c6488..80cce4df1 100644 --- a/telegram/constants.py +++ b/telegram/constants.py @@ -220,25 +220,25 @@ Attributes: Attributes: BOT_COMMAND_SCOPE_DEFAULT (:obj:`str`): ``'default'`` - ..versionadded:: 13.7 + .. versionadded:: 13.7 BOT_COMMAND_SCOPE_ALL_PRIVATE_CHATS (:obj:`str`): ``'all_private_chats'`` - ..versionadded:: 13.7 + .. versionadded:: 13.7 BOT_COMMAND_SCOPE_ALL_GROUP_CHATS (:obj:`str`): ``'all_group_chats'`` - ..versionadded:: 13.7 + .. versionadded:: 13.7 BOT_COMMAND_SCOPE_ALL_CHAT_ADMINISTRATORS (:obj:`str`): ``'all_chat_administrators'`` - ..versionadded:: 13.7 + .. versionadded:: 13.7 BOT_COMMAND_SCOPE_CHAT (:obj:`str`): ``'chat'`` - ..versionadded:: 13.7 + .. versionadded:: 13.7 BOT_COMMAND_SCOPE_CHAT_ADMINISTRATORS (:obj:`str`): ``'chat_administrators'`` - ..versionadded:: 13.7 + .. versionadded:: 13.7 BOT_COMMAND_SCOPE_CHAT_MEMBER (:obj:`str`): ``'chat_member'`` - ..versionadded:: 13.7 + .. versionadded:: 13.7 """ from typing import List diff --git a/telegram/ext/jobqueue.py b/telegram/ext/jobqueue.py index 132abea51..25db6c9df 100644 --- a/telegram/ext/jobqueue.py +++ b/telegram/ext/jobqueue.py @@ -41,8 +41,6 @@ class JobQueue: Attributes: scheduler (:class:`apscheduler.schedulers.background.BackgroundScheduler`): The APScheduler - bot (:class:`telegram.Bot`): The bot instance that should be passed to the jobs. - DEPRECATED: Use :attr:`set_dispatcher` instead. """ @@ -111,8 +109,7 @@ class JobQueue: return time def set_dispatcher(self, dispatcher: 'Dispatcher') -> None: - """Set the dispatcher to be used by this JobQueue. Use this instead of passing a - :class:`telegram.Bot` to the JobQueue, which is deprecated. + """Set the dispatcher to be used by this JobQueue. Args: dispatcher (:class:`telegram.ext.Dispatcher`): The dispatcher. diff --git a/telegram/files/inputfile.py b/telegram/files/inputfile.py index 76d0b037f..d76f2a8bc 100644 --- a/telegram/files/inputfile.py +++ b/telegram/files/inputfile.py @@ -47,6 +47,7 @@ class InputFile: input_file_content (:obj:`bytes`): The binary content of the file to send. filename (:obj:`str`): Optional. Filename for the file to be sent. attach (:obj:`str`): Optional. Attach id for sending multiple files. + mimetype (:obj:`str`): Optional. The mimetype inferred from the file to be sent. """ diff --git a/telegram/files/location.py b/telegram/files/location.py index b8fdaebad..8c4eebaa3 100644 --- a/telegram/files/location.py +++ b/telegram/files/location.py @@ -27,7 +27,7 @@ class Location(TelegramObject): """This object represents a point on the map. Objects of this class are comparable in terms of equality. Two objects of this class are - considered equal, if their :attr:`longitute` and :attr:`latitude` are equal. + considered equal, if their :attr:`longitude` and :attr:`latitude` are equal. Args: longitude (:obj:`float`): Longitude as defined by sender.