saucenao.files.constraint   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 7
eloc 24
dl 0
loc 40
ccs 17
cts 17
cp 1
rs 10
c 0
b 0
f 0

7 Methods

Rating   Name   Duplication   Size   Complexity  
A Constraint.cmp_value_smaller() 0 3 1
A Constraint.cmp_value_bigger_or_equal() 0 3 1
A Constraint.cmp_value_bigger() 0 3 1
A Constraint.cmp_value_equals() 0 3 1
A Constraint.cmp_value_not_equals() 0 3 1
A Constraint.__init__() 0 8 1
A Constraint.cmp_value_smaller_or_equal() 0 3 1
1
#!/usr/bin/python
2
# -*- coding: utf-8 -*-
3 1
from typing import Callable
4
5
6 1
class Constraint:
7
8 1
    def __init__(self, value, cmp_func: Callable):
9
        """Initializing function
10
11
        :param value:
12
        :type cmp_func: Callable
13
        """
14 1
        self.value = value
15 1
        self.cmp_func = cmp_func
16
17 1
    @staticmethod
18
    def cmp_value_bigger(x, y):
19 1
        return x > y
20
21 1
    @staticmethod
22
    def cmp_value_bigger_or_equal(x, y):
23 1
        return x >= y
24
25 1
    @staticmethod
26
    def cmp_value_smaller(x, y):
27 1
        return x < y
28
29 1
    @staticmethod
30
    def cmp_value_smaller_or_equal(x, y):
31 1
        return x <= y
32
33 1
    @staticmethod
34
    def cmp_value_equals(x, y):
35 1
        return x == y
36
37 1
    @staticmethod
38
    def cmp_value_not_equals(x, y):
39
        return x != y
40