From ca525b5bead9497d3bf531a7a94353cef0074f6d Mon Sep 17 00:00:00 2001 From: _run Date: Wed, 29 Jun 2022 21:06:36 +0500 Subject: [PATCH 1/4] Copyright changes --- telebot/callback_data.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/telebot/callback_data.py b/telebot/callback_data.py index 17bf27f..952030c 100644 --- a/telebot/callback_data.py +++ b/telebot/callback_data.py @@ -1,3 +1,11 @@ +# https://github.com/aiogram/aiogram/blob/dev-2.x/LICENSE +""" +This file was added during the pull request. The maintainers overlooked that +it was copied "as is" from another project and they do not consider it as a +right way to develop a project. However, due to backward compatibility we had +to leave this file in the project with the above copyright added, +as it is required by the original project license. +""" import typing From c36f3a228e3b0a964c2e80977a9ffdb906070b26 Mon Sep 17 00:00:00 2001 From: _run Date: Wed, 29 Jun 2022 21:17:57 +0500 Subject: [PATCH 2/4] Update callback_data.py --- telebot/callback_data.py | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/telebot/callback_data.py b/telebot/callback_data.py index 952030c..c85b9e3 100644 --- a/telebot/callback_data.py +++ b/telebot/callback_data.py @@ -1,4 +1,24 @@ -# https://github.com/aiogram/aiogram/blob/dev-2.x/LICENSE +""" +Copyright (c) 2017-2018 Alex Root Junior + +Permission is hereby granted, free of charge, to any person obtaining a copy of this +software and associated documentation files (the "Software"), to deal in the Software +without restriction, including without limitation the rights to use, copy, modify, +merge, publish, distribute, sublicense, and/or sell copies of the Software, +and to permit persons to whom the Software is furnished to do so, subject to the +following conditions: + +The above copyright notice and this permission notice shall be included in all copies +or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS +BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE +OR OTHER DEALINGS IN THE SOFTWARE. +""" + """ This file was added during the pull request. The maintainers overlooked that it was copied "as is" from another project and they do not consider it as a From 419bc5878f52ea84c6518b89e5c2d0cc69f1765c Mon Sep 17 00:00:00 2001 From: _run Date: Thu, 30 Jun 2022 17:06:39 +0500 Subject: [PATCH 3/4] Fix typehint for ```set_state``` --- telebot/__init__.py | 4 ++-- telebot/async_telebot.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/telebot/__init__.py b/telebot/__init__.py index f034cca..a7f3694 100644 --- a/telebot/__init__.py +++ b/telebot/__init__.py @@ -34,7 +34,7 @@ logger.addHandler(console_output_handler) logger.setLevel(logging.ERROR) from telebot import apihelper, util, types -from telebot.handler_backends import MemoryHandlerBackend, FileHandlerBackend, BaseMiddleware, CancelUpdate, SkipHandler +from telebot.handler_backends import MemoryHandlerBackend, FileHandlerBackend, BaseMiddleware, CancelUpdate, SkipHandler, State from telebot.custom_filters import SimpleCustomFilter, AdvancedCustomFilter @@ -2927,7 +2927,7 @@ class TeleBot: - def set_state(self, user_id: int, state: Union[int, str], chat_id: int=None) -> None: + def set_state(self, user_id: int, state: Union[int, str, State], chat_id: int=None) -> None: """ Sets a new state of a user. diff --git a/telebot/async_telebot.py b/telebot/async_telebot.py index dce9dec..9571c04 100644 --- a/telebot/async_telebot.py +++ b/telebot/async_telebot.py @@ -14,7 +14,7 @@ import telebot.types # storages from telebot.asyncio_storage import StateMemoryStorage, StatePickleStorage -from telebot.asyncio_handler_backends import CancelUpdate, SkipHandler +from telebot.asyncio_handler_backends import CancelUpdate, SkipHandler, State from inspect import signature @@ -3455,7 +3455,7 @@ class AsyncTeleBot: return await asyncio_helper.delete_sticker_from_set(self.token, sticker) - async def set_state(self, user_id: int, state: str, chat_id: int=None): + async def set_state(self, user_id: int, state: Union[State, int, str], chat_id: int=None): """ Sets a new state of a user. From 6d12b1f2a7a3fb62337af62bf55d1e785e465146 Mon Sep 17 00:00:00 2001 From: _run Date: Thu, 30 Jun 2022 17:10:14 +0500 Subject: [PATCH 4/4] Update callback_data.py --- telebot/callback_data.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/telebot/callback_data.py b/telebot/callback_data.py index c85b9e3..58fa0d5 100644 --- a/telebot/callback_data.py +++ b/telebot/callback_data.py @@ -17,15 +17,14 @@ PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + +This file was added during the pull request. The maintainers overlooked that it was copied +"as is" from another project and they do not consider it as a right way to develop a project. +However, due to backward compatibility we had to leave this file in the project with the above +copyright added, as it is required by the original project license. """ -""" -This file was added during the pull request. The maintainers overlooked that -it was copied "as is" from another project and they do not consider it as a -right way to develop a project. However, due to backward compatibility we had -to leave this file in the project with the above copyright added, -as it is required by the original project license. -""" import typing