reitzensteinm / duopoly Goto Github PK
View Code? Open in Web Editor NEWAn experiment in AI collaboration
License: GNU General Public License v3.0
An experiment in AI collaboration
License: GNU General Public License v3.0
For each attempt in the loop in main.py, print "Attempt 1" etc in the console. Use the termcolor library in order to mark these in pink on the console.
When an exception happens in this loop, print the exception that was thrown in red.
Refactor gpt_query to also take an optional system parameter. Move the current system prompt to a top level constant called SYSTEM_PATCH, and if no parameter is supplied to gpt_query, use SYSTEM_PATCH as the default.
Make sure each function has a one line docstring, add type hints and format correctly.
Remove all duplicate imports in main.py.
In main.py, create a function that takes a prompt string, and contains all of the logic to apply the prompt to a dictionary of files, containing filenames as keys and the contents of the files as values. Move this logic out of the loop over issues in the main function.
Add a function to repo.py using Git-Python to commit local modifications to the current branch. Also, move fetch_open_issues to repo.py.
In repo.py, change the push_local_branch_to_origin function to use the force push flag.
Move the apply_patch and patch_files functions out of main.py and into patch.py. Make sure to add imports to main.py to be able to call the moved functions.
Add a function that takes Python in a string, and uses the Black package to format it, returning a string.
Update the process issue function to use the functions in repo.py to:
Move partition_by_predicate to utils.py, deleting it from main.py. Add imports to main.py to allow it to still be called.
Move read_file and write_file to utils.py. Fix imports, then make sure moved code is deleted at the original location.
Add a function to partition a sequence by predicate. For instance if I start with [2,1,1,2,3,4,1,6] it turns into [[2,1,1],[2,3],[4,1][6]] based on the predicate 'is even'.
The function partition_by_predicate takes in a list, and returns a list of lists. The function loops over the input, adding each element to a list. Each time the predicate returns true, it starts on a new list with that element.
Every element of the input list is contained in the output lists.
For example, [1,2,3,4,5,6,8,10] with is_even would result in [[1],[2,3],[4,5],[6],[8],[10]].
Add some tests for partition_by_predicate that can be executed via pytest, and update its docstring to be a paragraph long to explain its use. Create at least five tests that exercise any edge cases you can imagine, but please keep them short.
When calling pytest, pass a flag to log any errors to a file. Read it back in, and pipe it into the exception that will later be printed.
Create a recipes.py file, which contains a Recipe data class containing:
There should be a function to instantiate a Recipe, and this should add it to a global list.
At the end of process_issue in main.py, switch back to the main branch once the function completes.
Please rename the main function to main2 and replace all occurences.
Please rename the main function to main2 and replace all occurences.
Create a function in main.py to process issues, replacing the code in the loop in the main function. It should take an Issue as a parameter (make sure to import it).
Move all input statements to the top of the file. They should never be placed after code or variable declarations.
Add a cache.py file, which implements a key value store on the disk with read and write. Values should be stored in a .cache/ directory, using md5 hash of the keys. Reading a non existent key should throw an exception.
Add a function which can memoize function calls by storing their arguments to the KV store.
Add a function that takes a string which represents a file, and returns a string with the same file with line numbers added at the start of each line.
In apply_prompt_to_files, there are two calls to check_result, one with all files, and one with filtered files.
Remove the check of all files.
Additionally, the filtering logic is incorrect.
A file should be kept in new_files if it has changed since old_files, OR if it's brand new.
A file should be kept in old_files if it has changed since new_files, OR if new_files has removed it.
Using GitPython, and PyGithub, create the following functions in a new repo.py:
Add a function that creates the specified branch using GitPython, switches to it, runs a specified callback to make changes to the filesystem, then commits and pushes the branch.
Change the main function to use this new function, creating a branch which is a hash of the prompt.
Please rename the main function to main2 and replace all occurences.
Add a test for the main.py apply_prompt_to_files function in test_main.py. The prompt should be "create a function called add_test which adds one to the input", with an empty file for input. Take the resulting output code, and exec it, extracting the add_test function from the resulting environment. Test whether the add_test function works.
Remove any instance of code which can't be executed under any circumstances.
The main function is called twice in main.py - once that propagates the retries count, and once that does not. Remove the old one which does not.
Move the add_line_numbers from main.py to utils.py. Ensure to add an import if required to main.py to import the moved function. Also add any required imports to utils.py.
Add a flag -r or --retries which allows a configurable number of retries to be set in main.py. Default is 5.
Move all Python files inside a src directory.
The partition_by_predicate tests are good, but much too long. Make them neater, and use pytest features like parameterization if necessary.
Add a function in the recipes file to look up a recipe based on its id.
Retry up to five times when calling process_issue in the main function. If it throws an exception, run it again.
Move list_files, apply_prompt_to_files and check_result to transform.py
Add a function that lists all of the Python files in the working directory, as well as subdirectories. The return value should be an array of relative paths as strings.
The call to pytest isn't returning any error information on stderr when a pytest test throws an exception. Please update the command line arguments so it does.
Move gpt_query to gpt.py, deleting it from main.py. Add imports to main.py to allow it to still be called, and whatever imports are required in gpt.py.
In process_issue, call pytest after writing the updated files. Do this by executing it in a shell.
If pytest fails, throw an exception.
In apply_prompt_to_files, call check_result with modified old_files and new_files lists that remove unchanged key/value pairs from both lists.
Please rename the main function in src/main.py only to main2 and replace all occurances in that file.
Modify the git commit to also add new files in addition to modifications to existing files.
Remove any unused imports from every file in the project if they exist.
When pytest fails, include the errors it generates on strerr in the exception that's thrown, so it will be printed later.
Add a function that applies a unified diff the current directory using the python-patch library.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.