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

satdigitalinvoice.log_tools   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 4
eloc 15
dl 0
loc 24
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A NoAliasDumper.ignore_aliases() 0 2 1

3 Functions

Rating   Name   Duplication   Size   Complexity  
A print_yaml() 0 3 1
A header_line() 0 3 1
A cfdi_header() 0 3 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