This file is indexed.

/usr/lib/python3/dist-packages/pgspecial/namedqueries.py is in python3-pgspecial 1.7.0-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
# -*- coding: utf-8 -*-
class NamedQueries(object):

    section_name = 'named queries'

    usage = u'''Named Queries are a way to save frequently used queries
with a short name. Think of them as favorites.
Examples:

    # Save a new named query.
    > \\ns simple select * from abc where a is not Null;

    # List all named queries.
    > \\n
    +--------+----------------------------------------+
    | Name   | Query                                  |
    |--------+----------------------------------------|
    | simple | SELECT * FROM xyzb where a is not null |
    +--------+----------------------------------------+

    # Run a named query.
    > \\n simple
    +-----+
    |   a |
    |-----|
    |  50 |
    +-----+

    # Delete a named query.
    > \\nd simple
    simple: Deleted
'''

    # Class-level variable, for convenience to use as a singleton.
    instance = None

    def __init__(self, config):
        self.config = config

    @classmethod
    def from_config(cls, config):
        return NamedQueries(config)

    def list(self):
        return self.config.get(self.section_name, [])

    def get(self, name):
        return self.config.get(self.section_name, {}).get(name, None)

    def save(self, name, query):
        if self.section_name not in self.config:
            self.config[self.section_name] = {}
        self.config[self.section_name][name] = query
        self.config.write()

    def delete(self, name):
        try:
            del self.config[self.section_name][name]
        except KeyError:
            return '%s: Not Found.' % name
        self.config.write()
        return '%s: Deleted' % name