From b6fceefc80177cbbfb915501f6f7a8faad156d8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jannes=20H=C3=B6ke?= Date: Mon, 18 Apr 2016 18:13:54 +0200 Subject: [PATCH] documentation --- .../telegram.ext.callbackqueryhandler.rst | 7 +++++ ...telegram.ext.choseninlineresulthandler.rst | 7 +++++ docs/source/telegram.ext.commandhandler.rst | 7 +++++ docs/source/telegram.ext.filters.rst | 7 +++++ docs/source/telegram.ext.handler.rst | 7 +++++ .../telegram.ext.inlinequeryhandler.rst | 7 +++++ docs/source/telegram.ext.jobqueue.rst | 7 +++++ docs/source/telegram.ext.messagehandler.rst | 7 +++++ docs/source/telegram.ext.regexhandler.rst | 7 +++++ docs/source/telegram.ext.rst | 29 +++++++++++++++++++ .../telegram.ext.stringcommandhandler.rst | 7 +++++ .../telegram.ext.stringregexhandler.rst | 7 +++++ docs/source/telegram.ext.typehandler.rst | 7 +++++ docs/source/telegram.jobqueue.rst | 7 ----- docs/source/telegram.rst | 4 +-- telegram/ext/choseninlineresulthandler.py | 3 +- telegram/ext/commandhandler.py | 6 ++-- telegram/ext/dispatcher.py | 18 ++++++------ telegram/ext/messagehandler.py | 2 +- telegram/ext/stringcommandhandler.py | 4 +-- telegram/ext/updater.py | 14 +++++---- 21 files changed, 139 insertions(+), 32 deletions(-) create mode 100644 docs/source/telegram.ext.callbackqueryhandler.rst create mode 100644 docs/source/telegram.ext.choseninlineresulthandler.rst create mode 100644 docs/source/telegram.ext.commandhandler.rst create mode 100644 docs/source/telegram.ext.filters.rst create mode 100644 docs/source/telegram.ext.handler.rst create mode 100644 docs/source/telegram.ext.inlinequeryhandler.rst create mode 100644 docs/source/telegram.ext.jobqueue.rst create mode 100644 docs/source/telegram.ext.messagehandler.rst create mode 100644 docs/source/telegram.ext.regexhandler.rst create mode 100644 docs/source/telegram.ext.rst create mode 100644 docs/source/telegram.ext.stringcommandhandler.rst create mode 100644 docs/source/telegram.ext.stringregexhandler.rst create mode 100644 docs/source/telegram.ext.typehandler.rst delete mode 100644 docs/source/telegram.jobqueue.rst diff --git a/docs/source/telegram.ext.callbackqueryhandler.rst b/docs/source/telegram.ext.callbackqueryhandler.rst new file mode 100644 index 000000000..bf8a5b1e6 --- /dev/null +++ b/docs/source/telegram.ext.callbackqueryhandler.rst @@ -0,0 +1,7 @@ +telegram.ext.handler module +=========================== + +.. automodule:: telegram.ext.handler + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/source/telegram.ext.choseninlineresulthandler.rst b/docs/source/telegram.ext.choseninlineresulthandler.rst new file mode 100644 index 000000000..b81c1b75a --- /dev/null +++ b/docs/source/telegram.ext.choseninlineresulthandler.rst @@ -0,0 +1,7 @@ +telegram.ext.choseninlineresulthandler module +============================================= + +.. automodule:: telegram.ext.choseninlineresulthandler + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/source/telegram.ext.commandhandler.rst b/docs/source/telegram.ext.commandhandler.rst new file mode 100644 index 000000000..1330c248f --- /dev/null +++ b/docs/source/telegram.ext.commandhandler.rst @@ -0,0 +1,7 @@ +telegram.ext.commandhandler module +================================== + +.. automodule:: telegram.ext.commandhandler + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/source/telegram.ext.filters.rst b/docs/source/telegram.ext.filters.rst new file mode 100644 index 000000000..a04a2d1c1 --- /dev/null +++ b/docs/source/telegram.ext.filters.rst @@ -0,0 +1,7 @@ +telegram.ext.filters module +=========================== + +.. automodule:: telegram.ext.filters + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/source/telegram.ext.handler.rst b/docs/source/telegram.ext.handler.rst new file mode 100644 index 000000000..bf8a5b1e6 --- /dev/null +++ b/docs/source/telegram.ext.handler.rst @@ -0,0 +1,7 @@ +telegram.ext.handler module +=========================== + +.. automodule:: telegram.ext.handler + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/source/telegram.ext.inlinequeryhandler.rst b/docs/source/telegram.ext.inlinequeryhandler.rst new file mode 100644 index 000000000..78438b315 --- /dev/null +++ b/docs/source/telegram.ext.inlinequeryhandler.rst @@ -0,0 +1,7 @@ +telegram.ext.inlinequeryhandler module +====================================== + +.. automodule:: telegram.ext.inlinequeryhandler + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/source/telegram.ext.jobqueue.rst b/docs/source/telegram.ext.jobqueue.rst new file mode 100644 index 000000000..a78cc004b --- /dev/null +++ b/docs/source/telegram.ext.jobqueue.rst @@ -0,0 +1,7 @@ +telegram.ext.jobqueue module +============================ + +.. automodule:: telegram.ext.jobqueue + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/source/telegram.ext.messagehandler.rst b/docs/source/telegram.ext.messagehandler.rst new file mode 100644 index 000000000..17c3547d6 --- /dev/null +++ b/docs/source/telegram.ext.messagehandler.rst @@ -0,0 +1,7 @@ +telegram.ext.messagehandler module +================================== + +.. automodule:: telegram.ext.messagehandler + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/source/telegram.ext.regexhandler.rst b/docs/source/telegram.ext.regexhandler.rst new file mode 100644 index 000000000..bfb781299 --- /dev/null +++ b/docs/source/telegram.ext.regexhandler.rst @@ -0,0 +1,7 @@ +telegram.ext.regexhandler module +================================ + +.. automodule:: telegram.ext.regexhandler + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/source/telegram.ext.rst b/docs/source/telegram.ext.rst new file mode 100644 index 000000000..a924e021e --- /dev/null +++ b/docs/source/telegram.ext.rst @@ -0,0 +1,29 @@ +telegram.ext package +==================== + +Submodules +---------- + +.. toctree:: + + telegram.ext.updater + telegram.ext.dispatcher + telegram.ext.jobqueue + telegram.ext.handler + telegram.ext.choseninlineresulthandler + telegram.ext.commandhandler + telegram.ext.inlinequeryhandler + telegram.ext.messagehandler + telegram.ext.filters + telegram.ext.regexhandler + telegram.ext.stringcommandhandler + telegram.ext.stringregexhandler + telegram.ext.typehandler + +Module contents +--------------- + +.. automodule:: telegram.ext + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/source/telegram.ext.stringcommandhandler.rst b/docs/source/telegram.ext.stringcommandhandler.rst new file mode 100644 index 000000000..0b3f88277 --- /dev/null +++ b/docs/source/telegram.ext.stringcommandhandler.rst @@ -0,0 +1,7 @@ +telegram.ext.stringcommandhandler module +======================================== + +.. automodule:: telegram.ext.stringcommandhandler + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/source/telegram.ext.stringregexhandler.rst b/docs/source/telegram.ext.stringregexhandler.rst new file mode 100644 index 000000000..3faeb9187 --- /dev/null +++ b/docs/source/telegram.ext.stringregexhandler.rst @@ -0,0 +1,7 @@ +telegram.ext.stringregexhandler module +====================================== + +.. automodule:: telegram.ext.stringregexhandler + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/source/telegram.ext.typehandler.rst b/docs/source/telegram.ext.typehandler.rst new file mode 100644 index 000000000..6a7f58968 --- /dev/null +++ b/docs/source/telegram.ext.typehandler.rst @@ -0,0 +1,7 @@ +telegram.ext.typehandler module +=============================== + +.. automodule:: telegram.ext.typehandler + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/source/telegram.jobqueue.rst b/docs/source/telegram.jobqueue.rst deleted file mode 100644 index b74f57d3b..000000000 --- a/docs/source/telegram.jobqueue.rst +++ /dev/null @@ -1,7 +0,0 @@ -telegram.jobqueue module -======================== - -.. automodule:: telegram.jobqueue - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/source/telegram.rst b/docs/source/telegram.rst index 8aea879c4..b1bc16851 100644 --- a/docs/source/telegram.rst +++ b/docs/source/telegram.rst @@ -9,9 +9,7 @@ Submodules telegram.audio telegram.base telegram.bot - telegram.ext.updater - telegram.ext.dispatcher - telegram.jobqueue + telegram.ext telegram.inlinequery telegram.inlinequeryresult telegram.choseninlineresult diff --git a/telegram/ext/choseninlineresulthandler.py b/telegram/ext/choseninlineresulthandler.py index 0fcebe12d..bd7757ec0 100644 --- a/telegram/ext/choseninlineresulthandler.py +++ b/telegram/ext/choseninlineresulthandler.py @@ -38,7 +38,8 @@ class ChosenInlineResultHandler(Handler): """ def __init__(self, callback, pass_update_queue=False): - super(ChosenInlineResultHandler, self).__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 diff --git a/telegram/ext/commandhandler.py b/telegram/ext/commandhandler.py index 3b7eee45b..c140626aa 100644 --- a/telegram/ext/commandhandler.py +++ b/telegram/ext/commandhandler.py @@ -26,7 +26,7 @@ from telegram import Update class CommandHandler(Handler): """ Handler class to handle Telegram commands. Commands are Telegram messages - that start with ``/``, optionally followed by an @ and the bot's + that start with ``/``, optionally followed by an ``@`` and the bot's name and/or some additional text. Args: @@ -36,8 +36,8 @@ class CommandHandler(Handler): has determined that an update should be processed by this handler. pass_args (optional[bool]): If the handler should be passed the arguments passed to the command as a keyword argument called ` - `args``. It will contain a list of strings, which is the text - following the command split on spaces. Default is ``False`` + ``args``. It will contain a list of strings, which is the text + following the command split on spaces. Default is ``False`` pass_update_queue (optional[bool]): If the handler should be passed the update queue as a keyword argument called ``update_queue``. It can be used to insert updates. Default is ``False`` diff --git a/telegram/ext/dispatcher.py b/telegram/ext/dispatcher.py index 70c67a3ad..a55b8f04d 100644 --- a/telegram/ext/dispatcher.py +++ b/telegram/ext/dispatcher.py @@ -89,8 +89,8 @@ class Dispatcher(object): Args: bot (telegram.Bot): The bot object that should be passed to the handlers - update_queue (telegram.UpdateQueue): The synchronized queue that will - contain the updates. + update_queue (Queue): The synchronized queue that will contain the + updates. """ def __init__(self, bot, update_queue, workers=4, exception_event=None): self.bot = bot @@ -163,7 +163,7 @@ class Dispatcher(object): Processes a single update. Args: - update (any): + update (object): """ # An error happened while polling @@ -212,7 +212,7 @@ class Dispatcher(object): Args: handler (Handler): A Handler instance - group (object): The group identifier + group (optional[object]): The group identifier. Default is 0 """ if not isinstance(handler, Handler): @@ -229,7 +229,7 @@ class Dispatcher(object): Args: handler (Handler): A Handler instance - group (object): The group identifier + group (optional[object]): The group identifier. Default is 0 """ if handler in self.handlers[group]: self.handlers[group].remove(handler) @@ -239,8 +239,8 @@ class Dispatcher(object): Registers an error handler in the Dispatcher. Args: - handler (function): A function that takes (Bot, TelegramError) as - arguments. + handler (function): A function that takes ``Bot, Update, + TelegramError`` as arguments. """ self.error_handlers.append(callback) @@ -250,7 +250,7 @@ class Dispatcher(object): De-registers an error handler. Args: - handler (any): + handler (function): """ if callback in self.error_handlers: @@ -261,7 +261,7 @@ class Dispatcher(object): Dispatches an error. Args: - update (any): The update that caused the error + update (object): The update that caused the error error (telegram.TelegramError): The Telegram error that was raised. """ diff --git a/telegram/ext/messagehandler.py b/telegram/ext/messagehandler.py index d664f0092..1dddf56bd 100644 --- a/telegram/ext/messagehandler.py +++ b/telegram/ext/messagehandler.py @@ -22,7 +22,7 @@ from .handler import Handler from telegram import Update -from .filters import * +from .filters import * # flake8: noqa class MessageHandler(Handler): diff --git a/telegram/ext/stringcommandhandler.py b/telegram/ext/stringcommandhandler.py index 9f9187950..b9df4375e 100644 --- a/telegram/ext/stringcommandhandler.py +++ b/telegram/ext/stringcommandhandler.py @@ -34,8 +34,8 @@ class StringCommandHandler(Handler): has determined that an update should be processed by this handler. pass_args (optional[bool]): If the handler should be passed the arguments passed to the command as a keyword argument called ` - `args``. It will contain a list of strings, which is the text - following the command split on spaces. Default is ``False`` + ``args``. It will contain a list of strings, which is the text + following the command split on spaces. Default is ``False`` pass_update_queue (optional[bool]): If the handler should be passed the update queue as a keyword argument called ``update_queue``. It can be used to insert updates. Default is ``False`` diff --git a/telegram/ext/updater.py b/telegram/ext/updater.py index 27171a948..ad4babfd6 100644 --- a/telegram/ext/updater.py +++ b/telegram/ext/updater.py @@ -116,9 +116,10 @@ class Updater(object): False. bootstrap_retries (Optional[int[): Whether the bootstrapping phase of the `Updater` will retry on failures on the Telegram server. - < 0 - retry indefinitely - 0 - no retries (default) - > 0 - retry up to X times + + | < 0 - retry indefinitely + | 0 - no retries (default) + | > 0 - retry up to X times Returns: Queue: The update queue that can be filled from the main thread @@ -183,9 +184,10 @@ class Updater(object): is False. bootstrap_retries (Optional[int[): Whether the bootstrapping phase of the `Updater` will retry on failures on the Telegram server. - < 0 - retry indefinitely - 0 - no retries (default) - > 0 - retry up to X times + + | < 0 - retry indefinitely + | 0 - no retries (default) + | > 0 - retry up to X times webhook_url (Optional[str]): Explicitly specifiy the webhook url. Useful behind NAT, reverse proxy, etc. Default is derived from `listen`, `port` & `url_path`.