def get_dict(self, source, layout, fields, suffix_name=''): structure = DictionaryStructure(layout, fields) dict_name = source.name + "_" + layout.name + '_' + suffix_name dict_path = os.path.join(self.get_dict_directory(), dict_name + '.xml') dictionary = Dictionary(dict_name, structure, source, dict_path, "table_" + dict_name, fields) dictionary.generate_config() return dictionary
def get_dict(source, layout, fields, suffix_name=''): global DICT_CONFIG_PATH structure = DictionaryStructure(layout, fields) dict_name = source.name + "_" + layout.name + '_' + suffix_name dict_path = os.path.join(DICT_CONFIG_PATH, dict_name + '.xml') dictionary = Dictionary(dict_name, structure, source, dict_path, "table_" + dict_name, fields) dictionary.generate_config() return dictionary
def get_dict(source, layout, fields, suffix_name=""): structure = DictionaryStructure(layout, fields) dict_name = source.name + "_" + layout.name + "_" + suffix_name dict_path = os.path.join(dict_configs_path, dict_name + ".xml") dictionary = Dictionary( dict_name, structure, source, dict_path, "table_" + dict_name, fields ) dictionary.generate_config() return dictionary
class DefinePlugin(WillPlugin): def __init__(self, *args, **kwargs): self.dictionary = Dictionary() return WillPlugin.__init__(self, *args, **kwargs) @respond_to("^define$") def define(self, message): """ define: Get the definition of a random word """ return self.reply(message, self.dictionary.get_random_definition()) @respond_to("^define (?P<word>[a-zA-Z]+)$") def define(self, message, word): """ define ___: Get the definition of ___ """ return self.reply(message, self.dictionary.get_definition(word))
def __init__(self, *args, **kwargs): self.dictionary = Dictionary() return WillPlugin.__init__(self, *args, **kwargs)