Test Failed
Push — main ( 91216a...7d4c18 )
by Sat CFDI
03:42
created

satdigitalinvoice.local.LocalDB.ppd_ignorar()   A

Complexity

Conditions 1

Size

Total Lines 3
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nop 2
1
from uuid import UUID
2
3
import diskcache
4
5
PUE_PAGADA = 'pue_pagada'
6
PPD_IGNORAR = 'ppd_ignorar'
7
EMAIL_NOTIFICADA = 'email_notificada'
8
STATUS_SAT = 'status_sat'
9
10
11
class LocalDB:
12
    def __init__(self):
13
        self.local_storage = diskcache.Cache('.data/local')
14
15
    def pue_pagada(self, uuid: UUID):
16
        return self.local_storage.get(
17
            (PUE_PAGADA, uuid), False
18
        )
19
20
    def pue_pagada_set(self, uuid: UUID, value: bool):
21
        if value:
22
            self.local_storage[(PUE_PAGADA, uuid)] = value
23
        else:
24
            try:
25
                del self.local_storage[(PUE_PAGADA, uuid)]
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable PUE_PAGADA does not seem to be defined.
Loading history...
26
            except KeyError:
27
                pass
28
29
    def ppd_ignorar(self, uuid: UUID):
30
        return self.local_storage.get(
31
            (PPD_IGNORAR, uuid), False
32
        )
33
34
    def ppd_ignorar_set(self, uuid: UUID, value: bool):
35
        if value:
36
            self.local_storage[(PPD_IGNORAR, uuid)] = value
37
        else:
38
            try:
39
                del self.local_storage[(PPD_IGNORAR, uuid)]
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable PPD_IGNORAR does not seem to be defined.
Loading history...
40
            except KeyError:
41
                pass
42
43
    def email_notificada(self, uuid: UUID):
44
        return self.local_storage.get(
45
            (EMAIL_NOTIFICADA, uuid), False
46
        )
47
48
    def email_notificada_set(self, uuid: UUID, value: bool):
49
        if value:
50
            self.local_storage[(EMAIL_NOTIFICADA, uuid)] = value
51
        else:
52
            try:
53
                del self.local_storage[(EMAIL_NOTIFICADA, uuid)]
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable EMAIL_NOTIFICADA does not seem to be defined.
Loading history...
54
            except KeyError:
55
                pass
56
57
    def status_sat(self, uuid: UUID):
58
        return self.local_storage.get(
59
            (STATUS_SAT, uuid), {}
60
        )
61
62
    def status_sat_set(self, uuid: UUID, value: dict):
63
        if value:
64
            self.local_storage[(STATUS_SAT, uuid)] = value
65
        else:
66
            try:
67
                del self.local_storage[(STATUS_SAT, uuid)]
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable STATUS_SAT does not seem to be defined.
Loading history...
68
            except KeyError:
69
                pass
70