Cleanup code

This commit is contained in:
kad 2010-07-28 13:25:49 -05:00
commit 02df2ca783
4 changed files with 13 additions and 14 deletions

View File

@ -31,7 +31,6 @@ from irclib import irclib
from modules import *
modlist = []
moduleList = [ "Countdown", "Dice", "IrcAdmin", "GoogleTranslate", "Seen", "FactFile" ]
modObjs = []
@ -66,14 +65,14 @@ def rehash():
reload_modules(moduleList)
# Create the actual module objects, which will readd the handlers we removed
# earlier, and add them to the modObjs list, which we can use during the next
# rehash to remove the handlers.
# earlier, and add them to the modObjs list, which we can use during the
# next rehash to remove the handlers.
def reload_modules(moduleList):
for mod in moduleList:
cls = globals()[mod]
# Importing the names imports a module since the file name and class
# name are the same. Look for the class definition in each module with
# the same name and create that object.
# name are the same. Look for the class definition in each module
# with the same name and create that object.
if inspect.ismodule(cls):
for name, obj in inspect.getmembers(cls):
if inspect.isclass(obj) and re.search(mod, obj.__name__):