Conditions | 5 |
Total Lines | 31 |
Code Lines | 25 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | from tabulate import tabulate |
||
27 | def write(self): |
||
28 | print("\n") |
||
29 | if self.error > 0: |
||
30 | error_headers = ["File"] |
||
31 | error_result = [] |
||
32 | for id in self.error_items: |
||
33 | error_result.append([id]) |
||
34 | |||
35 | print("****** ERROR DETAILS ******") |
||
36 | print(tabulate(error_result, headers=error_headers)) |
||
37 | print("\n") |
||
38 | |||
39 | if self.duplicate > 0: |
||
40 | duplicate_headers = ["File"] |
||
41 | duplicate_result = [] |
||
42 | for id in self.duplicate_items: |
||
43 | duplicate_result.append([id]) |
||
44 | |||
45 | print("****** DUPLICATE (NOT IMPORTED) DETAILS ******") |
||
46 | print(tabulate(duplicate_result, headers=duplicate_headers)) |
||
47 | print("\n") |
||
48 | |||
49 | headers = ["Metric", "Count"] |
||
50 | result = [ |
||
51 | ["Success", self.success], |
||
52 | ["Error", self.error], |
||
53 | ["Duplicate, not imported", self.duplicate] |
||
54 | ] |
||
55 | |||
56 | print("****** SUMMARY ******") |
||
57 | print(tabulate(result, headers=headers)) |
||
58 |