This file is indexed.

/usr/share/pyshared/archmod/Cached.py is in archmage 1:0.2.4-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
class Cached(object):
    """Provides caching storage for data access decoration.
    Usage:
        class CachedClass(Cached):
            def _getitem(self, name):
                # implement data getting routine, such as db access
        
        CachedClass().attribute1 # returns value as if _getitem('attribute1') was called  
        CachedClass().attribute2 # returns value as if _getitem('attribute2') was called  
        CachedClass().__doc__ # returns real docstring  
    """

    def __new__(classtype, *args, **kwargs):
        __instance = object.__new__(classtype, *args, **kwargs)
        __instance.cache = {}
        return __instance
       
    # to be implemented by contract in the descendant classes
    def _getitem(self, name):
        raise Exception(NotImplemented)
        
    def __getattribute__(self, name):
        try:
            return object.__getattribute__(self, name)
        except:
            if not self.cache.has_key(name):
                self.cache[name] = self._getitem(name)
            return self.cache[name]