8000 Fix typo in `TelegramObject._get_attrs` by harshil21 · Pull Request #4816 · python-telegram-bot/python-telegram-bot · GitHub
[go: up one dir, main page]

Skip to content

Fix typo in TelegramObject._get_attrs #4816

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 3 commits into from
Jun 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions changes/unreleased/4816.hhYVDfdzUgoQoMNRKkCDjb.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
internal = "Fix Typo in `TelegramObject._get_attrs`"
[[pull_requests]]
uid = "4816"
author_uid = "harshil21"
closes_threads = []
8 changes: 4 additions & 4 deletions src/telegram/_telegramobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ def __getstate__(self) -> dict[str, Union[str, object]]:
state (dict[:obj:`str`, :obj:`object`]): The state of the object.
"""
out = self._get_attrs(
include_private=True, recursive=False, remove_bot=True, convert_default_vault=False
include_private=True, recursive=False, remove_bot=True, convert_default_value=False
)
# MappingProxyType is not pickable, so we convert it to a dict and revert in
# __setstate__
Expand Down Expand Up @@ -528,7 +528,7 @@ def _get_attrs(
include_private: bool = False,
recursive: bool = False,
remove_bot: bool = False,
convert_default_vault: bool = True,
convert_default_value: bool = True,
) -> dict[str, Union[str, object]]:
"""This method is used for obtaining the attributes of the object.

Expand All @@ -537,7 +537,7 @@ def _get_attrs(
recursive (:obj:`bool`): If :obj:`True`, will convert any ``TelegramObjects`` (if
found) in the attributes to a dictionary. Else, preserves it as an object itself.
remove_bot (:obj:`bool`): Whether the bot should be included in the result.
convert_default_vault (:obj:`bool`): Whether :class:`telegram.DefaultValue` should be
convert_default_value (:obj:`bool`): Whether :class:`telegram.DefaultValue` should be
converted to its true value. This is necessary when converting to a dictionary for
end users since DefaultValue is used in some classes that work with
`tg.ext.defaults` (like `LinkPreviewOptions`)
Expand All @@ -550,7 +550,7 @@ def _get_attrs(
for key in self._get_attrs_names(include_private=include_private):
value = (
DefaultValue.get_value(getattr(self, key, None))
if convert_default_vault
if convert_default_value
else getattr(self, key, None)
)

Expand Down
Loading
0