瀏覽代碼

rmv unnecessary silent param; unused

tags/v0.1
Ben Kurtovic 15 年之前
父節點
當前提交
c81e0e2260
共有 1 個文件被更改,包括 5 次插入 和 7 次删除
  1. +5
    -7
      irc/command_handler.py

+ 5
- 7
irc/command_handler.py 查看文件

@@ -7,7 +7,7 @@ import traceback


commands = [] commands = []


def init_commands(connection, silent=False):
def init_commands(connection):
"""load all valid command classes from irc/commmands/ into the commands variable""" """load all valid command classes from irc/commmands/ into the commands variable"""
files = os.listdir(os.path.join("irc", "commands")) # get all files in irc/commands/ files = os.listdir(os.path.join("irc", "commands")) # get all files in irc/commands/


@@ -20,17 +20,15 @@ def init_commands(connection, silent=False):
try: try:
exec "from irc.commands import %s" % module exec "from irc.commands import %s" % module
except: # importing the file failed for some reason... except: # importing the file failed for some reason...
if not silent:
print "Couldn't load file %s:" % f
traceback.print_exc()
print "Couldn't load file %s:" % f
traceback.print_exc()
continue continue


m = eval(module) # 'module' is a string, so get the actual object for processing m = eval(module) # 'module' is a string, so get the actual object for processing
process_module(connection, m) process_module(connection, m)


if not silent:
pretty_cmnds = map(lambda c: c.__class__.__name__, commands)
print "Found %s command classes: %s." % (len(commands), ', '.join(pretty_cmnds))
pretty_cmnds = map(lambda c: c.__class__.__name__, commands)
print "Found %s command classes: %s." % (len(commands), ', '.join(pretty_cmnds))


def process_module(connection, module): def process_module(connection, module):
"""go through all objects in a module and add valid command classes to the commands variable""" """go through all objects in a module and add valid command classes to the commands variable"""


Loading…
取消
儲存