Skip to content

Class peagen.plugins.mutators.echo_mutator.EchoMutator

peagen.plugins.mutators.echo_mutator.EchoMutator

EchoMutator(*_, **__)

Trivial mutator used for testing.

Source code in peagen/plugins/mutators/echo_mutator.py
7
8
def __init__(self, *_, **__):
    pass

mutate

mutate(prompt)

Return the original code extracted from prompt with a comment.

Source code in peagen/plugins/mutators/echo_mutator.py
10
11
12
13
14
15
16
def mutate(self, prompt: str) -> str:
    """Return the original code extracted from *prompt* with a comment."""
    import re

    match = re.search(r"```python\n(.+?)```", prompt, re.DOTALL)
    src = match.group(1) if match else prompt
    return src + "\n# mutated\n"