This file is indexed.

/usr/share/pyshared/circuits/node/utils.py is in python-circuits 2.1.0-2.

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
# Package:  utils
# Date:     ...
# Author:   ...

"""Utils

...
"""


import json

from circuits.core import Event
from circuits.six import text_type


def load_event(s):
    data = json.loads(s)

    name = "".join(x.title() for x in str(data["name"]).split("_"))

    args = []
    for arg in data["args"]:
        if isinstance(arg, text_type):
            arg = arg.encode("utf-8")
        args.append(arg)

    kwargs = {}
    for k, v in data["kwargs"].items():
        if isinstance(v, text_type):
            v = v.encode("utf-8")
        kwargs[str(k)] = v

    e = Event.create(name, *args, **kwargs)

    e.success = bool(data["success"])
    e.failure = bool(data["failure"])
    e.notify = bool(data["notify"])
    e.channels = tuple(data["channels"])

    return e, data["id"]


def dump_event(e, id):
    data = {
        "id": id,
        "name": e.name,
        "args": e.args,
        "kwargs": e.kwargs,
        "success": e.success,
        "failure": e.failure,
        "channels": e.channels,
        "notify": e.notify
    }

    return json.dumps(data)


def dump_value(v):
    data = {
        "id": v.node_trn,
        "errors": v.errors,
        "value": v._value,
    }
    return json.dumps(data)


def load_value(v):
    data = json.loads(v)
    return data['value'], data['id'], data['errors']