mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2025-03-16 12:25:45 +01:00
fix super calls and module docs
This commit is contained in:
parent
360c3077ea
commit
31fba47829
10 changed files with 23 additions and 26 deletions
|
@ -17,8 +17,7 @@
|
|||
# You should have received a copy of the GNU Lesser Public License
|
||||
# along with this program. If not, see [http://www.gnu.org/licenses/].
|
||||
|
||||
""" This module contains the base class for handlers as used by the
|
||||
Dispatcher """
|
||||
""" This module contains the CallbackQueryHandler class """
|
||||
|
||||
from .handler import Handler
|
||||
from telegram import Update
|
||||
|
@ -38,7 +37,7 @@ class CallbackQueryHandler(Handler):
|
|||
"""
|
||||
|
||||
def __init__(self, callback, pass_update_queue=False):
|
||||
super(Handler).__init__(callback, pass_update_queue)
|
||||
super(CallbackQueryHandler, self).__init__(callback, pass_update_queue)
|
||||
|
||||
def checkUpdate(self, update):
|
||||
return isinstance(update, Update) and update.inline_query
|
||||
|
|
|
@ -17,8 +17,7 @@
|
|||
# You should have received a copy of the GNU Lesser Public License
|
||||
# along with this program. If not, see [http://www.gnu.org/licenses/].
|
||||
|
||||
""" This module contains the base class for handlers as used by the
|
||||
Dispatcher """
|
||||
""" This module contains the ChosenInlineResultHandler class """
|
||||
|
||||
from .handler import Handler
|
||||
from telegram import Update
|
||||
|
@ -39,7 +38,7 @@ class ChosenInlineResultHandler(Handler):
|
|||
"""
|
||||
|
||||
def __init__(self, callback, pass_update_queue=False):
|
||||
super(Handler).__init__(callback, pass_update_queue)
|
||||
super(ChosenInlineResultHandler, self).__init__(callback, pass_update_queue)
|
||||
|
||||
def checkUpdate(self, update):
|
||||
return isinstance(update, Update) and update.chosen_inline_result
|
||||
|
|
|
@ -45,7 +45,7 @@ class CommandHandler(Handler):
|
|||
|
||||
def __init__(self, command, callback, pass_args=False,
|
||||
pass_update_queue=False):
|
||||
super(Handler).__init__(callback, pass_update_queue)
|
||||
super(CommandHandler, self).__init__(callback, pass_update_queue)
|
||||
self.command = command
|
||||
self.pass_args = pass_args
|
||||
|
||||
|
|
|
@ -24,9 +24,14 @@ from functools import wraps
|
|||
from threading import Thread, BoundedSemaphore, Lock, Event, current_thread
|
||||
from time import sleep
|
||||
|
||||
# Adjust for differences in Python versions
|
||||
try:
|
||||
from queue import Empty # flake8: noqa
|
||||
except ImportError:
|
||||
from Queue import Empty # flake8: noqa
|
||||
|
||||
from telegram import (TelegramError, NullHandler)
|
||||
from telegram.ext.handler import Handler
|
||||
from telegram.utils.updatequeue import Empty
|
||||
|
||||
logging.getLogger(__name__).addHandler(NullHandler())
|
||||
|
||||
|
|
|
@ -17,8 +17,7 @@
|
|||
# You should have received a copy of the GNU Lesser Public License
|
||||
# along with this program. If not, see [http://www.gnu.org/licenses/].
|
||||
|
||||
""" This module contains the base class for handlers as used by the
|
||||
Dispatcher """
|
||||
""" This module contains the InlineQueryHandler class """
|
||||
|
||||
from .handler import Handler
|
||||
from telegram import Update
|
||||
|
@ -38,7 +37,7 @@ class InlineQueryHandler(Handler):
|
|||
"""
|
||||
|
||||
def __init__(self, callback, pass_update_queue=False):
|
||||
super(Handler).__init__(callback, pass_update_queue)
|
||||
super(InlineQueryHandler, self).__init__(callback, pass_update_queue)
|
||||
|
||||
def checkUpdate(self, update):
|
||||
return isinstance(update, Update) and update.inline_query
|
||||
|
|
|
@ -17,8 +17,7 @@
|
|||
# You should have received a copy of the GNU Lesser Public License
|
||||
# along with this program. If not, see [http://www.gnu.org/licenses/].
|
||||
|
||||
""" This module contains the base class for handlers as used by the
|
||||
Dispatcher """
|
||||
""" This module contains the MessageHandler class """
|
||||
|
||||
from .handler import Handler
|
||||
from telegram import Update
|
||||
|
@ -46,7 +45,7 @@ class MessageHandler(Handler):
|
|||
"""
|
||||
|
||||
def __init__(self, filters, callback, pass_update_queue=False):
|
||||
super(Handler).__init__(callback, pass_update_queue)
|
||||
super(MessageHandler, self).__init__(callback, pass_update_queue)
|
||||
self.filters = filters
|
||||
|
||||
def checkUpdate(self, update):
|
||||
|
|
|
@ -17,8 +17,7 @@
|
|||
# You should have received a copy of the GNU Lesser Public License
|
||||
# along with this program. If not, see [http://www.gnu.org/licenses/].
|
||||
|
||||
""" This module contains the base class for handlers as used by the
|
||||
Dispatcher """
|
||||
""" This module contains the RegexHandler class """
|
||||
|
||||
import re
|
||||
|
||||
|
@ -51,7 +50,7 @@ class RegexHandler(Handler):
|
|||
|
||||
def __init__(self, pattern, callback, pass_groups=False,
|
||||
pass_groupdict=False, pass_update_queue=False):
|
||||
super(Handler).__init__(callback, pass_update_queue)
|
||||
super(RegexHandler, self).__init__(callback, pass_update_queue)
|
||||
|
||||
if isinstance(pattern, str):
|
||||
pattern = re.compile(pattern)
|
||||
|
|
|
@ -17,8 +17,7 @@
|
|||
# You should have received a copy of the GNU Lesser Public License
|
||||
# along with this program. If not, see [http://www.gnu.org/licenses/].
|
||||
|
||||
""" This module contains the base class for handlers as used by the
|
||||
Dispatcher """
|
||||
""" This module contains the StringCommandHandler class """
|
||||
|
||||
from .handler import Handler
|
||||
|
||||
|
@ -44,7 +43,7 @@ class StringCommandHandler(Handler):
|
|||
|
||||
def __init__(self, command, callback, pass_args=False,
|
||||
pass_update_queue=False):
|
||||
super(Handler).__init__(callback, pass_update_queue)
|
||||
super(StringCommandHandler, self).__init__(callback, pass_update_queue)
|
||||
self.command = command
|
||||
self.pass_args = pass_args
|
||||
|
||||
|
|
|
@ -17,8 +17,7 @@
|
|||
# You should have received a copy of the GNU Lesser Public License
|
||||
# along with this program. If not, see [http://www.gnu.org/licenses/].
|
||||
|
||||
""" This module contains the base class for handlers as used by the
|
||||
Dispatcher """
|
||||
""" This module contains the StringRegexHandler class """
|
||||
|
||||
import re
|
||||
|
||||
|
@ -50,7 +49,7 @@ class StringRegexHandler(Handler):
|
|||
|
||||
def __init__(self, pattern, callback, pass_groups=False,
|
||||
pass_groupdict=False, pass_update_queue=False):
|
||||
super(Handler).__init__(callback, pass_update_queue)
|
||||
super(StringRegexHandler, self).__init__(callback, pass_update_queue)
|
||||
|
||||
if isinstance(pattern, str):
|
||||
pattern = re.compile(pattern)
|
||||
|
|
|
@ -17,8 +17,7 @@
|
|||
# You should have received a copy of the GNU Lesser Public License
|
||||
# along with this program. If not, see [http://www.gnu.org/licenses/].
|
||||
|
||||
""" This module contains the base class for handlers as used by the
|
||||
Dispatcher """
|
||||
""" This module contains the TypeHandler class """
|
||||
|
||||
from .handler import Handler
|
||||
|
||||
|
@ -41,7 +40,7 @@ class TypeHandler(Handler):
|
|||
"""
|
||||
|
||||
def __init__(self, type, callback, strict=False, pass_update_queue=False):
|
||||
super(Handler).__init__(callback, pass_update_queue)
|
||||
super(TypeHandler, self).__init__(callback, pass_update_queue)
|
||||
self.type = type
|
||||
self.strict = strict
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue