This file is indexed.

/usr/lib/python2.7/dist-packages/mipp/mda.py is in python-mipp 0.9.1-2build1.

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
#
# $Id$
#
from datetime import datetime
import numpy

def mslice(mda):
    _mda = Metadata()
    for key, val in mda.__dict__.items():
        if (not key.startswith('_') and 
            not callable(val) and
            key not in mda.ignore_attributes):
            setattr(_mda, key, val)
    return _mda

class Metadata(object):
    token = ':'
    ignore_attributes = ()
    dont_eval = ('satnumber',)

    
    def read(self, file_name):
        """Read until empty line, 'EOH' or 'EOF'.
        """
        fpi = open(file_name)
        try:
            for line in fpi:
                line = line.strip()
                if not line or line == 'EOH':
                    # end of meta-data
                    break
                line = line.split('#')[0].strip()
                if not line:
                    # just a comment
                    continue
                key, val = [s.strip() for s in line.split(self.token, 1)]
                if key not in self.dont_eval:
                    try:
                        val = eval(val)
                    except:
                        pass
                if key:
                    setattr(self, key, val)
        finally:
            fpi.close()
        return self

    def save(self, file_name):
        fpo = open(file_name, 'w')
        fpo.write(str(self) + '\n')
        fpo.close()

    def __str__(self):
        keys = sorted(self.__dict__.keys())
        strn = ''
        for key in keys:
            val = getattr(self, key)
            if (not key.startswith('_') and 
                not callable(val) and
                key not in self.ignore_attributes):
                val = _nice2cmp(val)
                strn += key + self.token + ' ' + str(val) + '\n'
        return strn[:-1]

def _nice2cmp(val):
    # ... and nice to print
    if isinstance(val, numpy.ndarray):
        val = val.tolist()
    elif isinstance(val, datetime):
        val = str(val)
    elif isinstance(val, float):
        val = str(val)
    elif isinstance(val, dict):
        sdc = {}
        for _key, _val in val.items():
            if isinstance(_val, numpy.ndarray):
                _val = _val.tolist()
            sdc[_key] = _val
        val = sdc
    return val

if __name__ == '__main__':
    import sys
    print Metadata().read(sys.argv[1])