mirror of
https://github.com/codeflash-ai/codeflash-internal.git
synced 2026-05-04 18:25:18 +00:00
Refactor main function into Optimizer class
This commit is contained in:
parent
205e360e3e
commit
e0db936639
8 changed files with 476 additions and 445 deletions
|
|
@ -7,8 +7,7 @@
|
||||||
<excludeFolder url="file://$MODULE_DIR$/.mypy_cache" />
|
<excludeFolder url="file://$MODULE_DIR$/.mypy_cache" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/.pytest_cache" />
|
<excludeFolder url="file://$MODULE_DIR$/.pytest_cache" />
|
||||||
</content>
|
</content>
|
||||||
<orderEntry type="jdk" jdkName="codeflash311" jdkType="Python SDK" />
|
<orderEntry type="jdk" jdkName="Poetry (codeflash) (4)" jdkType="Python SDK" />
|
||||||
<orderEntry type="jdk" jdkName="Poetry (codeflash) (3)" jdkType="Python SDK" />
|
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
||||||
|
|
@ -2,5 +2,6 @@
|
||||||
<profile version="1.0">
|
<profile version="1.0">
|
||||||
<option name="myName" value="Project Default" />
|
<option name="myName" value="Project Default" />
|
||||||
<inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
|
<inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="Mypy" enabled="true" level="SERVER PROBLEM" enabled_by_default="true" editorAttributes="GENERIC_SERVER_ERROR_OR_WARNING" />
|
||||||
</profile>
|
</profile>
|
||||||
</component>
|
</component>
|
||||||
|
|
@ -1,9 +1,10 @@
|
||||||
<component name="InspectionProjectProfileManager">
|
<component name="InspectionProjectProfileManager">
|
||||||
<settings>
|
<settings>
|
||||||
<info color="dc00eb">
|
<info color="dc00eb">
|
||||||
|
<option name="FOREGROUND" value="dc00eb" />
|
||||||
|
<option name="BACKGROUND" value="e8d9ff" />
|
||||||
<option name="EFFECT_COLOR" value="dc00eb" />
|
<option name="EFFECT_COLOR" value="dc00eb" />
|
||||||
<option name="ERROR_STRIPE_COLOR" value="dc00eb" />
|
<option name="ERROR_STRIPE_COLOR" value="dc00eb" />
|
||||||
<option name="EFFECT_TYPE" value="2" />
|
|
||||||
<option name="myName" value="Type Hint" />
|
<option name="myName" value="Type Hint" />
|
||||||
<option name="myVal" value="50" />
|
<option name="myVal" value="50" />
|
||||||
<option name="myExternalName" value="Type Hint" />
|
<option name="myExternalName" value="Type Hint" />
|
||||||
|
|
@ -23,8 +24,8 @@
|
||||||
<item index="8" class="java.lang.String" itemvalue="WEAK WARNING" />
|
<item index="8" class="java.lang.String" itemvalue="WEAK WARNING" />
|
||||||
<item index="9" class="java.lang.String" itemvalue="INFO" />
|
<item index="9" class="java.lang.String" itemvalue="INFO" />
|
||||||
<item index="10" class="java.lang.String" itemvalue="WARNING" />
|
<item index="10" class="java.lang.String" itemvalue="WARNING" />
|
||||||
<item index="11" class="java.lang.String" itemvalue="Type Hint" />
|
<item index="11" class="java.lang.String" itemvalue="ERROR" />
|
||||||
<item index="12" class="java.lang.String" itemvalue="ERROR" />
|
<item index="12" class="java.lang.String" itemvalue="Type Hint" />
|
||||||
</list>
|
</list>
|
||||||
</settings>
|
</settings>
|
||||||
</component>
|
</component>
|
||||||
|
|
@ -3,8 +3,7 @@
|
||||||
<component name="Black">
|
<component name="Black">
|
||||||
<option name="enabledOnReformat" value="true" />
|
<option name="enabledOnReformat" value="true" />
|
||||||
<option name="enabledOnSave" value="true" />
|
<option name="enabledOnSave" value="true" />
|
||||||
<option name="pathToExecutable" value="$USER_HOME$/mambaforge/bin/black" />
|
<option name="sdkName" value="Poetry (codeflash) (4)" />
|
||||||
<option name="sdkName" value="Poetry (codeflash) (3)" />
|
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectRootManager" version="2" project-jdk-name="Poetry (codeflash) (3)" project-jdk-type="Python SDK" />
|
<component name="ProjectRootManager" version="2" project-jdk-name="Poetry (codeflash) (4)" project-jdk-type="Python SDK" />
|
||||||
</project>
|
</project>
|
||||||
6
.idea/pydantic.xml
Normal file
6
.idea/pydantic.xml
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="PydanticConfigService">
|
||||||
|
<option name="warnUntypedFields" value="true" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="SqlDialectMappings">
|
<component name="SqlDialectMappings">
|
||||||
<file url="file://$PROJECT_DIR$/code_to_optimize/tests/pytest/test_bubble_sort_deleteme.py" dialect="GenericSQL" />
|
|
||||||
<file url="PROJECT" dialect="SQLite" />
|
<file url="PROJECT" dialect="SQLite" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,8 +1,8 @@
|
||||||
import os
|
|
||||||
import ast
|
import ast
|
||||||
|
import os
|
||||||
|
|
||||||
|
|
||||||
def get_test_file_path(test_dir, function_name, iteration=0, test_type="unit"):
|
def get_test_file_path(test_dir: str, function_name: str, iteration: int = 0, test_type: str = "unit") -> str:
|
||||||
assert test_type in ["unit", "inspired", "replay"]
|
assert test_type in ["unit", "inspired", "replay"]
|
||||||
function_name = function_name.replace(".", "_")
|
function_name = function_name.replace(".", "_")
|
||||||
path = os.path.join(test_dir, f"test_{function_name}__{test_type}_test_{iteration}.py")
|
path = os.path.join(test_dir, f"test_{function_name}__{test_type}_test_{iteration}.py")
|
||||||
|
|
@ -11,7 +11,7 @@ def get_test_file_path(test_dir, function_name, iteration=0, test_type="unit"):
|
||||||
return path
|
return path
|
||||||
|
|
||||||
|
|
||||||
def delete_multiple_if_name_main(test_ast):
|
def delete_multiple_if_name_main(test_ast: ast.Module) -> ast.Module:
|
||||||
if_indexes = []
|
if_indexes = []
|
||||||
for index, node in enumerate(test_ast.body):
|
for index, node in enumerate(test_ast.body):
|
||||||
if isinstance(node, ast.If):
|
if isinstance(node, ast.If):
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue