diff options
author | Alexander Sulfrian <alexander@sulfrian.net> | 2013-07-25 19:26:52 +0200 |
---|---|---|
committer | Alexander Sulfrian <alexander@sulfrian.net> | 2015-12-03 03:29:37 +0100 |
commit | f3b86ed2d5bce85b3b9c27eb949cd88cf7d526bc (patch) | |
tree | a187725f5ec7f1c67d2b9a471b4000ad40a16b04 /modules/reload.py | |
parent | 4b905606692a2f147946505abe6ade1c241d1000 (diff) | |
download | bot-f3b86ed2d5bce85b3b9c27eb949cd88cf7d526bc.tar.gz bot-f3b86ed2d5bce85b3b9c27eb949cd88cf7d526bc.tar.bz2 bot-f3b86ed2d5bce85b3b9c27eb949cd88cf7d526bc.zip |
fix indentation and trailing whitespaces
Diffstat (limited to 'modules/reload.py')
-rwxr-xr-x | modules/reload.py | 76 |
1 files changed, 38 insertions, 38 deletions
diff --git a/modules/reload.py b/modules/reload.py index dfd0e8e..bef2f19 100755 --- a/modules/reload.py +++ b/modules/reload.py @@ -10,46 +10,46 @@ http://inamidst.com/phenny/ import sys, os.path, time, imp import irc -def f_reload(phenny, input): - """Reloads a module, for use by admins only.""" - if not input.admin: return - - name = input.group(2) - if name == phenny.config.owner: - return phenny.reply('What?') - - if (not name) or (name == '*'): - phenny.variables = None - phenny.commands = None - phenny.setup() - return phenny.reply('done') - - if not sys.modules.has_key(name): - return phenny.reply('%s: no such module!' % name) - - # Thanks to moot for prodding me on this - path = sys.modules[name].__file__ - if path.endswith('.pyc') or path.endswith('.pyo'): - path = path[:-1] - if not os.path.isfile(path): - return phenny.reply('Found %s, but not the source file' % name) - - module = imp.load_source(name, path) - sys.modules[name] = module - if hasattr(module, 'setup'): - module.setup(phenny) - - mtime = os.path.getmtime(module.__file__) - modified = time.strftime('%Y-%m-%d %H:%M:%S', time.gmtime(mtime)) - - phenny.register(vars(module)) - phenny.bind_commands() - - phenny.reply('%r (version: %s)' % (module, modified)) +def f_reload(phenny, input): + """Reloads a module, for use by admins only.""" + if not input.admin: return + + name = input.group(2) + if name == phenny.config.owner: + return phenny.reply('What?') + + if (not name) or (name == '*'): + phenny.variables = None + phenny.commands = None + phenny.setup() + return phenny.reply('done') + + if not sys.modules.has_key(name): + return phenny.reply('%s: no such module!' % name) + + # Thanks to moot for prodding me on this + path = sys.modules[name].__file__ + if path.endswith('.pyc') or path.endswith('.pyo'): + path = path[:-1] + if not os.path.isfile(path): + return phenny.reply('Found %s, but not the source file' % name) + + module = imp.load_source(name, path) + sys.modules[name] = module + if hasattr(module, 'setup'): + module.setup(phenny) + + mtime = os.path.getmtime(module.__file__) + modified = time.strftime('%Y-%m-%d %H:%M:%S', time.gmtime(mtime)) + + phenny.register(vars(module)) + phenny.bind_commands() + + phenny.reply('%r (version: %s)' % (module, modified)) f_reload.name = 'reload' f_reload.rule = ('$nick', ['reload'], r'(\S+)?') f_reload.priority = 'low' f_reload.thread = False -if __name__ == '__main__': - print __doc__.strip() +if __name__ == '__main__': + print __doc__.strip() |