satdigitalinvoice.log_tools.to_yaml()   A
last analyzed

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 1
1
import yaml
2
3
4
class NoAliasDumper(yaml.SafeDumper):
5
    def ignore_aliases(self, data):
6
        return True
7
8
9
def print_yaml(data):
10
    print(
11
        to_yaml(data)
12
    )
13
14
15
def to_yaml(data):
16
    return yaml.dump(data, Dumper=NoAliasDumper, allow_unicode=True, width=1280, sort_keys=False)
17
18
19
def header_line(text):
20
    ln = (150 - len(text)) // 2
21
    return ("=" * ln) + " " + text + " " + ("=" * ln) + "\n"
22