coalib.results.result_actions package¶
Submodules¶
coalib.results.result_actions.ApplyPatchAction module¶
-
class
coalib.results.result_actions.ApplyPatchAction.
ApplyPatchAction
[source]¶ Bases:
coalib.results.result_actions.ResultAction.ResultAction
-
SUCCESS_MESSAGE
= 'Patch applied successfully.'¶
-
apply
(result, original_file_dict, file_diff_dict, no_orig: bool = False)[source]¶ Apply patch
Parameters: no_orig – Whether or not to create .orig backup files
-
static
is_applicable
(result, original_file_dict, file_diff_dict)¶
-
coalib.results.result_actions.IgnoreResultAction module¶
-
class
coalib.results.result_actions.IgnoreResultAction.
IgnoreResultAction
[source]¶ Bases:
coalib.results.result_actions.ResultAction.ResultAction
-
SUCCESS_MESSAGE
= 'An ignore comment was added to your source code.'¶
-
coalib.results.result_actions.OpenEditorAction module¶
-
class
coalib.results.result_actions.OpenEditorAction.
OpenEditorAction
[source]¶ Bases:
coalib.results.result_actions.ResultAction.ResultAction
-
SUCCESS_MESSAGE
= 'Changes saved successfully.'¶
-
coalib.results.result_actions.PrintDebugMessageAction module¶
-
class
coalib.results.result_actions.PrintDebugMessageAction.
PrintDebugMessageAction
[source]¶ Bases:
coalib.results.result_actions.ResultAction.ResultAction
coalib.results.result_actions.PrintMoreInfoAction module¶
coalib.results.result_actions.ResultAction module¶
A ResultAction is an action that is applicable to at least some results. This file serves the base class for all result actions, thus providing a unified interface for all actions.
-
class
coalib.results.result_actions.ResultAction.
ResultAction
[source]¶ Bases:
object
-
SUCCESS_MESSAGE
= 'The action was executed successfully.'¶
-
apply
(result, original_file_dict, file_diff_dict, **kwargs)[source]¶ No description. Something went wrong.
-
apply_from_section
(result, original_file_dict: dict, file_diff_dict: dict, section: coalib.settings.Section.Section)[source]¶ Applies this action to the given results with all additional options given as a section. The file dictionaries are needed for differential results.
Parameters: - result – The result to apply.
- original_file_dict – A dictionary containing the files in the state where the result was generated.
- file_diff_dict – A dictionary containing a diff for every file from the state in the original_file_dict to the current state. This dict will be altered so you do not need to use the return value.
- section – The section where to retrieve the additional information.
Returns: The modified file_diff_dict.
-
classmethod
get_metadata
()[source]¶ Retrieves metadata for the apply function. The description may be used to advertise this action to the user. The parameters and their help texts are additional information that are needed from the user. You can create a section out of the inputs from the user and use apply_from_section to apply
:return A FunctionMetadata object.
-
static
is_applicable
(result, original_file_dict, file_diff_dict)[source]¶ Checks whether the Action is valid for the result type.
Returns
True
by default.Parameters: - result – The result from the coala run to check if an Action is applicable.
- original_file_dict – A dictionary containing the files in the state where the result was generated.
- file_diff_dict – A dictionary containing a diff for every file from the state in the original_file_dict to the current state. This dict will be altered so you do not need to use the return value.
-
coalib.results.result_actions.ShowPatchAction module¶
-
class
coalib.results.result_actions.ShowPatchAction.
ShowPatchAction
[source]¶ Bases:
coalib.results.result_actions.ResultAction.ResultAction
-
SUCCESS_MESSAGE
= 'Displayed patch successfully.'¶
-
Module contents¶
The result_actions package holds objects deriving from ResultAction. A ResultAction represents an action that an be applied to a result.