pep8 and docs

This commit is contained in:
Jannes Höke 2015-11-16 20:43:35 +01:00
parent 0b8fd24771
commit ee8b78aa0d
3 changed files with 20 additions and 17 deletions

View file

@ -144,7 +144,7 @@ class BotEventHandler:
network_delay=network_delay)
if not self.running:
if len(updates) > 0:
self.logger.info('Updates ignored and will be pulled ' +
self.logger.info('Updates ignored and will be pulled '
'again on restart.')
break

View file

@ -65,9 +65,9 @@ class Broadcaster:
Attributes:
Args:
bot (telegram.Bot): The bot object that should be passed to the handlers
update_queue (queue.Queue): The synchronized queue that will contain the
updates.
bot (telegram.Bot): The bot object that should be passed to the
handlers update_queue (queue.Queue): The synchronized queue that will
contain the updates.
"""
def __init__(self, bot, update_queue, workers=4):
self.bot = bot
@ -213,12 +213,12 @@ class Broadcaster:
def addTelegramRegexHandler(self, matcher, handler):
"""
Registers a regex handler in the Broadcaster. If handlers will be called
if matcher.math(update.message.text) is True.
Registers a regex handler in the Broadcaster. If handlers will be
called if re.match(matcher, update.message.text) is True.
Args:
matcher (__Regex): A compiled regex object that matches on messages
that handler should be listening to
matcher (__Regex): A regex string or compiled regex object that
matches on messages that handler should be listening to
handler (function): A function that takes (Bot, Update) as
arguments.
"""
@ -245,12 +245,12 @@ class Broadcaster:
def addStringRegexHandler(self, matcher, handler):
"""
Registers a regex handler in the Broadcaster. If handlers will be called
if matcher.math(string) is True.
Registers a regex handler in the Broadcaster. If handlers will be
called if re.match(matcher, string) is True.
Args:
matcher (__Regex): A compiled regex object that matches on the string
input that handler should be listening to
matcher (__Regex): A regex string or compiled regex object that
matches on the string input that handler should be listening to
handler (function): A function that takes (Bot, Update) as
arguments.
"""
@ -274,8 +274,8 @@ class Broadcaster:
def addUnknownStringCommandHandler(self, handler):
"""
Registers a string-command handler in the Broadcaster, that will receive
all commands that have no associated handler.
Registers a string-command handler in the Broadcaster, that will
receive all commands that have no associated handler.
Args:
handler (function): A function that takes (Bot, str) as arguments.
@ -437,7 +437,8 @@ class Broadcaster:
def broadcastTelegramRegex(self, update):
"""
Broadcasts an update to all regex handlers that match the message string.
Broadcasts an update to all regex handlers that match the message
string.
Args:
command (str): The command keyword
@ -471,7 +472,8 @@ class Broadcaster:
def broadcastStringRegex(self, update):
"""
Broadcasts an update to all string regex handlers that match the string.
Broadcasts an update to all string regex handlers that match the
string.
Args:
command (str): The command keyword

View file

@ -16,7 +16,8 @@ logging.getLogger(__name__).addHandler(H)
class WebhookServer(BaseHTTPServer.HTTPServer, object):
def __init__(self, server_address, RequestHandlerClass, update_queue,
webhook_path):
super(WebhookServer, self).__init__(server_address, RequestHandlerClass)
super(WebhookServer, self).__init__(server_address,
RequestHandlerClass)
self.update_queue = update_queue
self.webhook_path = webhook_path