def __inst_parser(self, impl): # TODO: ???? klass = {} klass["k"] = None def cls_found(k, cwd): if k.__name__ == impl: klass["k"] = k return False return True try: klass["k"] = eval(impl) except NameError, err: cwd = os.path.dirname(__file__) find_classes(DataParser, self.__rel_plugin_dir, cwd, cls_found)
def find_commands(relative_path, home_dir): commands = {} def command_found(klass, cwd): command = klass() if command.id: print cwd commands[command.id] = PluginCommand(command, cwd, home_dir) else: raise Exception("Command id is missing") return True cwd = os.path.dirname(__file__) find_classes(Command, relative_path, cwd, command_found) return commands