Beispiel #1
0
def get_line_width(method, width=None):
    _width = 0
    if method == C._STRING_BREAK_BY_TERMINAL:
        _width = get_terminal_size()[0]
    elif method == C._STRING_BREAK_BY_WIDTH:
        _width = width

    return _width
Beispiel #2
0
def get_line_width(method, width=None):
    _width = 0
    if method == C._STRING_BREAK_BY_TERMINAL:
        _width = get_terminal_size()[0]
    elif method == C._STRING_BREAK_BY_WIDTH:
        _width = width

    return _width
Beispiel #3
0
def too_long(indent_char, indent_cnt, position, inst_of_repr_block):
    indent_str = indent_cnt * indent_char

    choas = u''
    # assumpts its the value of list
    if position & C._AS_VALUE_:
        choas += '['
    choas += '\''

    terminal_x = get_terminal_size()[0]
    body = str(inst_of_repr_block)
    whole_line_x = len(indent_str) + len(body)

    return terminal_x - whole_line_x <= 0
Beispiel #4
0
def too_long(indent_char, indent_cnt, position, inst_of_repr_block):
    indent_str = indent_cnt*indent_char

    choas = u''
    # assumpts its the value of list
    if position & C._AS_VALUE_:
        choas += '['
    choas += '\''

    terminal_x = get_terminal_size()[0]
    body = str(inst_of_repr_block)
    whole_line_x = len(indent_str) + len(body)

    return terminal_x - whole_line_x <= 0