This file is indexed.

/usr/lib/python3/dist-packages/nagiosplugin/state.py is in python3-nagiosplugin 1.2.4-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
"""Classes  to represent check outcomes.

This module defines :class:`ServiceState` which is the abstract base
class for check outcomes. class for check outcomes. class for check
outcomes. The four states defined by the :term:`Nagios plugin API` are
represented as singleton subclasses.

Note that the *warning* state is defined by the :class:`Warn` class. The
class has not been named `Warning` to avoid being confused with the
built-in Python exception of the same name.
"""

import collections
import functools


def worst(states):
    """Reduce list of *states* to the most significant state."""
    return functools.reduce(lambda a, b: a if a > b else b, states, Ok)


class ServiceState(collections.namedtuple('ServiceState', 'code text')):
    """Abstract base class for all states.

    Each state has two constant attributes: :attr:`text` is the short
    text representation which is printed for example at the beginning of
    the summary line. :attr:`code` is the corresponding exit code.
    """

    def __str__(self):
        """Plugin-API compliant text representation."""
        return self.text

    def __int__(self):
        """Plugin API compliant exit code."""
        return self.code


class Ok(ServiceState):

    def __new__(cls):
        return super(cls, Ok).__new__(cls, 0, 'ok')

Ok = Ok()


class Warn(ServiceState):

    def __new__(cls):
        return super(cls, Warn).__new__(cls, 1, 'warning')

Warn = Warn()


class Critical(ServiceState):

    def __new__(cls):
        return super(cls, Critical).__new__(cls, 2, 'critical')

Critical = Critical()


class Unknown(ServiceState):

    def __new__(cls):
        return super(cls, Unknown).__new__(cls, 3, 'unknown')

Unknown = Unknown()