2021-10-23 13:20:37 +02:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
# IMPORTS
|
|
|
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
from code.local.typing import *;
|
|
|
|
|
|
|
|
from code.core.log import *;
|
2021-10-24 16:35:29 +02:00
|
|
|
from code.setup.cli import GetArgumentParser;
|
|
|
|
|
|
|
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
# METHODS display help
|
|
|
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
def DisplayHelpMessage():
|
|
|
|
parser = GetArgumentParser();
|
|
|
|
parser.print_help();
|
|
|
|
return;
|
2021-10-23 13:20:37 +02:00
|
|
|
|
|
|
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
# METHODS display case
|
|
|
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
2021-10-24 12:40:09 +02:00
|
|
|
def DisplayStartOfCase(name: Any):
|
|
|
|
DisplayBar(80);
|
|
|
|
logPlain('\033[92;1mCASE {}\033[0m'.format(name))
|
|
|
|
return;
|
|
|
|
|
|
|
|
def DisplayEndOfCase():
|
|
|
|
DisplayBar(80);
|
2021-10-23 13:20:37 +02:00
|
|
|
return;
|
|
|
|
|
|
|
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
# METHODS display algorithm start/end
|
|
|
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
2021-10-24 12:29:06 +02:00
|
|
|
def DisplayStartOfAlgorithm(name: str, *_: Any, **inputs: Any):
|
|
|
|
logPlain('Ausführung vom Algorithmus: \033[92;1m{}\033[0m'.format(name));
|
|
|
|
logPlain('INPUTS');
|
2021-10-23 13:20:37 +02:00
|
|
|
for varname, value in inputs.items():
|
|
|
|
logPlain(' - {} = {}'.format(varname, value))
|
|
|
|
return;
|
|
|
|
|
2021-10-24 12:29:06 +02:00
|
|
|
def DisplayEndOfAlgorithm(*_: Any, **outputs: Any):
|
|
|
|
logPlain('OUTPUTS:')
|
2021-10-23 13:20:37 +02:00
|
|
|
for varname, value in outputs.items():
|
|
|
|
logPlain(' - {} = {}'.format(varname, value))
|
|
|
|
return;
|
|
|
|
|
|
|
|
def DisplayMetrics():
|
2021-10-24 12:32:59 +02:00
|
|
|
logPlain('Dauer der Ausführung: t = \033[1m{}\033[0m'.format(TimeElapsed()));
|
2021-10-24 12:29:06 +02:00
|
|
|
logPlain('Anzahl der Schritte: T(n) = \033[1m{}\033[0m'.format(NumberOfSteps()));
|
|
|
|
return;
|
|
|
|
|
|
|
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
# METHODS Verschiedenes
|
|
|
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
def DisplayBar(n: int = 80):
|
|
|
|
logPlain('+{}+'.format('-'*n));
|
2021-10-23 13:20:37 +02:00
|
|
|
return;
|