Ejemplo n.º 1
0
 def save_yaml_and_change_process_list(self):
     yml_path = os.path.join(self.test_folder, 'xrd_tiff.yml')
     with open(yml_path, 'w') as f:
         yu.dump_yaml(self.yaml, f)
     # now set the template path in the process list
     self.process_list.modify('1', '2', yml_path)
     self.process_list.save(self.process_list_path)
 def save_yaml_and_change_process_list(self):
     yml_path = os.path.join(self.test_folder, 'xrd_tiff.yml')
     with open(yml_path, 'w') as f:
         yu.dump_yaml(self.yaml, f)
     # now set the template path in the process list
     self.process_list.modify('1', '2', yml_path)
     self.process_list.save(self.process_list_path)
Ejemplo n.º 3
0
def update_template(filename, entry, key, val):
    template = yu.read_yaml(filename)
    entry = _string_to_val(entry)
    val = _string_to_val(val)
    template[entry][template[entry].keys()[0]][key] = val

    with open(filename, 'w') as stream:
        yu.dump_yaml(template, stream)
Ejemplo n.º 4
0
 def save_yaml_and_change_process_list(self):
     self.yml_path = os.path.join(self.test_folder, 'xrd_tiff.yml')
     with open(self.yml_path, 'w') as f:
         yu.dump_yaml(self.yaml, f)
     # now set the template path in the process list
     # uses the parameter name instead of number
     # because the number can change between runs
     self.process_list = Content()
     self.process_list.fopen(self.process_list_path, update=False)
     self.process_list.modify('1', 'yaml_file', self.yml_path)
     self.process_list.save(self.process_list_path)
Ejemplo n.º 5
0
    def _output_template(self, fname):
        plist = self.plist.plugin_list
        index = [i for i in range(len(plist)) if plist[i]['active']]

        local_dict = MetaData(ordered=True)
        global_dict = MetaData(ordered=True)

        for i in index:
            params = self.__get_template_params(plist[i]['data'], [])
            name = plist[i]['name']
            for p in params:
                ptype, isyaml, key, value = p
                if isyaml:
                    data_name = isyaml if ptype == 'local' else 'all'
                    local_dict.set([i+1, name, data_name, key], value)
                elif ptype == 'local':
                    local_dict.set([i+1, name, key], value)
                else:
                    global_dict.set(['all', name, key], value)

        with open(fname, 'w') as stream:
            local_dict.get_dictionary().update(global_dict.get_dictionary())
            yu.dump_yaml(local_dict.get_dictionary(), stream)
Ejemplo n.º 6
0
    def _output_template(self, fname, process_fname):
        plist = self.plist.plugin_list
        index = [i for i in range(len(plist)) if plist[i]['active']]

        local_dict = MetaData(ordered=True)
        global_dict = MetaData(ordered=True)
        local_dict.set(['process_list'], os.path.abspath(process_fname))

        for i in index:
            params = self.__get_template_params(plist[i]['data'], [])
            name = plist[i]['name']
            for p in params:
                ptype, isyaml, key, value = p
                if isyaml:
                    data_name = isyaml if ptype == 'local' else 'all'
                    local_dict.set([i+1, name, data_name, key], value)
                elif ptype == 'local':
                    local_dict.set([i+1, name, key], value)
                else:
                    global_dict.set(['all', name, key], value)

        with open(fname, 'w') as stream:
            local_dict.get_dictionary().update(global_dict.get_dictionary())
            yu.dump_yaml(local_dict.get_dictionary(), stream)