thoth.analyzer package

Submodules

thoth.analyzer.cli module

Base command line helpers for analyzers.

thoth.analyzer.cli.print_command_result(click_ctx: click.core.Command, result: Union[dict, list], analyzer: str, analyzer_version: str, output: str = None, duration: float = None, pretty: bool = True, dry_run: bool = False) → None[source]

Print or submit results, nicely if requested.

thoth.analyzer.command module

Handling invoking commands of external programs in a sane way.

exception thoth.analyzer.command.CommandError(*args, command: delegator.Command, **command_result_kwargs)[source]

Bases: RuntimeError, thoth.analyzer.command.CommandResult

Exception raised on error when calling commands.

Note that this class inherits also from CommandResult, so you can directly access to_dict() or other defined methods.

property stdout

Standard output from invocation.

Override implementation for errors, not all tools product JSON or errors so try to avoid parsing JSON implicitly.

class thoth.analyzer.command.CommandResult(command: delegator.Command, is_json: bool = False)[source]

Bases: object

Representation of result of a command invocation.

property return_code

Process return code.

property stderr

Standard error output from invocation.

property stdout

Standard output from invocation.

property timeout

Timeout that was given to the invoked process to finish.

to_dict()[source]

Represent command result as a dict.

thoth.analyzer.command.run_command(cmd, timeout=60, is_json=False, env=None, raise_on_error=True)[source]

Run the given command, block until it finishes.

Module contents

Shared code logic in Thoth analyzers.