This file is indexed.

/usr/share/doc/python-application/examples/debug.py is in python-application 1.3.0-1.

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

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
#!/usr/bin/python

"""Example of using the debug facilities of python-application"""

# Timing code execution

from application.debug.timing import timer
count = 1000000
s1 = 'abcdef'
s2 = 'ghijkl'
s3 = 'mnopqr'

print ""
print "Timing different methods of adding strings"
print "------------------------------------------"
print ""

t = timer(count)
for x in xrange(count):
    s = s1 + s2 + s3
t.end(rate=True, msg="Adding strings using +")

t = timer(count)
for x in xrange(count):
    s = "%s%s%s" % (s1, s2, s3)
t.end(rate=True, msg="Adding strings using %")

t = timer(count)
for x in xrange(count):
    s = ''.join((s1, s2, s3))
t.end(rate=True, msg="Adding strings using ''.join()")


# Debugging memory leaks

class C1:
    pass

class C2:
    def __del__(self):
        pass

from application.debug.memory import *

print ""
print "Debugging memory leaks"
print "----------------------"
print ""

a = C1()
del a

print "This will reveal no memory references"
memory_dump()

a = C1()
b = C1()
a.b = b
b.a = a
del a, b

print "\n\nThis will reveal a collectable circular reference"
memory_dump()

a = C2()
b = C2()
a.b = b
b.a = a
del a, b

print "\n\nThis will reveal an uncollectable circular reference (mem leak)"
memory_dump()