OnLogRecord.__call__()   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
dl 0
loc 2
rs 10
c 0
b 0
f 0
1
class OnLogRecord(object):
2
    """Trigger a callback when a certain log record is found.
3
4
    Parameters
5
    ----------
6
    record_name : str
7
        The record name to check.
8
9
    """
10
    def __init__(self, record_name):
11
        self.record_name = record_name
12
13
    def __call__(self, log):
14
        return bool(log.current_row.get(self.record_name, False))
15
16
    def __eq__(self, other):
17
        return (type(other) == type(self) and
18
                other.record_name == self.record_name)
19