X Tutup
Skip to content

Commit 31fba47

Browse files
committed
fix super calls and module docs
1 parent 360c307 commit 31fba47

10 files changed

+23
-26
lines changed

telegram/ext/callbackqueryhandler.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@
1717
# You should have received a copy of the GNU Lesser Public License
1818
# along with this program. If not, see [http://www.gnu.org/licenses/].
1919

20-
""" This module contains the base class for handlers as used by the
21-
Dispatcher """
20+
""" This module contains the CallbackQueryHandler class """
2221

2322
from .handler import Handler
2423
from telegram import Update
@@ -38,7 +37,7 @@ class CallbackQueryHandler(Handler):
3837
"""
3938

4039
def __init__(self, callback, pass_update_queue=False):
41-
super(Handler).__init__(callback, pass_update_queue)
40+
super(CallbackQueryHandler, self).__init__(callback, pass_update_queue)
4241

4342
def checkUpdate(self, update):
4443
return isinstance(update, Update) and update.inline_query

telegram/ext/choseninlineresulthandler.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@
1717
# You should have received a copy of the GNU Lesser Public License
1818
# along with this program. If not, see [http://www.gnu.org/licenses/].
1919

20-
""" This module contains the base class for handlers as used by the
21-
Dispatcher """
20+
""" This module contains the ChosenInlineResultHandler class """
2221

2322
from .handler import Handler
2423
from telegram import Update
@@ -39,7 +38,7 @@ class ChosenInlineResultHandler(Handler):
3938
"""
4039

4140
def __init__(self, callback, pass_update_queue=False):
42-
super(Handler).__init__(callback, pass_update_queue)
41+
super(ChosenInlineResultHandler, self).__init__(callback, pass_update_queue)
4342

4443
def checkUpdate(self, update):
4544
return isinstance(update, Update) and update.chosen_inline_result

telegram/ext/commandhandler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class CommandHandler(Handler):
4545

4646
def __init__(self, command, callback, pass_args=False,
4747
pass_update_queue=False):
48-
super(Handler).__init__(callback, pass_update_queue)
48+
super(CommandHandler, self).__init__(callback, pass_update_queue)
4949
self.command = command
5050
self.pass_args = pass_args
5151

telegram/ext/dispatcher.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,14 @@
2424
from threading import Thread, BoundedSemaphore, Lock, Event, current_thread
2525
from time import sleep
2626

27+
# Adjust for differences in Python versions
28+
try:
29+
from queue import Empty # flake8: noqa
30+
except ImportError:
31+
from Queue import Empty # flake8: noqa
32+
2733
from telegram import (TelegramError, NullHandler)
2834
from telegram.ext.handler import Handler
29-
from telegram.utils.updatequeue import Empty
3035

3136
logging.getLogger(__name__).addHandler(NullHandler())
3237

telegram/ext/inlinequeryhandler.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@
1717
# You should have received a copy of the GNU Lesser Public License
1818
# along with this program. If not, see [http://www.gnu.org/licenses/].
1919

20-
""" This module contains the base class for handlers as used by the
21-
Dispatcher """
20+
""" This module contains the InlineQueryHandler class """
2221

2322
from .handler import Handler
2423
from telegram import Update
@@ -38,7 +37,7 @@ class InlineQueryHandler(Handler):
3837
"""
3938

4039
def __init__(self, callback, pass_update_queue=False):
41-
super(Handler).__init__(callback, pass_update_queue)
40+
super(InlineQueryHandler, self).__init__(callback, pass_update_queue)
4241

4342
def checkUpdate(self, update):
4443
return isinstance(update, Update) and update.inline_query

telegram/ext/messagehandler.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@
1717
# You should have received a copy of the GNU Lesser Public License
1818
# along with this program. If not, see [http://www.gnu.org/licenses/].
1919

20-
""" This module contains the base class for handlers as used by the
21-
Dispatcher """
20+
""" This module contains the MessageHandler class """
2221

2322
from .handler import Handler
2423
from telegram import Update
@@ -46,7 +45,7 @@ class MessageHandler(Handler):
4645
"""
4746

4847
def __init__(self, filters, callback, pass_update_queue=False):
49-
super(Handler).__init__(callback, pass_update_queue)
48+
super(MessageHandler, self).__init__(callback, pass_update_queue)
5049
self.filters = filters
5150

5251
def checkUpdate(self, update):

telegram/ext/regexhandler.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@
1717
# You should have received a copy of the GNU Lesser Public License
1818
# along with this program. If not, see [http://www.gnu.org/licenses/].
1919

20-
""" This module contains the base class for handlers as used by the
21-
Dispatcher """
20+
""" This module contains the RegexHandler class """
2221

2322
import re
2423

@@ -51,7 +50,7 @@ class RegexHandler(Handler):
5150

5251
def __init__(self, pattern, callback, pass_groups=False,
5352
pass_groupdict=False, pass_update_queue=False):
54-
super(Handler).__init__(callback, pass_update_queue)
53+
super(RegexHandler, self).__init__(callback, pass_update_queue)
5554

5655
if isinstance(pattern, str):
5756
pattern = re.compile(pattern)

telegram/ext/stringcommandhandler.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@
1717
# You should have received a copy of the GNU Lesser Public License
1818
# along with this program. If not, see [http://www.gnu.org/licenses/].
1919

20-
""" This module contains the base class for handlers as used by the
21-
Dispatcher """
20+
""" This module contains the StringCommandHandler class """
2221

2322
from .handler import Handler
2423

@@ -44,7 +43,7 @@ class StringCommandHandler(Handler):
4443

4544
def __init__(self, command, callback, pass_args=False,
4645
pass_update_queue=False):
47-
super(Handler).__init__(callback, pass_update_queue)
46+
super(StringCommandHandler, self).__init__(callback, pass_update_queue)
4847
self.command = command
4948
self.pass_args = pass_args
5049

telegram/ext/stringregexhandler.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@
1717
# You should have received a copy of the GNU Lesser Public License
1818
# along with this program. If not, see [http://www.gnu.org/licenses/].
1919

20-
""" This module contains the base class for handlers as used by the
21-
Dispatcher """
20+
""" This module contains the StringRegexHandler class """
2221

2322
import re
2423

@@ -50,7 +49,7 @@ class StringRegexHandler(Handler):
5049

5150
def __init__(self, pattern, callback, pass_groups=False,
5251
pass_groupdict=False, pass_update_queue=False):
53-
super(Handler).__init__(callback, pass_update_queue)
52+
super(StringRegexHandler, self).__init__(callback, pass_update_queue)
5453

5554
if isinstance(pattern, str):
5655
pattern = re.compile(pattern)

telegram/ext/typehandler.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@
1717
# You should have received a copy of the GNU Lesser Public License
1818
# along with this program. If not, see [http://www.gnu.org/licenses/].
1919

20-
""" This module contains the base class for handlers as used by the
21-
Dispatcher """
20+
""" This module contains the TypeHandler class """
2221

2322
from .handler import Handler
2423

@@ -41,7 +40,7 @@ class TypeHandler(Handler):
4140
"""
4241

4342
def __init__(self, type, callback, strict=False, pass_update_queue=False):
44-
super(Handler).__init__(callback, pass_update_queue)
43+
super(TypeHandler, self).__init__(callback, pass_update_queue)
4544
self.type = type
4645
self.strict = strict
4746

0 commit comments

Comments
 (0)
X Tutup