예제 #1
0
def load_potisions(mode, config):

    [section_in, section_out] = tools.get_section(mode)
    header = tools.config_getboolean(config, section_in, "header")
    
    must = {}
    opts = {}
    for option in config.options(section_in):
        param = ""
        if option.find("col_") == 0:
            param = option.replace("col_", "")
        
        if len(param) > 0:
            if param.find("opt_") == 0:
                if header == True:
                    opts[param.replace("opt_", "")] = config.get(section_in, option)
                else:
                    opts[param.replace("opt_", "")] = config.getint(section_in, option)
            else:
                if header == True:
                    must[param] = config.get(section_in, option)
                else:
                    must[param] = config.getint(section_in, option)
                
    return {"must": must, "option": opts}
예제 #2
0
def merge_result(files, ids, output_file, mode, config, extract = False):

    [section_in, section_out] = tools.get_section(mode)
    
    if tools.config_getboolean(config, section_in, "header") == True:
        return with_header(files, ids, output_file, mode, config, extract)
    else:
        return with_noheader(files, ids, output_file, mode, config, extract)
예제 #3
0
def _split_char(mode, config):
    [section_in, section_out] = tools.get_section(mode)
    sept_in = config.get(section_in, "sept")
    sept_out= config.get(section_out, "sept")
    
    if sept_in == sept_out:
        return ["", ""]
        
    if sept_in == ";" and sept_out == ",":
            return [",", " "]
        
    return [",", ";"]
예제 #4
0
def _load_option(mode, config):

    [section_in, section_out] = tools.get_section(mode)
    
    # data read
    header = config.getboolean(section_in, "header")
    if header < 0:
        header = 0
    sept = config.get(section_in, "sept").replace("\\t", "\t").replace("\\n", "\n").replace("\\r", "\r")
    comment = tools.config_getstr(config, section_in, "comment")
    lack = tools.config_getstr(config, section_out, "lack_column_complement")
    suffix = tools.config_getstr(config, section_in, "suffix")
    suffix_filt = tools.config_getstr(config, section_in, "suffix_filt")
    sept_out = config.get(section_out, "sept").replace("\\t", "\t").replace("\\n", "\n").replace("\\r", "\r")
    
    # return option dict
    return {"header": header, "sept": sept, "comment": comment, "lack": lack, "suffix": suffix, "suffix_filt": suffix_filt, "sept_out":sept_out}