This file is indexed.

/usr/lib/python3/dist-packages/rules/rulesets.py is in python3-django-rules 1.3.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
from .predicates import predicate


class RuleSet(dict):
    def test_rule(self, name, *args, **kwargs):
        return name in self and self[name].test(*args, **kwargs)

    def rule_exists(self, name):
        return name in self

    def add_rule(self, name, pred):
        if name in self:
            raise KeyError('A rule with name `%s` already exists' % name)
        self[name] = pred

    def remove_rule(self, name):
        del self[name]

    def __setitem__(self, name, pred):
        fn = predicate(pred)
        super(RuleSet, self).__setitem__(name, fn)


# Shared rule set

default_rules = RuleSet()


def add_rule(name, pred):
    default_rules.add_rule(name, pred)


def remove_rule(name):
    default_rules.remove_rule(name)


def rule_exists(name):
    return default_rules.rule_exists(name)


def test_rule(name, *args, **kwargs):
    return default_rules.test_rule(name, *args, **kwargs)