Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Bot API 7.11#4546

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Bibo-Joshi merged 11 commits intomasterfromapi-7.11
Nov 4, 2024
Merged

Bot API 7.11#4546

Bibo-Joshi merged 11 commits intomasterfromapi-7.11
Nov 4, 2024

Conversation

Bibo-Joshi
Copy link
Member

@Bibo-JoshiBibo-Joshi commentedNov 1, 2024
edited
Loading

closes#4543. Please have a look at that issue for how the work is distributed.

  • Added.. versionadded:: NEXT.VERSION,.. versionchanged:: NEXT.VERSION,.. deprecated:: NEXT.VERSION or.. versionremoved:: NEXT.VERSION to the docstrings for user facing changes (for methods/class descriptions, arguments and attributes)
  • Created new or adapted existing unit tests
  • Documented code changes according to theCSI standard
  • Added myself alphabetically toAUTHORS.rst (optional)
  • Added new classes & modules to the docs and all suitable__all__ s
  • Checked theStability Policy in case of deprecations or changes to documented behavior

If the PR contains API changes (otherwise, you can ignore this passage)

  • Checked the Bot API specific sections of theStability Policy

  • Created a PR to remove functionality deprecated in the previous Bot API release (see here)

  • New classes:

    • Addedself._id_attrs and corresponding documentation
    • __init__ acceptsapi_kwargs as kw-only
  • Added new shortcuts:

    • Intelegram.Chat &telegram.User for all methods that acceptchat/user_id
    • Intelegram.Message for all methods that acceptchat_id andmessage_id
    • For newtelegram.Message shortcuts: Addedquote argument if methods acceptsreply_to_message_id
    • Intelegram.CallbackQuery for all methods that accept eitherchat_id andmessage_id orinline_message_id
  • If relevant:

    • Added new constants attelegram.constants and shortcuts to them as class variables
    • Link new and existing constants in docstrings instead of hard-coded numbers and strings
    • Add new message types totelegram.Message.effective_attachment
    • Added new handlers for new update types
      • Add the handlers to the warning loop in thetelegram.ext.ConversationHandler
    • Added new filters for new message (sub)types
    • Added or updated documentation for the changed class(es) and/or method(s)
    • Added the new method(s) to_extbot.py
    • Added or updatedbot_methods.rst
    • Updated the Bot API version number in all places:README.rst (including the badge) andtelegram.constants.BOT_API_VERSION_INFO
    • Added logic for arbitrary callback data intelegram.ext.ExtBot for new methods that either accept areply_markup in some form or have a return type that is/containstelegram.Message

@Bibo-JoshiBibo-Joshi added the ⚙️ bot-apiaffected functionality: bot-api labelNov 1, 2024
@codecovCodecov
Copy link

codecovbot commentedNov 1, 2024
edited
Loading

❌ 1 Tests Failed:

Tests completedFailedPassedSkipped
600416003271
View the top 1 failed tests by shortest run time
tests.test_callbackquery.TestCallbackQueryWithoutRequest test_copy_message[message]
Stack Traces | 0.002s run time
self = <tests.test_callbackquery.TestCallbackQueryWithoutRequest object at 0x0000022AA3095AE0>monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x0000022AA306B3F0>callback_query = CallbackQuery(chat_instance='chat_instance', data='data', from_user=User(first_name='test_user', id=1, is_bot=False), ...ser=User(first_name='bot', id=5, is_bot=False), group_chat_created=False, message_id=3, supergroup_chat_created=False))    async def test_copy_message(self, monkeypatch, callback_query):        if isinstance(callback_query.message, InaccessibleMessage):            with pytest.raises(TypeError, match="inaccessible message"):                await callback_query.copy_message(1)            return        if callback_query.inline_message_id:            pytest.skip("Can't copy inline messages")            async def make_assertion(*args, **kwargs):            id_ = kwargs["from_chat_id"] == callback_query.message.chat_id            chat_id = kwargs["chat_id"] == 1            message = kwargs["message_id"] == callback_query.message.message_id            return id_ and message and chat_id    >       assert check_shortcut_signature(            CallbackQuery.copy_message,            Bot.copy_message,            ["message_id", "from_chat_id"],            [],        )tests\test_callbackquery.py:527: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _shortcut = <function CallbackQuery.copy_message at 0x0000022AA018DA80>bot_method = <function Bot.copy_message at 0x0000022AA01E1D00>shortcut_kwargs = ['message_id', 'from_chat_id'], additional_kwargs = []annotation_overrides = {}    def check_shortcut_signature(        shortcut: Callable,        bot_method: Callable,        shortcut_kwargs: list[str],        additional_kwargs: list[str],        annotation_overrides: Optional[dict[str, tuple[Any, Any]]] = None,    ) -> bool:        """        Checks that the signature of a shortcut matches the signature of the underlying bot method.            Args:            shortcut: The shortcut, e.g. :meth:`telegram.Message.reply_text`            bot_method: The bot method, e.g. :meth:`telegram.Bot.send_message`            shortcut_kwargs: The kwargs passed by the shortcut directly, e.g. ``chat_id``            additional_kwargs: Additional kwargs of the shortcut that the bot method doesn't have, e.g.                ``quote``.            annotation_overrides: A dictionary of exceptions for the annotation comparison. The key is                the name of the argument, the value is a tuple of the expected annotation and                the default value. E.g. ``{'parse_mode': (str, 'None')}``.            Returns:            :obj:`bool`: Whether or not the signature matches.        """        annotation_overrides = annotation_overrides or {}            def resolve_class(class_name: str) -> Optional[type]:            """Attempts to resolve a PTB class (telegram module only) from a ForwardRef.                E.g. resolves <class 'telegram._files.sticker.StickerSet'> from "StickerSet".                Returns a class on success, :obj:`None` if nothing could be resolved.            """            for module in telegram, telegram.request:                cls = getattr(module, class_name, None)                if cls is not None:                    return cls            return None  # for ruff            shortcut_sig = inspect.signature(shortcut)        effective_shortcut_args = set(shortcut_sig.parameters.keys()).difference(additional_kwargs)        effective_shortcut_args.discard("self")            bot_sig = inspect.signature(bot_method)        expected_args = set(bot_sig.parameters.keys()).difference(shortcut_kwargs)        expected_args.discard("self")            len_expected = len(expected_args)        len_effective = len(effective_shortcut_args)        if len_expected > len_effective:>           raise Exception(                f"Shortcut signature is missing {len_expected - len_effective} arguments "                f"of the underlying Bot method: {expected_args - effective_shortcut_args}"            )E           Exception: Shortcut signature is missing 1 arguments of the underlying Bot method: {'allow_paid_broadcast'}tests\auxil\bot_method_checks.py:107: Exception

To view individual test run time comparison to the main branch, go to theTest Analytics Dashboard

@Bibo-JoshiBibo-Joshi mentioned this pull requestNov 1, 2024
5 tasks
@Bibo-JoshiBibo-Joshi mentioned this pull requestNov 2, 2024
6 tasks
Copy link
MemberAuthor

@Bibo-JoshiBibo-Joshi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Scrolled through the changes one more time and didn't find anything suspicious. Checks pass - merging.

@Bibo-JoshiBibo-Joshi merged commit62f8975 intomasterNov 4, 2024
24 checks passed
@Bibo-JoshiBibo-Joshi deleted the api-7.11 branchNovember 4, 2024 19:11
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsNov 12, 2024
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers
No reviews
Assignees
No one assigned
Labels
⚙️ bot-apiaffected functionality: bot-api
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

[FEATURE] API 7.11
1 participant
@Bibo-Joshi

[8]ページ先頭

©2009-2025 Movatter.jp