Skip to content

lazily load Updater & move extended classes to submodule #198

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 5 commits into from
Mar 14, 2016
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
29 changes: 16 additions & 13 deletions telegram/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,24 @@
InlineQueryResultMpeg4Gif, InlineQueryResultPhoto, InlineQueryResultVideo
from .update import Update
from .bot import Bot
from .dispatcher import Dispatcher
from .jobqueue import JobQueue
from .updatequeue import UpdateQueue
from .updater import Updater


def Updater(*args, **kwargs):
"""Load the updater module on invocation and return an Updater instance."""
import warnings
warnings.warn("telegram.Updater is being deprecated, please use "
"telegram.ext.Updater from now on.")
from .ext.updater import Updater as Up
return Up(*args, **kwargs)


__author__ = 'devs@python-telegram-bot.org'
__version__ = '3.3'
__all__ = ('Bot', 'Updater', 'Dispatcher', 'Emoji', 'TelegramError',
'InputFile', 'ReplyMarkup', 'ForceReply', 'ReplyKeyboardHide',
'ReplyKeyboardMarkup', 'UserProfilePhotos', 'ChatAction',
'Location', 'Contact', 'Video', 'Sticker', 'Document', 'File',
'Audio', 'PhotoSize', 'Chat', 'Update', 'ParseMode', 'Message',
'User', 'TelegramObject', 'NullHandler', 'Voice', 'JobQueue',
'InlineQuery', 'ChosenInlineResult', 'InlineQueryResultArticle',
__all__ = ('Audio', 'Bot', 'Chat', 'Emoji', 'TelegramError', 'InputFile',
'Contact', 'ForceReply', 'ReplyKeyboardHide', 'ReplyKeyboardMarkup',
'UserProfilePhotos', 'ChatAction', 'Location', 'Video', 'Document',
'Sticker', 'File', 'PhotoSize', 'Update', 'ParseMode', 'Message',
'User', 'TelegramObject', 'NullHandler', 'Voice', 'InlineQuery',
'ReplyMarkup', 'ChosenInlineResult', 'InlineQueryResultArticle',
'InlineQueryResultGif', 'InlineQueryResultPhoto',
'InlineQueryResultMpeg4Gif', 'InlineQueryResultVideo',
'UpdateQueue')
'InlineQueryResultMpeg4Gif', 'InlineQueryResultVideo')
28 changes: 28 additions & 0 deletions telegram/ext/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2016
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser Public License for more details.
#
# You should have received a copy of the GNU Lesser Public License
# along with this program. If not, see [http://www.gnu.org/licenses/].

"""Extensions over the Telegram Bot API to facilitate bot making"""

from .dispatcher import Dispatcher
from .jobqueue import JobQueue
from .updatequeue import UpdateQueue
from .updater import Updater


__all__ = ('Dispatcher', 'JobQueue', 'UpdateQueue', 'Updater')
2 changes: 1 addition & 1 deletion telegram/dispatcher.py → telegram/ext/dispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
from time import sleep

from telegram import (TelegramError, Update, NullHandler)
from telegram.updatequeue import Empty
from telegram.ext.updatequeue import Empty

H = NullHandler()
logging.getLogger(__name__).addHandler(H)
Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions telegram/updater.py → telegram/ext/updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
from time import sleep
import subprocess
from signal import signal, SIGINT, SIGTERM, SIGABRT
from telegram import (Bot, TelegramError, dispatcher, Dispatcher,
NullHandler, JobQueue, UpdateQueue)
from telegram import Bot, TelegramError, NullHandler
from telegram.ext import dispatcher, Dispatcher, JobQueue, UpdateQueue
from telegram.utils.webhookhandler import (WebhookServer, WebhookHandler)

H = NullHandler()
Expand Down
2 changes: 1 addition & 1 deletion tests/test_jobqueue.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

sys.path.append('.')

from telegram import JobQueue, Updater
from telegram.ext import JobQueue, Updater
from tests.base import BaseTest

# Enable logging
Expand Down
2 changes: 1 addition & 1 deletion tests/test_updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
sys.path.append('.')

from telegram import Update, Message, TelegramError, User, Chat, Updater, Bot
from telegram.dispatcher import run_async
from telegram.ext.dispatcher import run_async
from tests.base import BaseTest
from threading import Lock, Thread

Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy