_docsweeper.result_handler#
Result handlers for docstring analysis results.
Provides result handlers that write the results of a token analysis into some output stream, like stdout.
- class _docsweeper.result_handler.AbstractResultHandler#
Bases:
ABCResult handler that is agnostic as to how the handled entries are formatted.
Subclasses must implement
_format_result()so that entries are formatted, or inherit from a class that already provides such a formatter.Output streams can be added to the result handler by calling
add_stream().- __init__()#
Instantiate the result handler.
- Return type
None
- abstract _format_result(file_name, token, history)#
Format the analysis data.
- Parameters
file_name (str) – path of the file that was analyzed
token (DocumentedToken) – the token
history (DocumentedTokenStatistic) – the analysis results that belong to token
- Return type
- add_stream(stream)#
Append stream to the streams that this result handler outputs to.
- Parameters
stream (TextIO) – the stream
- Return type
None
- handle_result(file_name, token, history)#
Pass the result of the token analysis to the underlying output stream.
Performs the necessary formatting of input variables and writes the result entry to and output stream.
- Parameters
file_name (str) – path of the file that was analyzed
token (DocumentedToken) – the token
history (DocumentedTokenStatistic) – the analysis results that belong to token
- Return type
None
- class _docsweeper.result_handler.HumanReadableStringResultHandler#
Bases:
AbstractResultHandlerFormats values in relatively verbose human-readable strings.
Suited for output in a console terminal.
- class _docsweeper.result_handler.ClickResultHandler#
Bases:
HumanReadableStringResultHandlerHandle results using
click.echo().- add_stream(stream)#
Not implemented for this result handler.
- Parameters
stream (TextIO) – the stream to be added
- Raises
NotImplementedError – when called
- Return type
None
- handle_result(file_name, token, history)#
Write result to standard output using
click.echo().- Parameters
file_name (str) –
token (DocumentedToken) –
history (DocumentedTokenStatistic) –
- Return type
None
- class _docsweeper.result_handler.StdOutResultHandler#
Bases:
HumanReadableStringResultHandlerA result handler that outputs to standard output.
- __init__()#
Instantiate the result handler.
Adds the standard output stream to its output stream.
- Return type
None