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