Test Failed
Push — main ( 83549a...fbd06a )
by Sat CFDI
03:24
created

satdigitalinvoice.log_tools.print_yaml()   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 1
1
import yaml
2
from satcfdi import Code
3
4
5
def print_yaml(data):
6
    print(
7
        yaml.safe_dump(data, allow_unicode=True, width=1280, sort_keys=False)
8
    )
9
10
11
def log_email(receptor, notify_invoices, facturas_pendientes):
12
    print_yaml({
13
        "Rfc": Code(receptor["Rfc"], receptor["RazonSocial"]),
14
        "Facturas": [f"{i.name} - {i.uuid}" for i in notify_invoices],
15
        "PendientesMesesAnteriores": [f"{i.name} - {i.uuid}" for i in facturas_pendientes],
16
        "Correos": receptor["Email"]
17
    })
18
19
20
def log_line(text):
21
    ln = (150 - len(text)) // 2
22
    print(
23
        ("=" * ln) + " " + text + " " + ("=" * ln),
24
    )
25
26
27
def log_item(text):
28
    ln = (150 - len(text)) // 2
29
    print(
30
        ("*" * ln) + " " + text + " " + ("*" * ln),
31
    )
32
33
34
def cfdi_header(cfdi):
35
    receptor = Code(cfdi['Receptor']['Rfc'], cfdi['Receptor']['Nombre'])
36
    return f"{cfdi.name} - {cfdi.uuid} {receptor}"
37