swh.scanner.output module#

class swh.scanner.output.Color(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#

Bases: Enum

BLUE = '\x1b[94m'#
GREEN = '\x1b[92m'#
RED = '\x1b[91m'#
END = '\x1b[0m'#
swh.scanner.output.colorize(text: str, color: Color)[source]#
swh.scanner.output.get_output_class(mode='text')[source]#

return the output class that correspond to mode

class swh.scanner.output.BaseOutput(root_path: str, nodes_data: MerkleNodeInfo, source_tree: Directory)[source]#

Bases: ABC

base class for object able to display scan result

get_path_name(node)[source]#
abstract show()[source]#
class swh.scanner.output.SummaryOuput(root_path: str, nodes_data: MerkleNodeInfo, source_tree: Directory)[source]#

Bases: BaseOutput

display a summary of the scan results

show()[source]#
class swh.scanner.output.TextOuput(root_path: str, nodes_data: MerkleNodeInfo, source_tree: Directory)[source]#

Bases: BaseOutput

display an exhaustive result of the scan in text form

note: as soon as the scan target something larger than a toy project, the usability of this mode is poor.

show() None[source]#
print_node(node: Any, isatty: bool, level: int) None[source]#
class swh.scanner.output.JsonOuput(root_path: str, nodes_data: MerkleNodeInfo, source_tree: Directory)[source]#

Bases: BaseOutput

display the scan result in json

data_as_json()[source]#
show()[source]#
class swh.scanner.output.NDJsonTextOuput(root_path: str, nodes_data: MerkleNodeInfo, source_tree: Directory)[source]#

Bases: JsonOuput

display the scan result in newline-delimited json

show()[source]#
class swh.scanner.output.SunburstOuput(root_path: str, nodes_data: MerkleNodeInfo, source_tree: Directory)[source]#

Bases: BaseOutput

display the scan result as a sunburst plot

note: as soon as the scan target something larger than a toy project, the usability of this mode is poor.

show()[source]#
class swh.scanner.output.InteractiveSunburstOuput(root_path: str, nodes_data: MerkleNodeInfo, source_tree: Directory)[source]#

Bases: SunburstOuput

display the scan result as an interactive sunburst plot

show()[source]#