This file is indexed.

/usr/share/doc/python-application/examples/singleton.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
#!/usr/bin/python

from application.python.types import Singleton

class Unique(object):
    """This class has only one instance"""
    __metaclass__ = Singleton

class CustomUnique(object):
    """This class has one instance per __init__ arguments combination"""
    __metaclass__ = Singleton

    def __init__(self, name='default', value=1):
        self.name = name
        self.value = value


o1 = Unique()
o2 = Unique()

print "o1 is o2 (expect True):", o1 is o2

co1 = CustomUnique()
co2 = CustomUnique()
co3 = CustomUnique(name='myname')
co4 = CustomUnique(name='myname')
co5 = CustomUnique(name='myname', value=2)
co6 = CustomUnique(name='myothername')

print "co1 is co2 (expect True):", co1 is co2
print "co3 is co4 (expect True):", co3 is co4
print "co1 is co3 (expect False):", co1 is co3
print "co4 is co5 (expect False):", co4 is co5
print "co4 is co6 (expect False):", co4 is co6