This file is indexed.

/usr/lib/python3/dist-packages/checkbox/lib/text.py is in python3-checkbox 0.17.6-0ubuntu6.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
#
# This file is part of Checkbox.
#
# Copyright 2008 Canonical Ltd.
#
# Checkbox is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3,
# as published by the Free Software Foundation.

#
# Checkbox is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Checkbox.  If not, see <http://www.gnu.org/licenses/>.
#
import re


def indent(text, count=1, step=2):
    """Intend each line of text by a given step.

    Keyword arguments:
    text -- text containing lines to indent
    count -- number of steps to indent (default 1)
    step -- number of spaces per indent (default 2)
    """

    indent = ' ' * step
    return "\n".join([indent * count + t for t in text.split("\n")])

def split(text, separator=r"\s", flags=0):
    parts = []
    while True:
        # Strip leading separators
        index = 0
        while index < len(text):
            if re.match(separator, text[index], flags):
                index += 1
            else:
                break

        text = text[index:]
        if not text:
            break

        # Split on following separator
        index = 0
        while index < len(text):
            if re.match(separator, text[index], flags):
                if text[index - 1] == "\\":
                    text = text[:index-1] + text[index:]
                else:
                    break
            else:
                index += 1

        parts.append(text[:index])
        text = text[index:]

    return parts

def wrap(text, limit=72):
    """Wrap text into lines up to limit characters excluding newline.

    Keyword arguments:
    text -- text to wrap
    limit -- maximum number of characters per line (default 72)
    """

    lines = ['']
    if text:
        current = -1
        inside = False
        for line in text.split("\n"):
            words = line.split()
            if words:
                inside = True
                for word in words:
                    increment = len(word) + 1
                    if current + increment > limit:
                        current = -1
                        lines.append('')
                    current += increment
                    lines[-1] += word + ' '
            else:
                if inside:
                    inside = False
                    lines.append('')
                lines.append('')
                current = -1

    return "\n".join(lines)

def unwrap(text):
    lines = text.split("\n")
    lines = [l.strip() for l in lines]
    return " ".join(lines)