mirror of
https://github.com/codeflash-ai/codeflash-internal.git
synced 2026-05-04 18:25:18 +00:00
Standardize mypy/ruff colors, use file_path attribute of FunctionToOptimize
This commit is contained in:
parent
a100fc8ddb
commit
d2823d80dd
3 changed files with 14 additions and 17 deletions
|
|
@ -9,6 +9,7 @@
|
|||
<inspection_tool class="Eslint" enabled="true" level="SERVER PROBLEM" enabled_by_default="true" editorAttributes="GENERIC_SERVER_ERROR_OR_WARNING">
|
||||
<option name="useSeverityFromConfigFile" value="false" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="Mypy" enabled="true" level="SERVER PROBLEM" enabled_by_default="true" editorAttributes="GENERIC_SERVER_ERROR_OR_WARNING" />
|
||||
<inspection_tool class="PyMissingTypeHintsInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="PyPep8Inspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
|
||||
<option name="ignoredErrors">
|
||||
|
|
@ -18,6 +19,6 @@
|
|||
</option>
|
||||
</inspection_tool>
|
||||
<inspection_tool class="PydanticTypeCheckerInspection" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="RuffInspection" enabled="true" level="WARNING" enabled_by_default="true" editorAttributes="WARNING_ATTRIBUTES" />
|
||||
<inspection_tool class="RuffInspection" enabled="true" level="SERVER PROBLEM" enabled_by_default="true" editorAttributes="RUNTIME_ERROR" />
|
||||
</profile>
|
||||
</component>
|
||||
|
|
@ -20,12 +20,12 @@
|
|||
<item index="4" class="java.lang.String" itemvalue="STYLE_ERROR" />
|
||||
<item index="5" class="java.lang.String" itemvalue="TYPO" />
|
||||
<item index="6" class="java.lang.String" itemvalue="GRAMMAR_ERROR" />
|
||||
<item index="7" class="java.lang.String" itemvalue="SERVER PROBLEM" />
|
||||
<item index="8" class="java.lang.String" itemvalue="WEAK WARNING" />
|
||||
<item index="9" class="java.lang.String" itemvalue="INFO" />
|
||||
<item index="10" class="java.lang.String" itemvalue="WARNING" />
|
||||
<item index="11" class="java.lang.String" itemvalue="ERROR" />
|
||||
<item index="12" class="java.lang.String" itemvalue="Type Hint" />
|
||||
<item index="7" class="java.lang.String" itemvalue="Type Hint" />
|
||||
<item index="8" class="java.lang.String" itemvalue="SERVER PROBLEM" />
|
||||
<item index="9" class="java.lang.String" itemvalue="WEAK WARNING" />
|
||||
<item index="10" class="java.lang.String" itemvalue="INFO" />
|
||||
<item index="11" class="java.lang.String" itemvalue="WARNING" />
|
||||
<item index="12" class="java.lang.String" itemvalue="ERROR" />
|
||||
</list>
|
||||
</settings>
|
||||
</component>
|
||||
|
|
@ -172,7 +172,6 @@ class Optimizer:
|
|||
function_to_optimize,
|
||||
function_to_tests,
|
||||
original_code,
|
||||
path,
|
||||
should_run_experiment,
|
||||
)
|
||||
if is_successful(best_optimization):
|
||||
|
|
@ -199,7 +198,6 @@ class Optimizer:
|
|||
function_to_optimize: FunctionToOptimize,
|
||||
function_to_tests: Dict[str, List[TestsInFile]],
|
||||
original_code: str,
|
||||
path: str,
|
||||
should_run_experiment: bool,
|
||||
) -> Result[BestOptimization, str]:
|
||||
function_trace_id: str = str(uuid.uuid4())
|
||||
|
|
@ -218,7 +216,7 @@ class Optimizer:
|
|||
dependent_code = f.read()
|
||||
original_dependent_code[module_abspath] = dependent_code
|
||||
logging.info(f"Code to be optimized:\n{code_context.code_to_optimize_with_dependents}")
|
||||
module_path = module_name_from_file_path(path, self.args.project_root)
|
||||
module_path = module_name_from_file_path(function_to_optimize.file_path, self.args.project_root)
|
||||
instrumented_unittests_created_for_function = self.instrument_existing_tests(
|
||||
function_to_optimize=function_to_optimize,
|
||||
function_to_tests=function_to_tests,
|
||||
|
|
@ -270,7 +268,6 @@ class Optimizer:
|
|||
original_code,
|
||||
original_code_baseline,
|
||||
original_dependent_code,
|
||||
path,
|
||||
function_trace_id[:-4] + f"EXP{u}" if should_run_experiment else function_trace_id,
|
||||
)
|
||||
ph("cli-optimize-function-finished", {"function_trace_id": function_trace_id})
|
||||
|
|
@ -286,7 +283,7 @@ class Optimizer:
|
|||
original_runtime_ns=original_code_baseline.runtime,
|
||||
best_runtime_ns=best_optimization.runtime,
|
||||
function_name=function_to_optimize.qualified_name,
|
||||
path=path,
|
||||
path=function_to_optimize.file_path,
|
||||
)
|
||||
|
||||
self.log_successful_optimization(
|
||||
|
|
@ -335,7 +332,7 @@ class Optimizer:
|
|||
self.write_code_and_dependents(
|
||||
original_code,
|
||||
original_dependent_code,
|
||||
path,
|
||||
function_to_optimize.file_path,
|
||||
dependent_functions_by_module_abspath,
|
||||
)
|
||||
# Delete all the generated tests to not cause any clutter.
|
||||
|
|
@ -355,7 +352,6 @@ class Optimizer:
|
|||
original_code: str,
|
||||
original_code_baseline: OriginalCodeBaseline,
|
||||
original_dependent_code: Dict[str, str],
|
||||
path: str,
|
||||
function_trace_id: str,
|
||||
) -> Optional[BestOptimization]:
|
||||
best_optimization: Optional[BestOptimization] = None
|
||||
|
|
@ -382,7 +378,7 @@ class Optimizer:
|
|||
replace_function_definitions_in_module(
|
||||
[function_to_optimize.qualified_name],
|
||||
candidate.source_code,
|
||||
path,
|
||||
function_to_optimize.file_path,
|
||||
code_context.preexisting_functions,
|
||||
code_context.contextual_dunder_methods,
|
||||
)
|
||||
|
|
@ -407,7 +403,7 @@ class Optimizer:
|
|||
self.write_code_and_dependents(
|
||||
original_code,
|
||||
original_dependent_code,
|
||||
path,
|
||||
function_to_optimize.file_path,
|
||||
dependent_functions_by_module_abspath,
|
||||
)
|
||||
continue
|
||||
|
|
@ -460,7 +456,7 @@ class Optimizer:
|
|||
self.write_code_and_dependents(
|
||||
original_code,
|
||||
original_dependent_code,
|
||||
path,
|
||||
function_to_optimize.file_path,
|
||||
dependent_functions_by_module_abspath,
|
||||
)
|
||||
logging.info("----------------")
|
||||
|
|
|
|||
Loading…
Reference in a new issue