This file is indexed.

/usr/share/pyshared/gnome_sudoku/pausable.py is in gnome-sudoku 1:3.4.2-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
# -*- coding: utf-8 -*-
import time

class MethodWrapper:

    def __call__ (self, cls):
        for attr in dir(cls):
            attrobj = getattr(cls, attr)
            if callable(attrobj) and attr.find('__')!=0:
                setattr(cls, attr, self.wrap(attrobj))

    def wrap (self, f):
        def _(*args, **kwargs):
            self.wrapper(*args, **kwargs)
            return f(*args, **kwargs)
        return _

    def wrapper (self, *args, **kwargs):
        print args, kwargs

class PausableWrapper (MethodWrapper):

    def __init__ (self, sleep_for=1):
        self.sleep_for = sleep_for

    def __call__ (self, cls):
        MethodWrapper.__call__(self, cls)
        cls.paused = False
        cls.terminated = False
        cls.pause = lambda *args: self.pause(cls)
        cls.resume = lambda *args: self.resume(cls)
        cls.terminate = lambda *args: self.terminate(cls)
        cls.stop = lambda *args: self.terminate(cls)
        self.init_wrap(cls.__init__)


    def init_wrap (self, f):
        def _(cls, *args, **kwargs):
            cls.paused = False
            cls.terminated = False
            return f(cls, *args, **kwargs)
        return _

    def pause (self, cls):
        cls.paused = True

    def resume (self, cls):
        cls.paused = False

    def terminate (self, cls):
        cls.terminated = True

    def unterminate (self, cls):
        cls.terminated = False

    def wrapper (self, cls, *args, **kwargs):
        if cls.terminated:
            raise Exception("Terminated!")
        while cls.paused:
            if cls.terminated:
                raise Exception("Terminated!")
            time.sleep(self.sleep_for)


make_pausable = PausableWrapper()