pyEDAA.Reports.CLI
Tools to extract data from UCDB files.
Usage
First export/convert the Aldec Coverage Database (ACDB) into UCDB (Universal Coverage Database) format. The
helper program acdb2xml (part of Active-HDL or Riviera-PRO installation) can be used.
acdb2xml -i aggregate.acdb -o ucdb.xml
At next use this layer’s service program to convert from UCDB to Cobertura format.
pyedaa-ucis export --ucdb ucdb.xml --cobertura cobertura.xml
Submodules
Functions
main(): Entrypoint to start program execution.
Classes
ProgramBase: Base-class for all program classes.Application: Program class to implement the command line interface (CLI) using commands and options.
Functions
- pyEDAA.Reports.CLI.main()[source]
Entrypoint to start program execution.
- Return type:
- This function should be called either from:
if __name__ == "__main__":orconsole_scriptsentry point configured viasetuptoolsinsetup.py.
This function creates an instance of
Programin atry ... exceptenvironment. Any exception caught is formatted and printed before the program returns with a non-zero exit code.
Classes
- class pyEDAA.Reports.CLI.ProgramBase(mode=Mode.AllLinearToStdOut)[source]
Base-class for all program classes.
Inheritance
- Parameters:
mode (Mode)
- CheckPythonVersion(version)
Check if the used Python interpreter fulfills the minimum version requirements.
- property CriticalWarningCount: int
Read-only property to access the number of counted critical warnings.
- Returns:
Number of critical warnings.
- property ErrorCount: int
Read-only property to access the number of counted errors.
- Returns:
Number of errors.
- Exit(returnCode=0)
Exit the terminal application by uninitializing color support and returning an Exit code.
- ExitOnPreviousCriticalWarnings(includeErrors=True)
Exit application if error or critical warnings have been printed.
- ExitOnPreviousWarnings(includeCriticalWarnings=True, includeErrors=True)
Exit application if error or (critical) warnings have been printed.
- FatalExit(returnCode=0)
Exit the terminal application by uninitializing color support and returning a fatal Exit code.
- Foreground = {'BLUE': '\x1b[94m', 'CYAN': '\x1b[96m', 'DARK_BLUE': '\x1b[34m', 'DARK_CYAN': '\x1b[36m', 'DARK_GRAY': '\x1b[90m', 'DARK_GREEN': '\x1b[32m', 'DARK_RED': '\x1b[31m', 'DARK_YELLOW': '\x1b[33m', 'ERROR': '\x1b[91m', 'GRAY': '\x1b[37m', 'GREEN': '\x1b[92m', 'HEADLINE': '\x1b[95m', 'MAGENTA': '\x1b[95m', 'NOCOLOR': '\x1b[39m', 'RED': '\x1b[91m', 'WARNING': '\x1b[93m', 'WHITE': '\x1b[97m', 'YELLOW': '\x1b[93m'}
Terminal colors
- classmethod GetMethodsWithAttributes(predicate: TAttr | Iterable[TAttr] | None = None) Dict[Callable, Tuple[Attribute, ...]]
- static GetTerminalSize()
Returns the terminal size as tuple (width, height) for Windows, macOS (Darwin), Linux, cygwin (Windows), MinGW32/64 (Windows).
- property Height: int
Read-only property to access the terminal’s height.
- Returns:
The terminal window’s height in characters.
- InitializeColors()
Initialize the terminal for color support by colorama.
- Return type:
- Returns:
True, if ‘colorama’ package could be imported and initialized.
- property Lines: List[Line]
Read-only property to access the list of printed lines (messages).
- Returns:
List of lines.
- NOT_IMPLEMENTED_EXCEPTION_EXIT_CODE: ClassVar[int] = 240
Return code, if unimplemented methods or code sections were called.
- PYTHON_VERSION_CHECK_FAILED_EXIT_CODE: ClassVar[int] = 254
Return code, if version check was not successful.
- PrintException(ex)
Prints an exception of type
Exceptionand its traceback.If the exception as a nested action, the cause is printed as well.
If
ISSUE_TRACKER_URLis configured, a URL to the issue tracker is added.
- PrintExceptionBase(ex)
Prints an exception of type
ExceptionBaseand its traceback.If the exception as a nested action, the cause is printed as well.
If
ISSUE_TRACKER_URLis configured, a URL to the issue tracker is added.
- PrintNotImplementedError(ex)
Prints a not-implemented exception of type
NotImplementedError.- Return type:
- Parameters:
ex (NotImplementedError)
- TryWriteLine(line)
Check if a line object of a certain severity would be written.
- Parameters:
line – Line object to check.
- Return type:
- Returns:
True, if line would be written.
- UNHANDLED_EXCEPTION_EXIT_CODE: ClassVar[int] = 241
Return code, if an unhandled exception reached the topmost exception handler.
- UninitializeColors()
Uninitialize the terminal for color support by colorama.
- Return type:
- Returns:
True, if ‘colorama’ package could be imported and uninitialized.
- property WarningCount: int
Read-only property to access the number of counted warnings.
- Returns:
Number of warnings.
- property Width: int
Read-only property to access the terminal’s width.
- Returns:
The terminal window’s width in characters.
- WriteCritical(message, *, indent=0, appendLinebreak=True)
Write a critical message.
Depending on internal settings and rules, a message might be skipped.
- WriteCriticalNote(message, *, indent=0, appendLinebreak=True)
Write a critical note.
Depending on internal settings and rules, a note might be skipped.
- WriteDebug(message, *, indent=0, appendLinebreak=True)
Write a debug message.
Depending on internal settings and rules, a message might be skipped.
- WriteDryRun(message, *, indent=0, appendLinebreak=True)
Write a dry-run message message.
Depending on internal settings and rules, a message might be skipped.
- WriteError(message, *, indent=0, appendLinebreak=True)
Write an error message.
Depending on internal settings and rules, a message might be skipped.
- WriteFatal(message, *, indent=0, appendLinebreak=True, exitCode=0, immediateExit=True)
Write a fatal message and exit.
Depending on internal settings and rules, a message might be skipped.
- Parameters:
message (
str) – Message to write.indent (
int) – Optional, indentation level of the message.appendLinebreak (
bool) – Optional, append a linebreak after the message. Default:TrueexitCode (
int) – Optional, exit application with this exit code. Default:0
If0, useFATAL_EXIT_CODEas exit code.immediateExit (
bool) – Optional, exit application immediately. Default:True
- Return type:
- Returns:
True, if message was actually written.
- WriteInfo(message, *, indent=0, appendLinebreak=True)
Write an info message.
Depending on internal settings and rules, a message might be skipped.
- WriteLine(line)
Print a formatted line to the underlying terminal/console offered by the operating system.
- WriteLineToStdErr(message, end='\\n')
Low-level method for writing to
STDERR.
- WriteLineToStdOut(message, end='\\n')
Low-level method for writing to
STDOUT.
- WriteNormal(message, *, indent=0, appendLinebreak=True)
Write a normal message.
Depending on internal settings and rules, a message might be skipped.
- WriteQuiet(message, *, indent=0, appendLinebreak=True)
Write an always visible message.
This message is even visible in quiet mode.
Depending on internal settings and rules, a message might be skipped.
- WriteToStdErr(message)
Low-level method for writing to
STDERR.
- WriteToStdOut(message)
Low-level method for writing to
STDOUT.
- WriteVerbose(message, *, indent=0, appendLinebreak=True)
Write a verbose message.
Depending on internal settings and rules, a message might be skipped.
- WriteWarning(message, *, indent=0, appendLinebreak=True)
Write a warning message.
Depending on internal settings and rules, a message might be skipped.
- WriteWarningNote(message, *, indent=0, appendLinebreak=True)
Write a warning note.
Depending on internal settings and rules, a note might be skipped.
- _LOG_MESSAGE_FORMAT__ = {Severity.Debug: '{DARK_GRAY}{message}{NOCOLOR}', Severity.Verbose: '{GRAY}{message}{NOCOLOR}', Severity.DryRun: '{DARK_CYAN}[DRY] {message}{NOCOLOR}', Severity.Normal: '{WHITE}{message}{NOCOLOR}', Severity.Info: '{WHITE}{message}{NOCOLOR}', Severity.WarningNote: '{DARK_YELLOW} > {message}{NOCOLOR}', Severity.Warning: '{YELLOW}[WARNING] {message}{NOCOLOR}', Severity.CriticalNote: '{DARK_YELLOW} > {message}{NOCOLOR}', Severity.Critical: '{DARK_YELLOW}[CRITICAL] {message}{NOCOLOR}', Severity.Quiet: '{WHITE}{message}{NOCOLOR}', Severity.Error: '{RED}[ERROR] {message}{NOCOLOR}', Severity.Fatal: '{DARK_RED}[FATAL] {message}{NOCOLOR}', Severity.ExceptionNote: '{DARK_RED} > {message}{NOCOLOR}', Severity.Exception: '{RED}[EXCEPTION] {message}{NOCOLOR}'}
Message formatting rules.
- _PrintHelp(command=None)
Helper function to print the command line parsers help page(s).
- _PrintVersion(dunderModule, packageName=None, versionCheckTimeout=1)
Helper method to print the version information.
- Parameters:
dunderModule (
ModuleType) – The Python module containing the dunder variables for author(s), email, copyright, version, …packageName (str | None)
versionCheckTimeout (int)
- Return type:
Example usage
def _PrintVersion(self): import myPackage.MyModule as DunderModule super()._PrintVersion( DunderModule, "MyModule" )
- __init__(mode=Mode.AllLinearToStdOut)
Initializer of a line-based terminal interface.
- Parameters:
mode (
Mode) – Defines what output (normal, error, data) to write where. Default: a linear flow all to STDOUT.- Return type:
None
- _stderr: TextIOWrapper
STDERR
- _stdin: TextIOWrapper
STDIN
- _stdout: TextIOWrapper
STDOUT
- class pyEDAA.Reports.CLI.Application[source]
Program class to implement the command line interface (CLI) using commands and options.
Inheritance
- ISSUE_TRACKER_URL: ClassVar[str] = 'https://github.com/edaa-org/pyEDAA.Reports/issues'
URL to the issue tracker for reporting bugs.
- __init__()[source]
Initializer of a line-based terminal interface.
- Parameters:
mode – Defines what output (normal, error, data) to write where. Default: a linear flow all to STDOUT.
- Return type:
None
- CheckPythonVersion(version)
Check if the used Python interpreter fulfills the minimum version requirements.
- property CriticalWarningCount: int
Read-only property to access the number of counted critical warnings.
- Returns:
Number of critical warnings.
- property ErrorCount: int
Read-only property to access the number of counted errors.
- Returns:
Number of errors.
- Exit(returnCode=0)
Exit the terminal application by uninitializing color support and returning an Exit code.
- ExitOnPreviousCriticalWarnings(includeErrors=True)
Exit application if error or critical warnings have been printed.
- ExitOnPreviousWarnings(includeCriticalWarnings=True, includeErrors=True)
Exit application if error or (critical) warnings have been printed.
- FatalExit(returnCode=0)
Exit the terminal application by uninitializing color support and returning a fatal Exit code.
- Foreground = {'BLUE': '\x1b[94m', 'CYAN': '\x1b[96m', 'DARK_BLUE': '\x1b[34m', 'DARK_CYAN': '\x1b[36m', 'DARK_GRAY': '\x1b[90m', 'DARK_GREEN': '\x1b[32m', 'DARK_RED': '\x1b[31m', 'DARK_YELLOW': '\x1b[33m', 'ERROR': '\x1b[91m', 'GRAY': '\x1b[37m', 'GREEN': '\x1b[92m', 'HEADLINE': '\x1b[95m', 'MAGENTA': '\x1b[95m', 'NOCOLOR': '\x1b[39m', 'RED': '\x1b[91m', 'WARNING': '\x1b[93m', 'WHITE': '\x1b[97m', 'YELLOW': '\x1b[93m'}
Terminal colors
- classmethod GetMethodsWithAttributes(predicate: TAttr | Iterable[TAttr] | None = None) Dict[Callable, Tuple[Attribute, ...]]
- static GetTerminalSize()
Returns the terminal size as tuple (width, height) for Windows, macOS (Darwin), Linux, cygwin (Windows), MinGW32/64 (Windows).
- HandleUnittest(args)
Handle program calls with command
unittest.
- property Height: int
Read-only property to access the terminal’s height.
- Returns:
The terminal window’s height in characters.
- InitializeColors()
Initialize the terminal for color support by colorama.
- Return type:
- Returns:
True, if ‘colorama’ package could be imported and initialized.
- property Lines: List[Line]
Read-only property to access the list of printed lines (messages).
- Returns:
List of lines.
- property MainParser: ArgumentParser
Returns the main parser.
- NOT_IMPLEMENTED_EXCEPTION_EXIT_CODE: ClassVar[int] = 240
Return code, if unimplemented methods or code sections were called.
- PYTHON_VERSION_CHECK_FAILED_EXIT_CODE: ClassVar[int] = 254
Return code, if version check was not successful.
- PrintException(ex)
Prints an exception of type
Exceptionand its traceback.If the exception as a nested action, the cause is printed as well.
If
ISSUE_TRACKER_URLis configured, a URL to the issue tracker is added.
- PrintExceptionBase(ex)
Prints an exception of type
ExceptionBaseand its traceback.If the exception as a nested action, the cause is printed as well.
If
ISSUE_TRACKER_URLis configured, a URL to the issue tracker is added.
- PrintNotImplementedError(ex)
Prints a not-implemented exception of type
NotImplementedError.- Return type:
- Parameters:
ex (NotImplementedError)
- property SubParsers: Dict[str, ArgumentParser]
Returns the sub-parsers.
- TryWriteLine(line)
Check if a line object of a certain severity would be written.
- Parameters:
line – Line object to check.
- Return type:
- Returns:
True, if line would be written.
- UNHANDLED_EXCEPTION_EXIT_CODE: ClassVar[int] = 241
Return code, if an unhandled exception reached the topmost exception handler.
- UninitializeColors()
Uninitialize the terminal for color support by colorama.
- Return type:
- Returns:
True, if ‘colorama’ package could be imported and uninitialized.
- property WarningCount: int
Read-only property to access the number of counted warnings.
- Returns:
Number of warnings.
- property Width: int
Read-only property to access the terminal’s width.
- Returns:
The terminal window’s width in characters.
- WriteCritical(message, *, indent=0, appendLinebreak=True)
Write a critical message.
Depending on internal settings and rules, a message might be skipped.
- WriteCriticalNote(message, *, indent=0, appendLinebreak=True)
Write a critical note.
Depending on internal settings and rules, a note might be skipped.
- WriteDebug(message, *, indent=0, appendLinebreak=True)
Write a debug message.
Depending on internal settings and rules, a message might be skipped.
- WriteDryRun(message, *, indent=0, appendLinebreak=True)
Write a dry-run message message.
Depending on internal settings and rules, a message might be skipped.
- WriteError(message, *, indent=0, appendLinebreak=True)
Write an error message.
Depending on internal settings and rules, a message might be skipped.
- WriteFatal(message, *, indent=0, appendLinebreak=True, exitCode=0, immediateExit=True)
Write a fatal message and exit.
Depending on internal settings and rules, a message might be skipped.
- Parameters:
message (
str) – Message to write.indent (
int) – Optional, indentation level of the message.appendLinebreak (
bool) – Optional, append a linebreak after the message. Default:TrueexitCode (
int) – Optional, exit application with this exit code. Default:0
If0, useFATAL_EXIT_CODEas exit code.immediateExit (
bool) – Optional, exit application immediately. Default:True
- Return type:
- Returns:
True, if message was actually written.
- WriteInfo(message, *, indent=0, appendLinebreak=True)
Write an info message.
Depending on internal settings and rules, a message might be skipped.
- WriteLine(line)
Print a formatted line to the underlying terminal/console offered by the operating system.
- WriteLineToStdErr(message, end='\\n')
Low-level method for writing to
STDERR.
- WriteLineToStdOut(message, end='\\n')
Low-level method for writing to
STDOUT.
- WriteNormal(message, *, indent=0, appendLinebreak=True)
Write a normal message.
Depending on internal settings and rules, a message might be skipped.
- WriteQuiet(message, *, indent=0, appendLinebreak=True)
Write an always visible message.
This message is even visible in quiet mode.
Depending on internal settings and rules, a message might be skipped.
- WriteToStdErr(message)
Low-level method for writing to
STDERR.
- WriteToStdOut(message)
Low-level method for writing to
STDOUT.
- WriteVerbose(message, *, indent=0, appendLinebreak=True)
Write a verbose message.
Depending on internal settings and rules, a message might be skipped.
- WriteWarning(message, *, indent=0, appendLinebreak=True)
Write a warning message.
Depending on internal settings and rules, a message might be skipped.
- WriteWarningNote(message, *, indent=0, appendLinebreak=True)
Write a warning note.
Depending on internal settings and rules, a note might be skipped.
- _LOG_MESSAGE_FORMAT__ = {Severity.Debug: '{DARK_GRAY}{message}{NOCOLOR}', Severity.Verbose: '{GRAY}{message}{NOCOLOR}', Severity.DryRun: '{DARK_CYAN}[DRY] {message}{NOCOLOR}', Severity.Normal: '{WHITE}{message}{NOCOLOR}', Severity.Info: '{WHITE}{message}{NOCOLOR}', Severity.WarningNote: '{DARK_YELLOW} > {message}{NOCOLOR}', Severity.Warning: '{YELLOW}[WARNING] {message}{NOCOLOR}', Severity.CriticalNote: '{DARK_YELLOW} > {message}{NOCOLOR}', Severity.Critical: '{DARK_YELLOW}[CRITICAL] {message}{NOCOLOR}', Severity.Quiet: '{WHITE}{message}{NOCOLOR}', Severity.Error: '{RED}[ERROR] {message}{NOCOLOR}', Severity.Fatal: '{DARK_RED}[FATAL] {message}{NOCOLOR}', Severity.ExceptionNote: '{DARK_RED} > {message}{NOCOLOR}', Severity.Exception: '{RED}[EXCEPTION] {message}{NOCOLOR}'}
Message formatting rules.
- _stderr: TextIOWrapper
STDERR
- _stdin: TextIOWrapper
STDIN
- _stdout: TextIOWrapper
STDOUT