Turn the tabu object into a string in Latex format.
428339
def dumps(self):
        """"""

        _s = super().dumps()

        # Tabu tables support a unusual syntax:
        # \begin{tabu} spread 0pt {<col format...>}
        #
        # Since this syntax isn't common, it doesn't make
        # sense to support it in the baseclass (e.g., Environment)
        # rather, here we fix the LaTeX string post-hoc
        if self._preamble:
            if _s.startswith(r"\begin{longtabu}"):
                _s = _s[:16] + self._preamble + _s[16:]
            elif _s.startswith(r"\begin{tabu}"):
                _s = _s[:12] + self._preamble + _s[12:]
            else:
                raise TableError("Can't apply preamble to Tabu table "
                                 "(unexpected initial command sequence)")

        return _s
595458
def to_str(self):
        ''''''
        pairs = []
        for name, value in self.get_all():
            if value and self._wrap_width:
                pairs.append('{0}:{1}'.format(
                    name,
                    '\r\n'.join(textwrap.wrap(
                        value, width=self._wrap_width,
                        drop_whitespace=False, initial_indent=' ',
                        subsequent_indent=' '
                    ))
                ))
            elif value:
                pairs.append('{0}: {1}'.format(name, value))
            else:
                pairs.append('{0}:'.format(name))

        pairs.append('')
        return '\r\n'.join(pairs)
59032
def parse_tablature(lines):
    '''  '''
    lines = [parse_line(l) for l in lines]
    return Tablature(lines=lines)
1243403
def _convert_strls(self, data):
        """"""
        convert_cols = [
            col for i, col in enumerate(data)
            if self.typlist[i] == 32768 or col in self._convert_strl]

        if convert_cols:
            ssw = StataStrLWriter(data, convert_cols)
            tab, new_data = ssw.generate_table()
            data = new_data
            self._strl_blob = ssw.generate_blob(tab)
        return data
397186
def cols_str(columns):
    """"""
    cols = ""
    for c in columns:
        cols = cols + wrap(c) + ', '
    return cols[:-2]
745899
def as_strings(self):
        """"""
        if self.value == '' or self.value is None:
            return '{0};\n'.format(self.name)
        if '"' not in self.value and (';' in self.value or '#' in self.value):
            return '{0} "{1}";\n'.format(self.name, self.value)
        return '{0} {1};\n'.format(self.name, self.value)
521582
def to_xml_string(str = '')
      update_properties
      str << "<sheetPr #{serialized_attributes}>"
      tab_color.to_xml_string(str, 'tabColor') if tab_color
      outline_pr.to_xml_string(str) if @outline_pr
      page_setup_pr.to_xml_string(str)
      str << "</sheetPr>"
    end
840941
def to_string(self):
        """"""
        suffix = '%s %s' % (self.type, self.name)
        if self.initial_value:
            suffix += ' = ' + self.initial_value
        return suffix
965373
def value_to_string(self, obj):
        """"""
        try:
            return force_unicode(self.__get__(obj))
        except TypeError:
            return str(self.__get__(obj))
1329495
private <T> String format(final T t,
                              final IClassContainer container,
                              final Mode mode) {
        final List<ExportContainer> exportContainers = extractExportContainers(t, container);

        final String tabObject = (mode == Mode.SINGLE) ? "" : "\t";

        final StringBuilder builder = new StringBuilder()
                .append(tabObject)
                .append(wrapOpenXmlTag(container.getExportClassName()))
                .append("\n");

        final String resultValues = exportContainers.stream()
                .map(c -> buildXmlValue(mode, container.getField(c.getExportName()), c))
                .collect(Collectors.joining("\n"));

        builder.append(resultValues)
                .append("\n");

        return builder.append(tabObject)
                .append(wrapCloseXmlTag(container.getExportClassName()))
                .toString();
    }
496488
def dumps(self):
        

        args = [self.size, self.align, self.dumps_content()]
        string = Command(self.latex_name, args).dumps()

        return string
699388
def _latex_format(obj: Any) -> str:
    """"""
    if isinstance(obj, float):
        try:
            return sympy.latex(symbolize(obj))
        except ValueError:
            return "{0:.4g}".format(obj)

    return str(obj)
1204648
def format_no_tty(table):
    """"""

    for i, row in enumerate(table.rows):
        for j, item in enumerate(row):
            table.rows[i][j] = format_output(item, fmt='raw')
    ptable = table.prettytable()

    for col in table.columns:
        ptable.align[col] = 'l'

    ptable.hrules = prettytable.NONE
    ptable.border = False
    ptable.header = False
    ptable.left_padding_width = 0
    ptable.right_padding_width = 2
    return ptable
826605
def _tab(element):
    

    elements = {
        'x': 'tab5.2a.txt',
        'y': 'tab5.2b.txt',
        's': 'tab5.2d.txt'
    }

    if element.lower() not in elements.keys():
        raise ValueError('Unknown element \'%s\'' % element)

    filepath = Path(__file__).parent / "data" / elements[element.lower()]

    total = []
    with filepath.open() as fhd:

        for line in fhd.read().splitlines():

            line = line.strip()

            if line.startswith("#") or not line.strip():
                continue

            if line.startswith('j = '):
                result = []
                total.append(result)
                continue

            # The first field is only an index
            fields = line.split()[1:]
            fields[:2] = [float(x) for x in fields[:2]]
            fields[2:] = [int(x) for x in fields[2:]]
            result.append(fields)

    return total
793642
def _to_str_columns(self):
        
        frame = self.tr_frame

        # may include levels names also

        str_index = self._get_formatted_index(frame)
        str_columns = self._get_formatted_column_labels(frame)

        if self.header:
            stringified = []
            for i, c in enumerate(frame.columns):
                cheader = str_columns[i]
                max_colwidth = max(self.col_space or 0,
                                   *(self.adj.len(x) for x in cheader))
                fmt_values = self._format_col(i)
                fmt_values = _make_fixed_width(fmt_values, self.justify,
                                               minimum=max_colwidth,
                                               adj=self.adj)

                max_len = max(max([self.adj.len(x) for x in fmt_values]),
                              max_colwidth)
                cheader = self.adj.justify(cheader, max_len, mode=self.justify)
                stringified.append(cheader + fmt_values)
        else:
            stringified = []
            for i, c in enumerate(frame):
                fmt_values = self._format_col(i)
                fmt_values = _make_fixed_width(fmt_values, self.justify,
                                               minimum=(self.col_space or 0),
                                               adj=self.adj)

                stringified.append(fmt_values)

        strcols = stringified
        if self.index:
            strcols.insert(0, str_index)

        # Add ... to signal truncated
        truncate_h = self.truncate_h
        truncate_v = self.truncate_v

        if truncate_h:
            col_num = self.tr_col_num
            col_width = self.adj.len(strcols[self.tr_size_col][0])  # infer from column header
            strcols.insert(self.tr_col_num + 1, ['...'.center(col_width)] * (len(str_index)))
        if truncate_v:
            n_header_rows = len(str_index) - len(frame)
            row_num = self.tr_row_num
            for ix, col in enumerate(strcols):
                cwidth = self.adj.len(strcols[ix][row_num])  # infer from above row
                is_dot_col = False
                if truncate_h:
                    is_dot_col = ix == col_num + 1
                if cwidth > 3 or is_dot_col:
                    my_str = '...'
                else:
                    my_str = '..'

                if ix == 0:
                    dot_mode = 'left'
                elif is_dot_col:
                    cwidth = self.adj.len(strcols[self.tr_size_col][0])
                    dot_mode = 'center'
                else:
                    dot_mode = 'right'
                dot_str = self.adj.justify([my_str], cwidth, mode=dot_mode)[0]
                strcols[ix].insert(row_num + n_header_rows, dot_str)
        return strcols
284938
def pretty_format(obj, indent=None):
        
        if indent is None:
            if isinstance(obj, TLObject):
                obj = obj.to_dict()

            if isinstance(obj, dict):
                return '{}({})'.format(obj.get('_', 'dict'), ', '.join(
                    '{}={}'.format(k, TLObject.pretty_format(v))
                    for k, v in obj.items() if k != '_'
                ))
            elif isinstance(obj, str) or isinstance(obj, bytes):
                return repr(obj)
            elif hasattr(obj, '__iter__'):
                return '[{}]'.format(
                    ', '.join(TLObject.pretty_format(x) for x in obj)
                )
            else:
                return repr(obj)
        else:
            result = []
            if isinstance(obj, TLObject):
                obj = obj.to_dict()

            if isinstance(obj, dict):
                result.append(obj.get('_', 'dict'))
                result.append('(')
                if obj:
                    result.append('\n')
                    indent += 1
                    for k, v in obj.items():
                        if k == '_':
                            continue
                        result.append('\t' * indent)
                        result.append(k)
                        result.append('=')
                        result.append(TLObject.pretty_format(v, indent))
                        result.append(',\n')
                    result.pop()  # last ',\n'
                    indent -= 1
                    result.append('\n')
                    result.append('\t' * indent)
                result.append(')')

            elif isinstance(obj, str) or isinstance(obj, bytes):
                result.append(repr(obj))

            elif hasattr(obj, '__iter__'):
                result.append('[\n')
                indent += 1
                for x in obj:
                    result.append('\t' * indent)
                    result.append(TLObject.pretty_format(x, indent))
                    result.append(',\n')
                indent -= 1
                result.append('\t' * indent)
                result.append(']')

            else:
                result.append(repr(obj))

            return ''.join(result)
723995
def format(self, obj, **kwargs):
        """"""
        sio = StringIO()
        self.fprint(obj, stream=sio, **kwargs)
        return sio.getvalue()