cosmic_ray.operators package

Submodules

cosmic_ray.operators.binary_operator_replacement module

Implementation of the binary-operator-replacement operator.

class cosmic_ray.operators.binary_operator_replacement.BinaryOperators(*values)

Bases: Enum

All binary operators that we mutate.

Add = '+'
BitAnd = '&'
BitOr = '|'
BitXor = '^'
Div = '/'
FloorDiv = '//'
LShift = '<<'
Mod = '%'
Mul = '*'
Pow = '**'
RShift = '>>'
Sub = '-'
class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_Add_BitAnd

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_Add_BitOr

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_Add_BitXor

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_Add_Div

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_Add_FloorDiv

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_Add_LShift

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_Add_Mod

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_Add_Mul

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_Add_Pow

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_Add_RShift

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_Add_Sub

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_BitAnd_Add

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_BitAnd_BitOr

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_BitAnd_BitXor

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_BitAnd_Div

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_BitAnd_FloorDiv

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_BitAnd_LShift

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_BitAnd_Mod

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_BitAnd_Mul

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_BitAnd_Pow

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_BitAnd_RShift

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_BitAnd_Sub

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_BitOr_Add

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_BitOr_BitAnd

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_BitOr_BitXor

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_BitOr_Div

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_BitOr_FloorDiv

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_BitOr_LShift

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_BitOr_Mod

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_BitOr_Mul

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_BitOr_Pow

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_BitOr_RShift

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_BitOr_Sub

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_BitXor_Add

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_BitXor_BitAnd

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_BitXor_BitOr

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_BitXor_Div

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_BitXor_FloorDiv

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_BitXor_LShift

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_BitXor_Mod

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_BitXor_Mul

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_BitXor_Pow

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_BitXor_RShift

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_BitXor_Sub

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_Div_Add

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_Div_BitAnd

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_Div_BitOr

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_Div_BitXor

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_Div_FloorDiv

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_Div_LShift

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_Div_Mod

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_Div_Mul

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_Div_Pow

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_Div_RShift

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_Div_Sub

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_FloorDiv_Add

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_FloorDiv_BitAnd

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_FloorDiv_BitOr

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_FloorDiv_BitXor

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_FloorDiv_Div

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_FloorDiv_LShift

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_FloorDiv_Mod

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_FloorDiv_Mul

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_FloorDiv_Pow

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_FloorDiv_RShift

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_FloorDiv_Sub

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_LShift_Add

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_LShift_BitAnd

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_LShift_BitOr

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_LShift_BitXor

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_LShift_Div

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_LShift_FloorDiv

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_LShift_Mod

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_LShift_Mul

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_LShift_Pow

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_LShift_RShift

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_LShift_Sub

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_Mod_Add

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_Mod_BitAnd

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_Mod_BitOr

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_Mod_BitXor

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_Mod_Div

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_Mod_FloorDiv

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_Mod_LShift

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_Mod_Mul

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_Mod_Pow

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_Mod_RShift

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_Mod_Sub

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_Mul_Add

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_Mul_BitAnd

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_Mul_BitOr

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_Mul_BitXor

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_Mul_Div

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_Mul_FloorDiv

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_Mul_LShift

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_Mul_Mod

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_Mul_Pow

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_Mul_RShift

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_Mul_Sub

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_Pow_Add

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_Pow_BitAnd

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_Pow_BitOr

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_Pow_BitXor

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_Pow_Div

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_Pow_FloorDiv

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_Pow_LShift

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_Pow_Mod

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_Pow_Mul

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_Pow_RShift

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_Pow_Sub

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_RShift_Add

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_RShift_BitAnd

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_RShift_BitOr

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_RShift_BitXor

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_RShift_Div

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_RShift_FloorDiv

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_RShift_LShift

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_RShift_Mod

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_RShift_Mul

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_RShift_Pow

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_RShift_Sub

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_Sub_Add

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_Sub_BitAnd

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_Sub_BitOr

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_Sub_BitXor

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_Sub_Div

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_Sub_FloorDiv

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_Sub_LShift

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_Sub_Mod

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_Sub_Mul

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_Sub_Pow

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.binary_operator_replacement.ReplaceBinaryOperator_Sub_RShift

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

cosmic_ray.operators.binary_operator_replacement.op_cls

alias of ReplaceBinaryOperator

cosmic_ray.operators.binary_operator_replacement.operators()

Iterable of all binary operator replacement mutation operators.

cosmic_ray.operators.boolean_replacer module

Implementation of the boolean replacement operators.

class cosmic_ray.operators.boolean_replacer.AddNot

Bases: Operator

An operator that adds the ‘not’ keyword to boolean expressions.

NOTE: ‘not’ as unary operator is mutated in

unary_operator_replacement.py, including deletion of the same operator.

NODE_TYPES = (<class 'parso.python.tree.IfStmt'>, <class 'parso.python.tree.WhileStmt'>, <class 'parso.python.tree.AssertStmt'>)
classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.boolean_replacer.ReplaceAndWithOr

Bases: KeywordReplacementOperator

An operator that swaps ‘and’ with ‘or’.

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

from_keyword = 'and'
to_keyword = 'or'
class cosmic_ray.operators.boolean_replacer.ReplaceFalseWithTrue

Bases: KeywordReplacementOperator

An that replaces False with True.

from_keyword = 'False'
to_keyword = 'True'
class cosmic_ray.operators.boolean_replacer.ReplaceOrWithAnd

Bases: KeywordReplacementOperator

An operator that swaps ‘or’ with ‘and’.

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

from_keyword = 'or'
to_keyword = 'and'
class cosmic_ray.operators.boolean_replacer.ReplaceTrueWithFalse

Bases: KeywordReplacementOperator

An that replaces True with False.

from_keyword = 'True'
to_keyword = 'False'

cosmic_ray.operators.break_continue module

Implementation of the replace-break-with-continue and replace-continue-with-break operators.

class cosmic_ray.operators.break_continue.ReplaceBreakWithContinue

Bases: KeywordReplacementOperator

Operator which replaces ‘break’ with ‘continue’.

from_keyword = 'break'
to_keyword = 'continue'
class cosmic_ray.operators.break_continue.ReplaceContinueWithBreak

Bases: KeywordReplacementOperator

Operator which replaces ‘continue’ with ‘break’.

from_keyword = 'continue'
to_keyword = 'break'

cosmic_ray.operators.comparison_operator_replacement module

This module contains mutation operators which replace one comparison operator with another.

class cosmic_ray.operators.comparison_operator_replacement.ComparisonOperators(*values)

Bases: Enum

All comparison operators that we mutate.

Eq = '=='
Gt = '>'
GtE = '>='
Is = 'is'
IsNot = 'is not'
Lt = '<'
LtE = '<='
NotEq = '!='
class cosmic_ray.operators.comparison_operator_replacement.ReplaceComparisonOperator_Eq_Gt

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.comparison_operator_replacement.ReplaceComparisonOperator_Eq_GtE

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.comparison_operator_replacement.ReplaceComparisonOperator_Eq_Is

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.comparison_operator_replacement.ReplaceComparisonOperator_Eq_IsNot

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.comparison_operator_replacement.ReplaceComparisonOperator_Eq_Lt

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.comparison_operator_replacement.ReplaceComparisonOperator_Eq_LtE

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.comparison_operator_replacement.ReplaceComparisonOperator_Eq_NotEq

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.comparison_operator_replacement.ReplaceComparisonOperator_GtE_Eq

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.comparison_operator_replacement.ReplaceComparisonOperator_GtE_Gt

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.comparison_operator_replacement.ReplaceComparisonOperator_GtE_Is

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.comparison_operator_replacement.ReplaceComparisonOperator_GtE_IsNot

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.comparison_operator_replacement.ReplaceComparisonOperator_GtE_Lt

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.comparison_operator_replacement.ReplaceComparisonOperator_GtE_LtE

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.comparison_operator_replacement.ReplaceComparisonOperator_GtE_NotEq

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.comparison_operator_replacement.ReplaceComparisonOperator_Gt_Eq

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.comparison_operator_replacement.ReplaceComparisonOperator_Gt_GtE

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.comparison_operator_replacement.ReplaceComparisonOperator_Gt_Is

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.comparison_operator_replacement.ReplaceComparisonOperator_Gt_IsNot

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.comparison_operator_replacement.ReplaceComparisonOperator_Gt_Lt

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.comparison_operator_replacement.ReplaceComparisonOperator_Gt_LtE

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.comparison_operator_replacement.ReplaceComparisonOperator_Gt_NotEq

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.comparison_operator_replacement.ReplaceComparisonOperator_IsNot_Eq

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.comparison_operator_replacement.ReplaceComparisonOperator_IsNot_Gt

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.comparison_operator_replacement.ReplaceComparisonOperator_IsNot_GtE

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.comparison_operator_replacement.ReplaceComparisonOperator_IsNot_Is

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.comparison_operator_replacement.ReplaceComparisonOperator_IsNot_Lt

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.comparison_operator_replacement.ReplaceComparisonOperator_IsNot_LtE

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.comparison_operator_replacement.ReplaceComparisonOperator_IsNot_NotEq

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.comparison_operator_replacement.ReplaceComparisonOperator_Is_Eq

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.comparison_operator_replacement.ReplaceComparisonOperator_Is_Gt

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.comparison_operator_replacement.ReplaceComparisonOperator_Is_GtE

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.comparison_operator_replacement.ReplaceComparisonOperator_Is_IsNot

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.comparison_operator_replacement.ReplaceComparisonOperator_Is_Lt

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.comparison_operator_replacement.ReplaceComparisonOperator_Is_LtE

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.comparison_operator_replacement.ReplaceComparisonOperator_Is_NotEq

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.comparison_operator_replacement.ReplaceComparisonOperator_LtE_Eq

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.comparison_operator_replacement.ReplaceComparisonOperator_LtE_Gt

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.comparison_operator_replacement.ReplaceComparisonOperator_LtE_GtE

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.comparison_operator_replacement.ReplaceComparisonOperator_LtE_Is

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.comparison_operator_replacement.ReplaceComparisonOperator_LtE_IsNot

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.comparison_operator_replacement.ReplaceComparisonOperator_LtE_Lt

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.comparison_operator_replacement.ReplaceComparisonOperator_LtE_NotEq

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.comparison_operator_replacement.ReplaceComparisonOperator_Lt_Eq

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.comparison_operator_replacement.ReplaceComparisonOperator_Lt_Gt

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.comparison_operator_replacement.ReplaceComparisonOperator_Lt_GtE

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.comparison_operator_replacement.ReplaceComparisonOperator_Lt_Is

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.comparison_operator_replacement.ReplaceComparisonOperator_Lt_IsNot

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.comparison_operator_replacement.ReplaceComparisonOperator_Lt_LtE

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.comparison_operator_replacement.ReplaceComparisonOperator_Lt_NotEq

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.comparison_operator_replacement.ReplaceComparisonOperator_NotEq_Eq

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.comparison_operator_replacement.ReplaceComparisonOperator_NotEq_Gt

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.comparison_operator_replacement.ReplaceComparisonOperator_NotEq_GtE

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.comparison_operator_replacement.ReplaceComparisonOperator_NotEq_Is

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.comparison_operator_replacement.ReplaceComparisonOperator_NotEq_IsNot

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.comparison_operator_replacement.ReplaceComparisonOperator_NotEq_Lt

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.comparison_operator_replacement.ReplaceComparisonOperator_NotEq_LtE

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

cosmic_ray.operators.comparison_operator_replacement.op_cls

alias of ReplaceComparisonOperator

cosmic_ray.operators.comparison_operator_replacement.operators()

Iterable of all binary operator replacement mutation operators.

cosmic_ray.operators.exception_replacer module

Implementation of the exception-replacement operator.

class cosmic_ray.operators.exception_replacer.ExceptionReplacer

Bases: Operator

An operator that modifies exception handlers.

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

cosmic_ray.operators.keyword_replacer module

Common implementation for operators that replace keywords.

class cosmic_ray.operators.keyword_replacer.KeywordReplacementOperator

Bases: Operator

A base class for operators that replace one keyword with another

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

cosmic_ray.operators.no_op module

Implementation of the no-op operator.

class cosmic_ray.operators.no_op.NoOp

Bases: Operator

An operator that makes no changes.

This is primarily for baselining and debugging. It behaves like any other operator, but it makes no changes. Obviously this means that, if your test suite passes on unmutated code, it will still pass after applying this operator. Use with care.

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

cosmic_ray.operators.number_replacer module

Implementation of the NumberReplacer operator.

class cosmic_ray.operators.number_replacer.NumberReplacer

Bases: Operator

An operator that modifies numeric constants.

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Modify the numeric value on node.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

cosmic_ray.operators.operator module

Implementation of operator base class.

class cosmic_ray.operators.operator.Argument(name: str, description: str)

Bases: object

description: str
name: str
class cosmic_ray.operators.operator.Example(pre_mutation_code: str, post_mutation_code: str, occurrence: int | None = 0, operator_args: dict | None = None)

Bases: object

A structure to store pre and post mutation operator code snippets, including optional specification of occurrence and operator args.

This is used for testing whether the pre-mutation code is correctly mutated to the post-mutation code at the given occurrence (if specified) and for the given operator args (if specified).

occurrence: int | None
operator_args: dict | None
post_mutation_code: str
pre_mutation_code: str
class cosmic_ray.operators.operator.Operator

Bases: ABC

The mutation operator base class.

classmethod arguments() Sequence[Argument]

Sequence of Arguments that the operator accepts.

Returns: A Sequence of Argument instances

abstractmethod classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

abstractmethod mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

abstractmethod mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

cosmic_ray.operators.provider module

Operator-provider plugin for all core cosmic ray operators.

class cosmic_ray.operators.provider.OperatorProvider

Bases: object

Provider for all of the core Cosmic Ray operators.

cosmic_ray.operators.remove_decorator module

Implementation of the remove-decorator operator.

class cosmic_ray.operators.remove_decorator.RemoveDecorator

Bases: Operator

An operator that removes decorators.

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

cosmic_ray.operators.unary_operator_replacement module

Implementation of the unary-operator-replacement operator.

class cosmic_ray.operators.unary_operator_replacement.ReplaceUnaryOperator_Delete_Invert

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.unary_operator_replacement.ReplaceUnaryOperator_Delete_Not

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.unary_operator_replacement.ReplaceUnaryOperator_Delete_USub

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.unary_operator_replacement.ReplaceUnaryOperator_Invert_Not

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.unary_operator_replacement.ReplaceUnaryOperator_Invert_UAdd

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.unary_operator_replacement.ReplaceUnaryOperator_Invert_USub

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.unary_operator_replacement.ReplaceUnaryOperator_UAdd_Invert

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.unary_operator_replacement.ReplaceUnaryOperator_UAdd_Not

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.unary_operator_replacement.ReplaceUnaryOperator_UAdd_USub

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.unary_operator_replacement.ReplaceUnaryOperator_USub_Invert

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.unary_operator_replacement.ReplaceUnaryOperator_USub_Not

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.unary_operator_replacement.ReplaceUnaryOperator_USub_UAdd

Bases: Operator

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Mutate a node in an operator-specific manner.

Return the new, mutated node. Return None if the node has been deleted. Return node if there is no mutation at all for some reason.

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

class cosmic_ray.operators.unary_operator_replacement.UnaryOperators(*values)

Bases: Enum

All unary operators that we mutate.

Invert = '~'
Not = 'not '
Nothing = None
UAdd = '+'
USub = '-'
cosmic_ray.operators.unary_operator_replacement.op_cls

alias of ReplaceUnaryOperator

cosmic_ray.operators.unary_operator_replacement.operators()

Iterable of unary operator mutation operators.

cosmic_ray.operators.util module

Utilities for implementing operators.

cosmic_ray.operators.util.extend_name(suffix)

A factory for class decorators that modify the class name by appending some text to it.

Example:

@extend_name('_Foo')
class Class:
    pass

assert Class.__name__ == 'Class_Foo'

cosmic_ray.operators.zero_iteration_for_loop module

Implementation of the zero-iteration-loop operator.

class cosmic_ray.operators.zero_iteration_for_loop.ZeroIterationForLoop

Bases: Operator

An operator that modified for-loops to have zero iterations.

classmethod examples()

Examples of the mutations that this operator can make.

This is primarily for testing purposes, but it could also be used for documentation.

Each example takes the following arguments:

pre_mutation_code: code prior to applying the mutation. post_mutation_code: code after (successfully) applying the mutation. occurrence: the index of the occurrence to which the mutation is

applied (optional, default=0).

operator_args: a dictionary of arguments to be **-unpacked to the

operator (optional, default={}).

Returns: An iterable of Examples.

mutate(node, index)

Modify the For loop to evaluate to None

mutation_positions(node)

All positions where this operator can mutate node.

An operator might be able to mutate a node in multiple ways, and this function should produce a position description for each of these mutations. Critically, if an operator can make multiple mutations to the same position, this should produce a position for each of these mutations (i.e. multiple identical positions).

Parameters:

node – The AST node being mutated.

Returns:

An iterable of ((start-line, start-col), (stop-line, stop-col)) tuples describing the locations where this operator will mutate node.

Module contents