Added docstrings, fixed some weird indentation.

This commit is contained in:
Jeremy Fincher 2003-10-04 11:47:21 +00:00
parent c1a2f1b454
commit 6261036911

View File

@ -49,8 +49,7 @@ _deadDrivers = []
_newDrivers = []
class IrcDriver(object):
"""Base class for drivers.
"""
"""Base class for drivers."""
def __init__(self):
_newDrivers.append((self.name(), self))
if not hasattr(self, 'irc'):
@ -115,15 +114,19 @@ class Interactive(IrcDriver):
self.irc.feedMsg(msg)
def empty():
"""Returns whether or not the driver loop is empty."""
return (len(_drivers) + len(_newDrivers)) == 0
def add(name, driver):
"""Adds a given driver the loop with the given name."""
_newDrivers.append((name, driver))
def remove(name):
"""Removes the driver with the given name from the loop."""
_deadDrivers.append(name)
def run():
"""Runs the whole driver loop."""
for (name, driver) in _drivers.iteritems():
try:
if name not in _deadDrivers:
@ -144,6 +147,7 @@ def run():
_drivers[name] = driver
def newDriver(server, irc, moduleName=conf.driverModule):
"""Returns a new driver for the given server using conf.driverModule."""
driver = __import__(moduleName).Driver(server, irc)
irc.driver = driver
return driver