This file is indexed.

/usr/share/pyshared/guiqwt/debug.py is in python-guiqwt 2.3.1-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
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
# -*- coding: utf-8 -*-
#
# Copyright © 2009-2010 CEA
# Pierre Raybaut
# Licensed under the terms of the CECILL License
# (see guiqwt/__init__.py for details)

"""
guiqwt.debug
------------

The `debug` module contains some debugging functions (mostly dumping attributes
of Qt Objects).
"""

from __future__ import print_function

from guidata.qt.QtGui import QImage, QInputEvent
from guidata.qt.QtCore import Qt, QEvent

from guidata.py3compat import io

def buttons_to_str(buttons):
    """Conversion des flags Qt en chaine"""
    string = ""
    if buttons & Qt.LeftButton:
        string += "L"
    if buttons & Qt.MidButton:
        string += "M"
    if buttons & Qt.RightButton:
        string += "R"
    return string


def evt_type_to_str(type):
    """Représentation textuelle d'un type d'événement (debug)"""
    if type == QEvent.MouseButtonPress:
        return "Mpress"
    elif type == QEvent.MouseButtonRelease:
        return "Mrelease"
    elif type == QEvent.MouseMove:
        return "Mmove"
    elif type == QEvent.ContextMenu:
        return "Context"
    else:
        return "%d" % type
    
    
def print_event(evt):
    """Représentation textuelle d'un événement (debug)"""
    string = ""
    if isinstance(evt, QInputEvent):
        string += evt_type_to_str( evt.type() )
        string += "%08x:" % evt.modifiers()
        if hasattr(evt, "buttons"):
            buttons = evt.buttons()
        elif hasattr(evt, "buttons"):
            buttons = evt.button()
        else:
            buttons = 0
        string += buttons_to_str(buttons)
    if string:
        print(string)
    else:
        print(evt)


def qimage_format( fmt ):
    for attr in dir(QImage):
        if attr.startswith("Format"):
            val = getattr(QImage, attr)
            if val == fmt:
                return attr[len("Format_"):]
    return str(fmt)
    
def qimage_to_str( img, indent="" ):
    fd = io.StringIO()
    print(indent, img, file=fd)
    indent += "  "
    print(indent, "Size:", img.width(), "x", img.height(), file=fd)
    print(indent, "Depth:", img.depth(), file=fd)
    print(indent, "Format", qimage_format(img.format()), file=fd)
    return fd.getvalue()