This file is indexed.

/usr/share/pyshared/couchdbkit/external.py is in python-couchdbkit 0.6.5-1.

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
# -*- coding: utf-8 -
#
# This file is part of couchdbkit released under the MIT license. 
# See the NOTICE for more information.

import sys

from .utils import json

class External(object):
    """ simple class to handle an external
    ans send the response.
    
    example:
    
        from couchdbkit.external import External
        from couchdbkit.utils import json 

        class Test(External):

            def handle_line(self, line):
                self.send_response(200, 
                    "got message external object %s" % json.dumps(line),
                    {"Content-type": "text/plain"})

        if __name__ == "__main__":
            Test().run()
        
    """

    def __init__(self, stdin=sys.stdin, stdout=sys.stdout):
        self.stdin = stdin
        self.stdout = stdout
        
    def handle_line(self, line):
        raise NotImplementedError
        
    def write(self, line):
        self.stdout.write("%s\n" % line)
        self.stdout.flush()
        
    def lines(self):
        line = self.stdin.readline()
        while line:
            yield json.loads(line)
            line = self.stdin.readline()
    
    def run(self):
        for line in self.lines():
            self.handle_line(line)
            
    def send_response(self, code=200, body="", headers={}):
        resp = {
            'code': code, 
            'body': body, 
            'headers': headers
        }
        self.write(json.dumps(resp))