Item from TSV representation.
485939
def load(self, text, fieldnames=None):
    """"""
    lines = text.split('\n')
    fieldnames = load_line(lines[0])
    values = load_line(lines[1])
    self.__dict__ = dict(zip(fieldnames, values))
1059238
def prt_tsv_sections(prt, tsv_data, **kws):
    """"""
    prt_hdr_min = 10  # Print hdr on the 1st section and for any following 'large' sections
    num_items = 0
    if tsv_data:
        # Basic data checks
        assert len(tsv_data[0]) == 2, "wr_tsv_sections EXPECTED: [(section, nts), ..."
        assert tsv_data[0][1], \
            "wr_tsv_sections EXPECTED SECTION({S}) LIST TO HAVE DATA".format(S=tsv_data[0][0])
        hdrs_wrote = False
        sep = "\t" if 'sep' not in kws else kws['sep']
        prt_flds = kws['prt_flds'] if 'prt_flds' in kws else tsv_data[0]._fields
        fill = sep*(len(prt_flds) - 1)
        # Write data
        for section_text, data_nts in tsv_data:
            prt.write("{SEC}{FILL}\n".format(SEC=section_text, FILL=fill))
            if hdrs_wrote is False or len(data_nts) > prt_hdr_min:
                prt_tsv_hdr(prt, data_nts, **kws)
                hdrs_wrote = True
            num_items += prt_tsv_dat(prt, data_nts, **kws)
        return num_items
    else:
        return 0
884612
def t_ID(self, t):
        '

        if t.value[0] == '~':
            t.type = 'TYVAR'
            t.value = t.value[1:]
        elif t.value in self.reserved_words:
            t.type = self.reserved_words[t.value]
        else:
            t.type = 'ID'

        return t
1138332
def clean_win_tsv(filepath=os.path.join(DATA_PATH, 'Products.txt'),
                  index_col=False, sep='\t', lineterminator='\r', error_bad_lines=False, **kwargs):
    
    df = pd.read_csv(filepath, index_col=index_col, sep=sep, lineterminator=lineterminator,
                     error_bad_lines=error_bad_lines, **kwargs)
    index_col = df.columns[0]
    original_len = len(df)
    if df[index_col].values[-1] == '\n':
        df.iloc[-1, 0] = np.nan
        original_len = len(df) - 1
    df.dropna(how='all', inplace=True)
    df[index_col] = df[index_col].str.strip().apply(lambda x: x if x else str(INT_MIN)).astype(int)
    df = df[~(df[index_col] == INT_NAN)]
    df.set_index(index_col, inplace=True)
    if len(df) != original_len:
        logger.warning(('Loaded {} rows from tsv. Original file, "{}", contained {} seemingly valid lines.' +
                        'Index column: {}').format(len(df), original_len, filepath, index_col))
    return df
43738
def ti(self):
        
        if self._ti is None:
            from .tcex_ti import TcExTi

            self._ti = TcExTi(self)
        return self._ti
1015229
def tsv_escape(x: Any) -> str:
    
    if x is None:
        return ""
    x = str(x)
    return x.replace("\t", "\\t").replace("\n", "\\n")
418850
function text ({str, x, y}){
  return [
    svg(`text fill=#010101 fill-opacity=.3 x=${x} y=${y + 1}`, str),
    svg(`text fill=#fff x=${x} y=${y}`, str)
  ]
}
737426
def generate_tsv_pep_protein_quants(fns):
    """"""
    for fn in fns:
        header = get_tsv_header(fn)
        for pquant in generate_split_tsv_lines(fn, header):
            yield os.path.basename(fn), header, pquant
986899
def write_tsv_line_from_list(linelist, outfp):
    """"""
    line = '\t'.join(linelist)
    outfp.write(line)
    outfp.write('\n')
164441
def get_summary_str(self, sec2d_nt):
        """"""
        data = self.get_summary_data(sec2d_nt)
        return "{M} GO IDs placed into {N} sections; {U} unplaced GO IDs".format(
            N=len(data['sections']), M=len(data['grouped']), U=len(data['ungrouped']))
934324
def text(self):
        
        text = []
        rows = self.rowCount()
        cols = self.columnCount()

        # handle empty table case
        if rows == 2 and cols == 2:
            item = self.item(0, 0)
            if item is None:
                return ''

        for r in range(rows - 1):
            for c in range(cols - 1):
                item = self.item(r, c)
                if item is not None:
                    value = item.text()
                else:
                    value = '0'

                if not value.strip():
                    value = '0'

                text.append(' ')
                text.append(value)
            text.append(ROW_SEPARATOR)

        return ''.join(text[:-1])
911014
def tsv_trdict(vs):
    ''
    if options.safety_first:
        delim = options.get('delimiter', vs)
        return {ord(delim): options.get('tsv_safe_tab', vs), # \t
            10: options.get('tsv_safe_newline', vs),  # \n
            13: options.get('tsv_safe_newline', vs),  # \r
            }
    return {}
292464
def description(self):
        """"""
        lines = []
        for line in self.__doc__.split('\n')[2:]:
            line = line.strip()
            if line:
                lines.append(line)
        return ' '.join(lines)
962944
def to_representation(self, value):
        
        return {
            six.text_type(key): self.child.to_representation(val)
            for key, val in value.items()
        }
607031
def read_tsv(self):
        
        logging.info('Parsing MOB-recon outputs')
        for sample in self.metadata:
            if os.path.isfile(sample[self.analysistype].contig_report):
                # Read in the .tsv file with pandas. Skip the comment lines
                df = pd.read_csv(sample[self.analysistype].contig_report, delimiter='\t')
                for header in df:
                    # Remove any unwanted whitespace
                    clean_header = header.lstrip().rstrip()
                    # primary_key is the primary key, and value is the value of the cell for that key + header combo
                    for primary_key, value in df[header].items():
                        # Update the dictionary with the new data
                        try:
                            sample[self.analysistype].report_dict[primary_key].update({clean_header: value})
                        # Create the nested dictionary if it hasn't been created yet
                        except KeyError:
                            sample[self.analysistype].report_dict[primary_key] = dict()
                            sample[self.analysistype].report_dict[primary_key].update({clean_header: value})
1171345
def to_s
    out = ""

    @v.each do |line|
      out << "["

      # display all elements of this line
      line.each do |element|
        out << element.to_f.round(3).to_s << " "
      end

      out << "\b]\n" # TODO : FIX THAT broggi_t
    end
    out
  end
1026896
def b(s):
    """"""
    if sys.version < '3':
        if isinstance(s, unicode): #pylint: disable=undefined-variable
            return s.encode('utf-8')
    else:
        return s