52 lines
1.6 KiB
Python
52 lines
1.6 KiB
Python
#!/usr/bin/env python3
|
|
# -*- coding: utf-8 -*-
|
|
|
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
# IMPORTS
|
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
from code.local.typing import *;
|
|
|
|
from code.core.log import *;
|
|
|
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
# METHODS display case
|
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
def DisplayCase(name: Any):
|
|
logPlain('');
|
|
logInfo('\033[92;1mCASE {}\033[0m'.format(name))
|
|
return;
|
|
|
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
# METHODS display algorithm start/end
|
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
def DisplayStartOfAlgorithm(name: str, *_: Any, **inputs: Any):
|
|
DisplayBar(80);
|
|
logPlain('Ausführung vom Algorithmus: \033[92;1m{}\033[0m'.format(name));
|
|
logPlain('INPUTS');
|
|
for varname, value in inputs.items():
|
|
logPlain(' - {} = {}'.format(varname, value))
|
|
return;
|
|
|
|
def DisplayEndOfAlgorithm(*_: Any, **outputs: Any):
|
|
logPlain('OUTPUTS:')
|
|
for varname, value in outputs.items():
|
|
logPlain(' - {} = {}'.format(varname, value))
|
|
DisplayBar(80);
|
|
return;
|
|
|
|
def DisplayMetrics():
|
|
logPlain('Dauer der Ausführung: t = \033[2m{}\033[0m'.format(TimeElapsed()));
|
|
logPlain('Anzahl der Schritte: T(n) = \033[1m{}\033[0m'.format(NumberOfSteps()));
|
|
return;
|
|
|
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
# METHODS Verschiedenes
|
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
def DisplayBar(n: int = 80):
|
|
logPlain('+{}+'.format('-'*n));
|
|
return;
|