示例#1
0
    def confString(self, section, opt, default=None):
        """Read a string value from the plugin's own configuration file.

        :param section: configuration file section to read
        :param opt: option name to read
        :param default: value to read if the option is missing
        :return: string option value read, or default if option was missing
        """
        return config.getOption(self._conf, section, opt,
                                config.Option(default))
示例#2
0
    def confString(self, section, opt, default=None):
        '''Read a string value from the plugin's own configuration file

        @param section: Configuration file section to read.
        @param opt: Option name to read.
        @param default: Value to read if option is missing.
        @return: String option value read, or default if option was missing.
        '''
        # ' xemacs highlighting hack
        return config.getOption(self._conf, section, opt, config.Option(default))
示例#3
0
    def on_new_color(self, widget):
        new_color = self.value.get_color()
        r = int(new_color.red / color_scaling_factor)
        g = int(new_color.green / color_scaling_factor)
        b = int(new_color.blue / color_scaling_factor)

        color_text = str(r) + " " + str(g) + " " + str(b)

        config.options[self.plugin][self.m_name] = \
                config.Option(color_text, self.type)
示例#4
0
    def on_save(self, widget):
        n_tabs = self.note.get_n_pages()
        for tabno in xrange(n_tabs - 1):
            tab = self.note.get_nth_page(tabno)
            for opt in tab.options:
                if opt.type == config.OptionTypePlain:
                    config.options[tab.tab_name][opt.m_name] = \
                            config.Option(opt.value.get_text(), config.OptionTypePlain)

        config.write_config(config_path)
        pass
示例#5
0
    def on_clicked(self, widget):
        global main_window
        self.popup.begin()
        text = ""

        if self.type == config.OptionTypeKey:
            if self.popup.mod and self.popup.key:
                text = self.popup.mod + self.popup.key
            self.popup = widgets.KeyGrab(main_window)

        if (self.type == config.OptionTypeButton):
            if self.popup.mod + self.popup.button:
                text = self.popup.mod + self.popup.button
            self.popup = widgets.ButtonSelect(main_window)

        if text:
            self.value.set_label(text)
            config.options[self.plugin][self.m_name] = \
                    config.Option(text, self.type)
示例#6
0
 def add_option(self, option, value, type=config.OptionTypePlain):
     config.add_option(self.tab_name, option, config.Option(value, type))
     box = (OptionBox(option, value, type, plugin=self.tab_name))
     self.options.append(box)
     self.add(box)
示例#7
0
    parser.add_argument("--save_model_name", type=str, default='RRL_test')
    parser.add_argument("--load_model_name", type=str, default=None)

    parser.add_argument("--whether_visualize", type=int, default=1)

    # BERT
    parser.add_argument("--BERT", type=int, default=0)

    args = parser.parse_args()
    args.whether_visualize = True if args.whether_visualize == 1 else False
    args.inclass_augment = True if args.inclass_augment == 1 else False
    args.squared = True if args.squared == 1 else False
    args.record_test = True if args.record_test == 1 else False
    args.BERT = True if args.BERT == 1 else False

    opt = config.Bert_option(args.gpu) if args.BERT else config.Option()
    opt.dataset = args.dataset
    if args.dataset.startswith("fewrel"):
        opt.data_type = 'fewrel_ori'
        opt.train_data_file = './data/datasets/fewrel_ori/fewrel80_train.json'
        opt.val_data_file = './data/datasets/fewrel_ori/fewrel80_test_train.json'
        opt.test_data_file = './data/datasets/fewrel_ori/fewrel80_test_test.json'
        opt.wordvec_file = "./data/wordvec/word_vec.json"
        opt.rel2id_file = './data/support_files/fewrel_rel2id.json'
    elif args.dataset.startswith("nyt"):
        opt.data_type = 'nyt_su_imbalance'
        opt.train_data_file = './data/datasets/nyt_su/nyt_supervision_train.json'
        opt.val_data_file = './data/datasets/nyt_su/nyt_supervision_dev.json'
        opt.test_data_file = './data/datasets/nyt_su/nyt_supervision_test.json'
        opt.wordvec_file = "./data/wordvec/word_vec.json"
        opt.rel2id_file = './data/support_files/nyt_su_rel2id.json'