This file is indexed.

/usr/share/pyshared/djapian/database.py is in python-django-djapian 2.3.1-3.

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
import os
import xapian

from django.conf import settings

class Database(object):
    def __init__(self, path):
        self._path = path

    def open(self, write=False):
        """
        Opens database for manipulations
        """
        if not os.path.exists(self._path):
            os.makedirs(self._path)

        if write:
            database = xapian.WritableDatabase(
                self._path,
                xapian.DB_CREATE_OR_OPEN,
            )
        else:
            try:
                database = xapian.Database(self._path)
            except xapian.DatabaseOpeningError:
                self.create_database()

                database = xapian.Database(self._path)

        return database

    def create_database(self):
        database = xapian.WritableDatabase(
            self._path,
            xapian.DB_CREATE_OR_OPEN,
        )
        del database

    def document_count(self):
        return self.open().get_doccount()

    def clear(self):
        try:
            for file_path in os.listdir(self._path):
                os.remove(os.path.join(self._path, file_path))

            os.rmdir(self._path)
        except OSError:
            pass

class CompositeDatabase(Database):
    def __init__(self, dbs):
        self._dbs = dbs

    def open(self, write=False):
        if write:
            raise ValueError("Composite database cannot be opened for writing")

        base = self._dbs[0]
        raw = base.open()

        for db in self._dbs[1:]:
            raw.add_database(db.open())

        return raw

    def create_database(self):
        raise NonImplementedError

    def clear(self):
        raise NotImplementedError