Return a human-readable string representation of this object.

        Kwargs:
            indent (int): The amount of spaces to use as indentation.
19316
def pretty_str(self, indent=0):
        
        spaces = ' ' * indent
        return spaces + ', '.join(v.pretty_str() for v in self.variables)
1187078
def wrap(string, length, indent):
    
    newline = "\n" + " " * indent
    return newline.join((string[i : i + length] for i in range(0, len(string), length)))
1136946
def ToDebugString(self, indentation_level=1):
    
    indentation = '  ' * indentation_level

    text_parts = ['{0:s}path segment index: {1:d}\n'.format(
        indentation, self.path_segment_index)]

    for path_segment, scan_object in self._path_segments.items():
      text_parts.append('{0:s}path segment: {1:s}\n'.format(
          indentation, path_segment))

      if isinstance(scan_object, PathFilterScanTreeNode):
        text_parts.append('{0:s}scan tree node:\n'.format(indentation))
        text_parts.append(scan_object.ToDebugString(indentation_level + 1))

      elif isinstance(scan_object, py2to3.STRING_TYPES):
        text_parts.append('{0:s}path: {1:s}\n'.format(
            indentation, scan_object))

    text_parts.append('{0:s}default value:\n'.format(indentation))

    if isinstance(self.default_value, PathFilterScanTreeNode):
      text_parts.append('{0:s}scan tree node:\n'.format(indentation))
      text_parts.append(self.default_value.ToDebugString(indentation_level + 1))

    elif isinstance(self.default_value, py2to3.STRING_TYPES):
      text_parts.append('{0:s}pattern: {1:s}\n'.format(
          indentation, self.default_value))

    text_parts.append('\n')

    return ''.join(text_parts)
1014139
function getIndentation(str, index) {
  let indentStart = index;
  let indentEnd = index;
  while (indentStart) {
    const c = str.charCodeAt(indentStart - 1);
    // line break
    if (c === 10 || c === 13 || c === 0x2028 || c === 0x2029) {
      break;
    }
    indentStart--;
    // not white space
    if (c !== 9 && c !== 11 && c !== 12 && c !== 32 && c !== 160) {
      indentEnd = indentStart;
    }
  }
  return str.substring(indentStart, indentEnd);
}
265816
def indent(indent_str=None):
    

    def indentation_rule():
        inst = Indentator(indent_str)
        return {'layout_handlers': {
            Indent: inst.layout_handler_indent,
            Dedent: inst.layout_handler_dedent,
            Newline: inst.layout_handler_newline,
            OptionalNewline: inst.layout_handler_newline_optional,
            OpenBlock: layout_handler_openbrace,
            CloseBlock: layout_handler_closebrace,
            EndStatement: layout_handler_semicolon,
        }}
    return indentation_rule
243299
def _str(self, indent=""):
        """"""
        if self.ndim <= 1:
            return "[" + ", ".join(str(x) for x in self) + "]"
        elif self.ndim == 2:
            sep = ",\n" + indent
            return "[" + sep.join(x._str(indent + " ") for x in self) + "]"
        else:
            sep = ",\n\n" + indent
            return "[" + sep.join(x._str(indent + " ") for x in self) + "]"
993178
def indent(value, n=2, character=' '):
    

    prefix = n * character
    return '\n'.join(prefix + line for line in value.splitlines())
307965
def _get_indent(marker, s, tab_width=8):
    """"""
    # Figure out how much the marker is indented.
    INDENT_CHARS = tuple(' \t')
    start = s.index(marker)
    i = start
    while i > 0:
        if s[i - 1] not in INDENT_CHARS:
            break
        i -= 1
    indent = s[i:start]
    indent_width = 0
    for ch in indent:
        if ch == ' ':
            indent_width += 1
        elif ch == '\t':
            indent_width += tab_width - (indent_width % tab_width)
    return indent, indent_width
1171265
def indent(func):
    
    def wrapper(self, *args, **kwds):
        func(self, *args, **kwds)
        return Indent(self)
    return wrapper
39952
def t_ANY_STRING(self, t):
        '
        escaped = 0
        t.lexer.lineno += t.value.count('\n')
        s = t.value[1:-1]
        new_str = ""
        for i in range(0, len(s)):
            c = s[i]
            if escaped:
                if c == 'n':
                    c = '\n'
                elif c == 't':
                    c = '\t'
                new_str += c
                escaped = 0
            else:
                if c == '\\':
                    escaped = 1
                else:
                    new_str += c
        # remove current indentation
        indentation_str = ' ' * _indent_level_to_spaces_count(self.cur_indent)
        lines_without_indentation = [
            line.replace(indentation_str, '', 1)
            for line in new_str.splitlines()]
        t.value = '\n'.join(lines_without_indentation)
        return t
803020
function () {
            var indentStr = '';
            for (var i = 0; i < indentLevel; i++) {
                indentStr += INDENT;
            }
            return {
                type: 'WhiteSpace',
                value: indentStr
            };
        }
295110
def _indent(text, amount):
    
    indentation = amount * ' '
    return indentation + ('\n' + indentation).join(text.split('\n'))
838068
def calculate_indent(text):
    
    indent = 0
    for c in text:
        if c is '\t':
            raise ValueError()
        if c is not ' ':
            return indent,text[indent:]
        indent += 1
    return indent,''
418952
def indent(text, indent=2, width=128):
    
    return "\n".join(
        textwrap.wrap(text,
                      width=width,
                      initial_indent=" " * indent,
                      subsequent_indent=" " * indent))
207641
def ustring(self,
                indent,
                color,
                msg,
                prefix='',
                suffix='',
                endc=None):
        ''''''
        if endc is None:
            endc = self.ENDC  # pylint: disable=no-member

        indent *= ' '
        fmt = u'{0}{1}{2}{3}{4}{5}'

        try:
            return fmt.format(indent, color, prefix, msg, endc, suffix)
        except UnicodeDecodeError:
            return fmt.format(indent, color, prefix, salt.utils.data.decode(msg), endc, suffix)
808159
def format(self, indent_level, indent_size=4):
        

        name = self.format_name('Literal', indent_size)

        if self.long_desc is not None:
            name += '\n'

        name += self.wrap_lines('value: %s\n' % str(self._literal), 1, indent_size)

        return self.wrap_lines(name, indent_level, indent_size)
1151970
def pretty_str(self, indent=0):
        
        spaces = ' ' * indent
        pretty = '{}namespace {}:\n'.format(spaces, self.name)
        pretty += '\n\n'.join(c.pretty_str(indent + 2) for c in self.children)
        return pretty