Skip to content

Docs/CSI for asyncio #2926

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

Merged
merged 39 commits into from
Apr 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
8790b54
add docs for timeout methods in app builder
harshil21 Mar 9, 2022
254d0ad
Add two crossrefs
Bibo-Joshi Mar 9, 2022
51c5df5
Review + finish up app builder csi+docs
harshil21 Mar 11, 2022
e5f176a
Start work on documenting/reviewing application
harshil21 Mar 11, 2022
1bbe39d
Merge branch 'asyncio' and fix conflicts
harshil21 Mar 11, 2022
857d2db
Merge branch 'asyncio' into asyncio-docs-and-csi-comments
harshil21 Mar 13, 2022
cb8b4a7
more docs for application
harshil21 Mar 14, 2022
b9778d2
additional notes for updater.start_*
Bibo-Joshi Mar 14, 2022
6cac936
finish up with App (hopefully) and start with Updater
harshil21 Mar 15, 2022
2893ae8
Merge remote-tracking branch 'origin/asyncio-docs-and-csi-comments' i…
harshil21 Mar 15, 2022
da46244
review + finish persistence and updater
harshil21 Mar 16, 2022
8cda621
update function signature to async in docstrings project-wide
harshil21 Mar 16, 2022
4efe750
numerous doc fixes/improvements for handler
harshil21 Mar 16, 2022
b29a845
some filters doc fixes/improvements + add a config in conf.py
harshil21 Mar 16, 2022
ce5a08f
use coroutine instead of callable in docs
harshil21 Mar 16, 2022
6523a6f
merge asyncio and fix conflicts
harshil21 Mar 22, 2022
6757015
remove ready parameter from docs
harshil21 Mar 22, 2022
6801adb
review + fixes/improvements for application docs, also add example fo…
harshil21 Mar 22, 2022
6704244
docs for context, CBDC, contexttypes. get started for CH
harshil21 Mar 22, 2022
1c2a174
review + continue documenting CH
harshil21 Mar 23, 2022
df2d456
Some warnings about concurrent_updates & persistence
Bibo-Joshi Mar 27, 2022
cde1575
Document timeout params (and change a wrong default value on the fly)
Bibo-Joshi Mar 27, 2022
5ff5302
Merge branch 'asyncio' into asyncio-docs-and-csi-comments
Bibo-Joshi Mar 27, 2022
8f1fdee
adjust a test
Bibo-Joshi Mar 27, 2022
c5ee95f
Improve timeout docs & adjust some type hints
Bibo-Joshi Mar 27, 2022
5cccfc4
fix a type annotation
Bibo-Joshi Mar 27, 2022
f828e5d
Merge branch 'asyncio' into asyncio-docs-and-csi-comments
Bibo-Joshi Apr 1, 2022
bf478f2
finish up ext docs
harshil21 Apr 2, 2022
03d59ae
docs fix for telegram
harshil21 Apr 3, 2022
3d52dac
review
harshil21 Apr 3, 2022
fce476a
more telegram doc fixes
harshil21 Apr 3, 2022
e016040
merge asyncio and fix conflicts
harshil21 Apr 3, 2022
9d7c23d
tiny fix + deepsource
harshil21 Apr 3, 2022
55c3439
Merge branch 'asyncio' into asyncio-docs-and-csi-comments
Bibo-Joshi Apr 4, 2022
10e3c83
adjust to order changes
Bibo-Joshi Apr 4, 2022
940fb0b
Merge branch 'asyncio' into asyncio-docs-and-csi-comments
Bibo-Joshi Apr 4, 2022
8b5900b
removed old note in restrict_chat_member
harshil21 Apr 10, 2022
a4ace45
Merge branch 'asyncio' into asyncio-docs-and-csi-comments
harshil21 Apr 10, 2022
dc6adc5
Merge branch 'asyncio' into asyncio-docs-and-csi-comments
Bibo-Joshi Apr 16, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'

# Decides the language used for syntax highlighting of code blocks.
highlight_language = 'python3'

# A list of ignored prefixes for module index sorting.
#modindex_common_prefix = []

Expand Down
1,280 changes: 1,011 additions & 269 deletions telegram/_bot.py

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion telegram/_callbackquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class CallbackQuery(TelegramObject):
considered equal, if their :attr:`id` is equal.

Note:
* In Python :keyword:`from` is a reserved word, :paramref:`from_user`
* In Python :keyword:`from` is a reserved word use :paramref:`from_user` instead.
* Exactly one of the fields :attr:`data` or :attr:`game_short_name` will be present.
* After the user presses an inline button, Telegram clients will display a progress bar
until you call :attr:`answer`. It is, therefore, necessary to react
Expand Down
38 changes: 19 additions & 19 deletions telegram/_chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class Chat(TelegramObject):
Args:
id (:obj:`int`): Unique identifier for this chat. This number may be greater than 32 bits
and some programming languages may have difficulty/silent defects in interpreting it.
But it is smaller than 52 bits, so a signed 64 bit integer or double-precision float
But it is smaller than 52 bits, so a signed 64-bit integer or double-precision float
type are safe for storing this identifier.
type (:obj:`str`): Type of chat, can be either :attr:`PRIVATE`, :attr:`GROUP`,
:attr:`SUPERGROUP` or :attr:`CHANNEL`.
Expand Down Expand Up @@ -906,8 +906,8 @@ async def send_media_group(
],
disable_notification: ODVInput[bool] = DEFAULT_NONE,
reply_to_message_id: int = None,
read_timeout: float = 20,
write_timeout: float = 20,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = 20,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: JSONDict = None,
Expand Down Expand Up @@ -977,8 +977,8 @@ async def send_photo(
disable_notification: DVInput[bool] = DEFAULT_NONE,
reply_to_message_id: int = None,
reply_markup: ReplyMarkup = None,
read_timeout: float = 20,
write_timeout: float = 20,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = 20,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
parse_mode: ODVInput[str] = DEFAULT_NONE,
Expand Down Expand Up @@ -1074,8 +1074,8 @@ async def send_audio(
disable_notification: DVInput[bool] = DEFAULT_NONE,
reply_to_message_id: int = None,
reply_markup: ReplyMarkup = None,
read_timeout: float = 20,
write_timeout: float = 20,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = 20,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
parse_mode: ODVInput[str] = DEFAULT_NONE,
Expand Down Expand Up @@ -1127,8 +1127,8 @@ async def send_document(
disable_notification: DVInput[bool] = DEFAULT_NONE,
reply_to_message_id: int = None,
reply_markup: ReplyMarkup = None,
read_timeout: float = 20,
write_timeout: float = 20,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = 20,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
parse_mode: ODVInput[str] = DEFAULT_NONE,
Expand Down Expand Up @@ -1398,8 +1398,8 @@ async def send_animation(
disable_notification: DVInput[bool] = DEFAULT_NONE,
reply_to_message_id: int = None,
reply_markup: ReplyMarkup = None,
read_timeout: float = 20,
write_timeout: float = 20,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = 20,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: JSONDict = None,
Expand Down Expand Up @@ -1447,8 +1447,8 @@ async def send_sticker(
disable_notification: DVInput[bool] = DEFAULT_NONE,
reply_to_message_id: int = None,
reply_markup: ReplyMarkup = None,
read_timeout: float = 20,
write_timeout: float = 20,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = 20,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: JSONDict = None,
Expand Down Expand Up @@ -1543,8 +1543,8 @@ async def send_video(
disable_notification: DVInput[bool] = DEFAULT_NONE,
reply_to_message_id: int = None,
reply_markup: ReplyMarkup = None,
read_timeout: float = 20,
write_timeout: float = 20,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = 20,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
width: int = None,
Expand Down Expand Up @@ -1600,8 +1600,8 @@ async def send_video_note(
disable_notification: DVInput[bool] = DEFAULT_NONE,
reply_to_message_id: int = None,
reply_markup: ReplyMarkup = None,
read_timeout: float = 20,
write_timeout: float = 20,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = 20,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
thumb: FileInput = None,
Expand Down Expand Up @@ -1647,8 +1647,8 @@ async def send_voice(
disable_notification: DVInput[bool] = DEFAULT_NONE,
reply_to_message_id: int = None,
reply_markup: ReplyMarkup = None,
read_timeout: float = 20,
write_timeout: float = 20,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = 20,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
parse_mode: ODVInput[str] = DEFAULT_NONE,
Expand Down
8 changes: 1 addition & 7 deletions telegram/_chatjoinrequest.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,7 @@ class ChatJoinRequest(TelegramObject):

"""

__slots__ = (
'chat',
'from_user',
'date',
'bio',
'invite_link',
)
__slots__ = ('chat', 'from_user', 'date', 'bio', 'invite_link')

def __init__(
self,
Expand Down
2 changes: 1 addition & 1 deletion telegram/_chatmemberupdated.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class ChatMemberUpdated(TelegramObject):
.. versionadded:: 13.4

Note:
In Python :keyword:`from` is a reserved word, :paramref:`from_user`
In Python :keyword:`from` is a reserved word use :paramref:`from_user` instead.

Args:
chat (:class:`telegram.Chat`): Chat the user belongs to.
Expand Down
2 changes: 1 addition & 1 deletion telegram/_choseninlineresult.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class ChosenInlineResult(TelegramObject):
considered equal, if their :attr:`result_id` is equal.

Note:
* In Python :keyword:`from` is a reserved word, :paramref:`from_user`
* In Python :keyword:`from` is a reserved word use :paramref:`from_user` instead.
* It is necessary to enable inline feedback via `@Botfather <https://t.me/BotFather>`_ in
order to receive these objects in updates.

Expand Down
4 changes: 2 additions & 2 deletions telegram/_files/_basethumbedmedium.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@


class _BaseThumbedMedium(_BaseMedium):
"""Base class for objects representing the various media file types that may include a
thumbnail.
"""
Base class for objects representing the various media file types that may include a thumbnail.

Objects of this class are comparable in terms of equality. Two objects of this class are
considered equal, if their :attr:`file_unique_id` is equal.
Expand Down
21 changes: 15 additions & 6 deletions telegram/_files/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class File(TelegramObject):
* Maximum file size to download is
:tg-const:`telegram.constants.FileSizeLimit.FILESIZE_DOWNLOAD`.
* If you obtain an instance of this class from :attr:`telegram.PassportFile.get_file`,
then it will automatically be decrypted as it downloads when you call :attr:`download()`.
then it will automatically be decrypted as it downloads when you call :meth:`download()`.

Args:
file_id (:obj:`str`): Identifier for this file, which can be used to download
Expand All @@ -65,7 +65,7 @@ class File(TelegramObject):
is supposed to be the same over time and for different bots.
Can't be used to download or reuse the file.
file_size (:obj:`str`): Optional. File size in bytes.
file_path (:obj:`str`): Optional. File path. Use :attr:`download` to get the file.
file_path (:obj:`str`): Optional. File path. Use :meth:`download` to get the file.

"""

Expand Down Expand Up @@ -102,8 +102,8 @@ async def download(
custom_path: FilePathInput = None,
out: IO = None,
read_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
) -> Union[Path, IO]:
"""
Expand All @@ -129,9 +129,18 @@ async def download(
custom_path (:class:`pathlib.Path` | :obj:`str`, optional): Custom path.
out (:obj:`io.BufferedWriter`, optional): A file-like object. Must be opened for
writing in binary mode, if applicable.
timeout (:obj:`int` | :obj:`float`, optional): If this value is specified, use it as
the read timeout from the server (instead of the one specified during creation of
the connection pool).
read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to
:paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to
:attr:`~telegram.request.BaseRequest.DEFAULT_NONE`.
write_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to
:paramref:`telegram.request.BaseRequest.post.write_timeout`. Defaults to
:attr:`~telegram.request.BaseRequest.DEFAULT_NONE`.
connect_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to
:paramref:`telegram.request.BaseRequest.post.connect_timeout`. Defaults to
:attr:`~telegram.request.BaseRequest.DEFAULT_NONE`.
pool_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to
:paramref:`telegram.request.BaseRequest.post.pool_timeout`. Defaults to
:attr:`~telegram.request.BaseRequest.DEFAULT_NONE`.

Returns:
:class:`pathlib.Path` | :obj:`io.BufferedWriter`: The same object as :paramref:`out` if
Expand Down
10 changes: 4 additions & 6 deletions telegram/_files/inputfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,15 @@ class InputFile:
bytes.

Note:
If ``obj`` is a string, it will be encoded as bytes via ``obj.encode('utf-8')``.
If :paramref:`obj` is a string, it will be encoded as bytes via
:external:obj:`obj.encode('utf-8') <str.encode>`.
filename (:obj:`str`, optional): Filename for this InputFile.

Raises:
TelegramError

Attributes:
input_file_content (:obj:`bytes`): The binary content of the file to send.
attach_name (:obj:`str`): Attach name.
filename (:obj:`str`): Optional. Filename for the file to be sent.
mimetype (:obj:`str`): Optional. The mimetype inferred from the file to be sent.
filename (:obj:`str`): Filename for the file to be sent.
mimetype (:obj:`str`): The mimetype inferred from the file to be sent.

"""

Expand Down
Loading