Merge pull request #9 from juleshenry/main

Address Examples Initiative
pull/15/head^2
biobootloader 2023-04-22 17:29:07 -07:00 zatwierdzone przez GitHub
commit 472e8b5a87
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
3 zmienionych plików z 32 dodań i 1 usunięć

Wyświetl plik

@ -23,7 +23,7 @@ _warning!_ By default wolverine uses GPT-4 and may make many repeated calls to t
To run with gpt-4 (the default, tested option):
python wolverine.py buggy_script.py "subtract" 20 3
python wolverine.py examples/buggy_script.py "subtract" 20 3
You can also run with other models, but be warned they may not adhere to the edit format as well:

Wyświetl plik

@ -1,5 +1,9 @@
import sys
import fire
"""
Run With: `wolverine examples/buggy_script.py "subtract" 20 3`
Purpose: Show self-regenerating fixing of subtraction operator
"""
def add_numbers(a, b):
return a + b

Wyświetl plik

@ -0,0 +1,27 @@
#!/usr/bin/env python3
import fire
"""
Run With: with `python wolverine.py examples/buggy_script_2.py`
Purpose: Fix singleton code bug in Python
"""
class SingletonClass(object):
def __new__(cls):
cls.instance = super(SingletonClass, cls).__new__(cls)
return cls.instance
def check_singleton_works():
"""
check that singleton pattern is working
"""
singleton = SingletonClass()
new_singleton = SingletonClass()
singleton.a = 1
new_singleton.a = 2
should_be_4 = (singleton.a + new_singleton.a)
assert should_be_4 == 4
if __name__=="__main__":
fire.Fire(check_singleton_works)