coalib.results.result_actions package

Submodules

coalib.results.result_actions.ApplyPatchAction module

class coalib.results.result_actions.ApplyPatchAction.ApplyPatchAction

Bases: coalib.results.result_actions.ResultAction.ResultAction

apply(result, original_file_dict, file_diff_dict, no_orig: bool=False)

Apply the patch automatically.

Parameters:no_orig – Wether or not to create .orig backup files
static is_applicable(result, original_file_dict, file_diff_dict)
success_message = 'Patch applied successfully.'

coalib.results.result_actions.OpenEditorAction module

class coalib.results.result_actions.OpenEditorAction.OpenEditorAction

Bases: coalib.results.result_actions.ApplyPatchAction.ApplyPatchAction

apply(result, original_file_dict, file_diff_dict, editor: str)

Open the affected file(s) in an editor.

Parameters:editor – The editor to open the file with.
static is_applicable(result, original_file_dict, file_diff_dict)
success_message = 'Changes saved successfully.'

coalib.results.result_actions.PrintDebugMessageAction module

class coalib.results.result_actions.PrintDebugMessageAction.PrintDebugMessageAction

Bases: coalib.results.result_actions.ResultAction.ResultAction

apply(result, original_file_dict, file_diff_dict)

Print the debug message of the result.

static is_applicable(result, original_file_dict, file_diff_dict)

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

Bases: object

apply(result, original_file_dict, file_diff_dict, **kwargs)

This action has no description although it should. Probably something went wrong.

apply_from_section(*args, **kwargs)
classmethod get_metadata()

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)

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.
success_message = 'The action was executed successfully.'

coalib.results.result_actions.ShowPatchAction module

class coalib.results.result_actions.ShowPatchAction.ShowPatchAction

Bases: coalib.results.result_actions.ResultAction.ResultAction

apply(result, original_file_dict, file_diff_dict, colored: bool=True)

Print a diff of the patch that would be applied.

Parameters:colored – Wether or not to use colored output.
static is_applicable(result, original_file_dict, file_diff_dict)
success_message = 'Displayed patch successfully.'
coalib.results.result_actions.ShowPatchAction.format_line(line, real_nr='', sign='|', mod_nr='', symbol='')
coalib.results.result_actions.ShowPatchAction.print_beautified_diff(difflines, printer)

Module contents

The result_actions package holds objects deriving from ResultAction. A ResultAction represents an action that an be applied to a result.