cosmic_ray.tools.filters package

Submodules

cosmic_ray.tools.filters.filter_app module

A simple base for creating common types of work-db filters.

class cosmic_ray.tools.filters.filter_app.FilterApp

Bases: object

Base class for simple WorkDB filters.

This provides command-line handling for common filter options like the session and verbosity level. Subclasses can add their own arguments as well. This provides a main() function that open the session’s WorkDB and passes it to the subclass’s filter() function.

It is by no means required that you inherit from or otherwise use this class in order to build a filter. You can build a filter using any technique you want. Typically all a filter does is modify a session database in some way, so you can use the Cosmic Ray API for that directly if you want.

add_args(parser: ArgumentParser)

Add any arguments that the subclass needs to the parser.

Parameters:

parser – The ArgumentParser for command-line processing.

description()

The description of the filter.

This is used for the command-line help message.

filter(work_db, args)

Apply this filter to a WorkDB.

This should modify the WorkDB in place.

Parameters:
  • work_db – An open WorkDB instance.

  • args – The argparse Namespace for the command line.

main(argv=None)

The main function for the app.

Parameters:

argv – Command line argument list of parse.

cosmic_ray.tools.filters.git module

A filter that uses git to determine when specific files/lines should be skipped.

class cosmic_ray.tools.filters.git.GitFilter

Bases: FilterApp

Implements the git filter.

add_args(parser)

Add any arguments that the subclass needs to the parser.

Parameters:

parser – The ArgumentParser for command-line processing.

description()

The description of the filter.

This is used for the command-line help message.

filter(work_db: WorkDB, args: Namespace)

Mark as skipped all work item that is not new

cosmic_ray.tools.filters.git.main(argv=None)

Run the operators-filter with the specified command line arguments.

cosmic_ray.tools.filters.operators_filter module

An filter that removes operators based on regular expressions.

class cosmic_ray.tools.filters.operators_filter.OperatorsFilter

Bases: FilterApp

Implemenents the operators-filter.

add_args(parser: ArgumentParser)

Add any arguments that the subclass needs to the parser.

Parameters:

parser – The ArgumentParser for command-line processing.

description()

The description of the filter.

This is used for the command-line help message.

filter(work_db: WorkDB, args: Namespace)

Mark as skipped all work item with filtered operator

cosmic_ray.tools.filters.operators_filter.main(argv=None)

Run the operators-filter with the specified command line arguments.

cosmic_ray.tools.filters.pragma_no_mutate module

A filter that uses “# pragma: no mutate” to determine when specific mutations should be skipped.

class cosmic_ray.tools.filters.pragma_no_mutate.PragmaNoMutateFilter

Bases: FilterApp

Implements the pragma-no-mutate filter.

description()

The description of the filter.

This is used for the command-line help message.

filter(work_db, _args)

Mark lines with “# pragma: no mutate” as SKIPPED

For all work_item in db, if the LAST line of the working zone is marked with “# pragma: no mutate”, This work_item will be skipped.

cosmic_ray.tools.filters.pragma_no_mutate.main(argv=None)

Run pragma-no-mutate filter with specified command line arguments.

Module contents