Passed
Push — main ( 831997...bdbfd5 )
by Sat CFDI
01:47
created

satdigitalinvoice.log_tools.header_line()   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
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 header_line(text):
17
    ln = (150 - len(text)) // 2
18
    return ("=" * ln) + " " + text + " " + ("=" * ln)
19
20
21
def cfdi_header(cfdi):
22
    receptor = Code(cfdi['Receptor']['Rfc'], cfdi['Receptor']['Nombre'])
23
    return f"{cfdi.name} - {cfdi.uuid} {receptor}"
24