Passed
Push — main ( 43fd9a...6613a8 )
by Sat CFDI
01:45
created

NoAliasDumper.ignore_aliases()   A

Complexity

Conditions 1

Size

Total Lines 2
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 2
rs 10
c 0
b 0
f 0
cc 1
nop 2
1
import yaml
2
from satcfdi import Code
3
4
5
class NoAliasDumper(yaml.SafeDumper):
6
    def ignore_aliases(self, data):
7
        return True
8
9
10
def print_yaml(data):
11
    print(
12
        yaml.dump(data, Dumper=NoAliasDumper, allow_unicode=True, width=1280, sort_keys=False)
13
    )
14
15
16
def log_email(receptor, notify_invoices, facturas_pendientes):
17
    print_yaml({
18
        "rfc": Code(receptor["Rfc"], receptor["RazonSocial"]),
19
        "facturas": [f"{i.name} - {i.uuid}" for i in notify_invoices],
20
        "pendientes_meses_anteriores": [f"{i.name} - {i.uuid}" for i in facturas_pendientes],
21
        "correos": receptor["Email"]
22
    })
23
24
25
def header_line(text):
26
    ln = (151 - len(text)) // 2
27
    return ("=" * ln) + " " + text + " " + ("=" * ln)
28
29
30
def log_line(text):
31
    print(
32
        header_line(text)
33
    )
34
35
36
def log_item(text):
37
    ln = (151 - len(text)) // 2
38
    print(
39
        ("*" * ln) + " " + text + " " + ("*" * ln),
40
    )
41
42
43
def cfdi_header(cfdi):
44
    receptor = Code(cfdi['Receptor']['Rfc'], cfdi['Receptor']['Nombre'])
45
    return f"{cfdi.name} - {cfdi.uuid} {receptor}"
46