Skip to content

Commit

Permalink
[Summarizable] Added printable methods
Browse files Browse the repository at this point in the history
  • Loading branch information
YanSte committed Sep 8, 2023
1 parent efb5791 commit e8d603b
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions src/skit/Summarizable.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,24 @@
from abc import ABC, abstractmethod

class Summarizable(ABC):
def __init__(self, debug_mode=False):
self.__debug_mode = debug_mode

def summary(self):
title = f"=== {self.__class__.__name__} Configuration Summary ==="
print(title)
self.__print_sep()
print(f"{self.__class__.__name__} Configuration Summary")
for attr, value in self.__dict__.items():
print(f"{attr}: {value}")
print("=" * len(title))
self.__print_sep()

def __debug(self, *args):
if self.__debug_mode:
print(*args)

def __debug_sep(self, *args):
if self.__debug_mode:
self.__print_sep()

def __print_sep(self, character="=", length=30):
separator = character * length
print(separator)

0 comments on commit e8d603b

Please sign in to comment.