mythx_cli.formatter package¶
mythx_cli.formatter.base¶
This module contains the base formatter interface.
-
class
mythx_cli.formatter.base.
BaseFormatter
[source]¶ Bases:
abc.ABC
The base formatter interface for printing various response types.
-
static
format_analysis_list
(obj: mythx_models.response.analysis_list.AnalysisListResponse)[source]¶ Format an analysis list response.
-
static
format_analysis_status
(resp: mythx_models.response.analysis_status.AnalysisStatusResponse) → str[source]¶ Format an analysis status response.
-
static
format_detected_issues
(issues_list: List[Tuple[mythx_models.response.detected_issues.DetectedIssuesResponse, Optional[mythx_models.response.analysis_input.AnalysisInputResponse]]])[source]¶ Format an issue report response.
-
static
format_version
(obj: mythx_models.response.version.VersionResponse)[source]¶ Format a version response.
-
report_requires_input
= False¶
-
static
mythx_cli.formatter.json¶
This module contains the compressed and pretty-printing JSON formatters.
-
class
mythx_cli.formatter.json.
JSONFormatter
[source]¶ Bases:
mythx_cli.formatter.base.BaseFormatter
-
static
format_analysis_list
(resp: mythx_models.response.analysis_list.AnalysisListResponse) → str[source]¶ Format an analysis list response as compressed JSON.
-
static
format_analysis_status
(resp: mythx_models.response.analysis_status.AnalysisStatusResponse) → str[source]¶ Format an analysis status response as compressed JSON.
-
static
format_detected_issues
(issues_list: List[Tuple[mythx_models.response.detected_issues.DetectedIssuesResponse, Optional[mythx_models.response.analysis_input.AnalysisInputResponse]]]) → str[source]¶ Format an issue report response as compressed JSON.
-
static
format_group_list
(resp: mythx_models.response.group_list.GroupListResponse)[source]¶ Format a group list response as compressed JSON.
-
static
format_group_status
(resp: mythx_models.response.group_status.GroupStatusResponse)[source]¶ Format a group status response as compressed JSON.
-
static
format_version
(resp: mythx_models.response.version.VersionResponse) → str[source]¶ Format a version response as compressed JSON.
-
report_requires_input
= False¶
-
static
-
class
mythx_cli.formatter.json.
PrettyJSONFormatter
[source]¶ Bases:
mythx_cli.formatter.base.BaseFormatter
-
static
format_analysis_list
(obj: mythx_models.response.analysis_list.AnalysisListResponse) → str[source]¶ Format an analysis list response as pretty-printed JSON.
-
static
format_analysis_status
(obj: mythx_models.response.analysis_status.AnalysisStatusResponse) → str[source]¶ Format an analysis status response as pretty-printed JSON.
-
static
format_detected_issues
(issues_list: List[Tuple[mythx_models.response.detected_issues.DetectedIssuesResponse, Optional[mythx_models.response.analysis_input.AnalysisInputResponse]]])[source]¶ Format an issue report response as pretty-printed JSON.
-
static
format_group_list
(resp: mythx_models.response.group_list.GroupListResponse)[source]¶ Format a group list response as pretty-printed JSON.
-
static
format_group_status
(resp: mythx_models.response.group_status.GroupStatusResponse)[source]¶ Format a group status response as pretty-printed JSON.
-
static
format_version
(obj: mythx_models.response.version.VersionResponse)[source]¶ Format a version response as pretty-printed JSON.
-
report_requires_input
= False¶
-
static
mythx_cli.formatter.simple_stdout¶
This module contains a simple text formatter class printing a subset of the response data.
-
class
mythx_cli.formatter.simple_stdout.
SimpleFormatter
[source]¶ Bases:
mythx_cli.formatter.base.BaseFormatter
-
static
format_analysis_list
(resp: mythx_models.response.analysis_list.AnalysisListResponse) → str[source]¶ Format an analysis list response to a simple text representation.
-
static
format_analysis_status
(resp: mythx_models.response.analysis_status.AnalysisStatusResponse) → str[source]¶ Format an analysis status response to a simple text representation.
-
static
format_detected_issues
(issues_list: List[Tuple[mythx_models.response.detected_issues.DetectedIssuesResponse, Optional[mythx_models.response.analysis_input.AnalysisInputResponse]]]) → str[source]¶ Format an issue report to a simple text representation.
-
static
format_group_list
(resp: mythx_models.response.group_list.GroupListResponse)[source]¶ Format an analysis group response to a simple text representation.
-
static
format_group_status
(resp: mythx_models.response.group_status.GroupStatusResponse)[source]¶ Format a group status response to a simple text representation.
-
static
format_version
(resp: mythx_models.response.version.VersionResponse) → str[source]¶ Format a version response to a simple text representation.
-
report_requires_input
= True¶
-
static
mythx_cli.formatter.tabular¶
This module contains a tabular data formatter class printing a subset of the response data.
-
class
mythx_cli.formatter.tabular.
TabularFormatter
[source]¶ Bases:
mythx_cli.formatter.base.BaseFormatter
-
static
format_analysis_list
(resp: mythx_models.response.analysis_list.AnalysisListResponse) → str[source]¶ Format an analysis list response to a tabular representation.
-
static
format_analysis_status
(resp: mythx_models.response.analysis_status.AnalysisStatusResponse) → str[source]¶ Format an analysis status response to a tabular representation.
-
static
format_detected_issues
(issues_list: List[Tuple[mythx_models.response.detected_issues.DetectedIssuesResponse, Optional[mythx_models.response.analysis_input.AnalysisInputResponse]]]) → str[source]¶ Format an issue report to a tabular representation.
-
static
format_group_list
(resp: mythx_models.response.group_list.GroupListResponse)[source]¶ Format an analysis group response to a tabular representation.
-
static
format_group_status
(resp: mythx_models.response.group_status.GroupStatusResponse)[source]¶ Format a group status response to a tabular representation.
-
static
format_version
(resp: mythx_models.response.version.VersionResponse) → str[source]¶ Format a version response to a tabular representation.
-
report_requires_input
= True¶
-
static
mythx_cli.formatter.util¶
Utility functions for handling API requests and responses.
-
mythx_cli.formatter.util.
filter_report
(resp: mythx_models.response.detected_issues.DetectedIssuesResponse, min_severity: str = None, swc_blacklist: Union[str, List[str]] = None, swc_whitelist: Union[str, List[str]] = None) → mythx_models.response.detected_issues.DetectedIssuesResponse[source]¶ Filter issues based on an SWC blacklist and minimum severity.
This will remove issues of a specific SWC ID or with a too low severity from the issue reports of the passed
DetectedIssuesResponse
object. The SWC blacklist can be a list of strings in the format “SWC-000” or a comma-separated string. “SWC” is case-insensitive and normalized. The SWC whitelist works in a similar way, just including selected SWCs into the resulting response object.
-
mythx_cli.formatter.util.
get_source_location_by_offset
(source, offset)[source]¶ Retrieve the Solidity source code location based on the source map offset.
Parameters: - source – The Solidity source to analyze
- offset – The source map’s offset
Returns: The line number