Pretty-print a matrix or vector.
970777
def pretty_str(p, decimal_places=2, print_zero=True, label_columns=False):
    ''''''
    if len(p.shape) == 1:
        return vector_str(p, decimal_places, print_zero)
    if len(p.shape) == 2:
        return matrix_str(p, decimal_places, print_zero, label_columns)
    raise Exception('Invalid array with shape {0}'.format(p.shape))
757629
def csv_matrix_print(classes, table):
    
    result = ""
    classes.sort()
    for i in classes:
        for j in classes:
            result += str(table[i][j]) + ","
        result = result[:-1] + "\n"
    return result[:-1]
1293624
public void printMatrixSize(MatrixSize size, MatrixInfo info) {
        format(Locale.ENGLISH, "%10d %10d", size.numRows(), size.numColumns());
        if (info.isCoordinate())
            format(Locale.ENGLISH, " %19d", size.numEntries());
        println();
    }
283267
def pretty_print(self, obj=None):
        
        print(self.pretty(obj if obj is not None else self.obj))
1012772
public static void print(String string, Number[][] matrix2, PrintStream out)
    {
        if (out == null)
        {
            return;
        }
        out.println(string);
        printResult(matrix2, out);
    }
1005258
public static DMatrixRMaj convert(DMatrix2 input , DMatrixRMaj output ) {
        if( output == null)
            output = new DMatrixRMaj(2,1);

        if( output.getNumRows() != 1 && output.getNumCols() != 1 )
            throw new IllegalArgumentException("One row or column must have a length of 1 for it to be a vector");
        int length = Math.max(output.getNumRows(),output.getNumCols());
        if( length != 2 )
            throw new IllegalArgumentException("Length of input vector is not 2.  It is "+length);

        output.data[0] = input.a1;
        output.data[1] = input.a2;

        return output;
    }
1176214
def Print(self):
        """"""
        for val, prob in sorted(self.d.iteritems()):
            print(val, prob)
650167
def pretty_print(n):
    """"""
    if type(n) != int:
        return n

    ret = []
    n = str(n)
    for i in range(len(n) - 1, -1, -1):
        ret.append(n[i])
        if (len(n) - i) % 3 == 0:
            ret.append(',')
    ret.reverse()
    return ''.join(ret[1:]) if ret[0] == ',' else ''.join(ret)
148608
def _pprint(params):
    """"""
    params_list = list()
    line_sep = ','
    for i, (k, v) in enumerate(sorted(params.iteritems())):
        if type(v) is float:
            # use str for representing floating point numbers
            # this way we get consistent representation across
            # architectures and versions.
            this_repr = '%s=%.10f' % (k, v)
        else:
            # use repr of the rest
            this_repr = '%s=%r' % (k, v)
        params_list.append(this_repr)

    lines = ','.join(params_list)
    return lines
1353743
public static void printMatrixData(double[][] matrix) {
        int cols = matrix[0].length;
        int rows = matrix.length;
        for (int r = 0; r < rows; r++) {
            for (int c = 0; c < cols; c++) {
                printer.print(matrix[r][c]);
                printer.print(separator);
            }
            printer.println();
        }
    }
653911
def pprint(object, stream=None, indent=1, width=80, depth=None):
    """"""
    printer = PrettyPrinter(
        stream=stream, indent=indent, width=width, depth=depth)
    printer.pprint(object)
118301
def normal_print(raw):
    ''' '''
    lines = raw.split('\n')
    for line in lines:
        if line:
            print(line + '\n')
619052
def print_row(value, num_blocks, val_min, color):
    
    if color:
        sys.stdout.write(f'\033[{color}m') # Start to write colorized.

    if num_blocks < 1 and (value > val_min or value > 0):
        # Print something if it's not the smallest
        # and the normal value is less than one.
        sys.stdout.write(SM_TICK)
    else:
        for _ in range(num_blocks):
            sys.stdout.write(TICK)

    if color:
        sys.stdout.write('\033[0m')
409009
def pretty_print(x, numchars):
    
    s = maybe_truncate(x, numchars)
    return s + ' ' * max(numchars - len(s), 0)
291358
def pretty_print(self):
        
        return u"%s\t%.3f\t%.3f\t%s" % (
            (self.identifier or u""),
            (self.begin if self.begin is not None else TimeValue("-2.000")),
            (self.end if self.end is not None else TimeValue("-1.000")),
            (self.text or u"")
        )
120281
def pretty_print(self, carrot=False):
        
        lineno = self.lineno
        padding = 0
        if lineno < 1000:
            padding = 1
        if lineno < 100:
            padding = 2
        if lineno < 10:
            padding = 3

        string = str(lineno) + (' ' * padding) + '|' + self.string
        if carrot:
            string += '\n' + (' ' * (self.col + 5))
        return string
990373
def printy(s):
    """"""
    if hasattr(s, 'as_utf8'):
        if hasattr(sys.stdout, 'buffer'):
            sys.stdout.buffer.write(s.as_utf8)
            sys.stdout.buffer.write(b"\n")
        else:
            sys.stdout.write(s.as_utf8)
            sys.stdout.write(b"\n")
    else:
        print(s)