Skip to content

Commit 1cfedae

Browse files
committed
ran ruff check --fix . ; ruff format .
1 parent c8950f5 commit 1cfedae

File tree

5 files changed

+15
-14
lines changed

5 files changed

+15
-14
lines changed

codeflash/cli_cmds/cli_common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def inquirer_wrapper_path(*args: str, **kwargs: str) -> dict[str, str] | None:
7474
new_kwargs["message"] = last_message
7575
new_args.append(args[0])
7676

77-
return cast(dict[str, str], inquirer.prompt([inquirer.Path(*new_args, **new_kwargs)]))
77+
return cast("dict[str, str]", inquirer.prompt([inquirer.Path(*new_args, **new_kwargs)]))
7878

7979

8080
def split_string_to_fit_width(string: str, width: int) -> list[str]:

codeflash/cli_cmds/cmd_init.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ def init_codeflash() -> None:
6868
did_add_new_key = prompt_api_key()
6969

7070
if should_modify_pyproject_toml():
71-
7271
setup_info: SetupInfo = collect_setup_info()
7372

7473
configure_pyproject_toml(setup_info)
@@ -81,7 +80,6 @@ def init_codeflash() -> None:
8180
if "setup_info" in locals():
8281
module_string = f" you selected ({setup_info.module_root})"
8382

84-
8583
click.echo(
8684
f"{LF}"
8785
f"⚡️ Codeflash is now set up! You can now run:{LF}"
@@ -123,18 +121,19 @@ def ask_run_end_to_end_test(args: Namespace) -> None:
123121
bubble_sort_path, bubble_sort_test_path = create_bubble_sort_file_and_test(args)
124122
run_end_to_end_test(args, bubble_sort_path, bubble_sort_test_path)
125123

124+
126125
def should_modify_pyproject_toml() -> bool:
127-
"""
128-
Check if the current directory contains a valid pyproject.toml file with codeflash config
126+
"""Check if the current directory contains a valid pyproject.toml file with codeflash config
129127
If it does, ask the user if they want to re-configure it.
130128
"""
131129
from rich.prompt import Confirm
130+
132131
pyproject_toml_path = Path.cwd() / "pyproject.toml"
133132
if not pyproject_toml_path.exists():
134133
return True
135134
try:
136135
config, config_file_path = parse_config_file(pyproject_toml_path)
137-
except Exception as e:
136+
except Exception:
138137
return True
139138

140139
if "module_root" not in config or config["module_root"] is None or not Path(config["module_root"]).is_dir():
@@ -143,7 +142,9 @@ def should_modify_pyproject_toml() -> bool:
143142
return True
144143

145144
create_toml = Confirm.ask(
146-
f"✅ A valid Codeflash config already exists in this project. Do you want to re-configure it?", default=False, show_default=True
145+
"✅ A valid Codeflash config already exists in this project. Do you want to re-configure it?",
146+
default=False,
147+
show_default=True,
147148
)
148149
return create_toml
149150

@@ -224,7 +225,7 @@ def collect_setup_info() -> SetupInfo:
224225
else:
225226
apologize_and_exit()
226227
else:
227-
tests_root = Path(curdir) / Path(cast(str, tests_root_answer))
228+
tests_root = Path(curdir) / Path(cast("str", tests_root_answer))
228229
tests_root = tests_root.relative_to(curdir)
229230
ph("cli-tests-root-provided")
230231

@@ -278,9 +279,9 @@ def collect_setup_info() -> SetupInfo:
278279
return SetupInfo(
279280
module_root=str(module_root),
280281
tests_root=str(tests_root),
281-
test_framework=cast(str, test_framework),
282+
test_framework=cast("str", test_framework),
282283
ignore_paths=ignore_paths,
283-
formatter=cast(str, formatter),
284+
formatter=cast("str", formatter),
284285
git_remote=str(git_remote),
285286
)
286287

@@ -390,7 +391,7 @@ def check_for_toml_or_setup_file() -> str | None:
390391
click.echo("⏩️ Skipping pyproject.toml creation.")
391392
apologize_and_exit()
392393
click.echo()
393-
return cast(str, project_name)
394+
return cast("str", project_name)
394395

395396

396397
def install_github_actions(override_formatter_check: bool = False) -> None:

codeflash/code_utils/config_parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def parse_config_file(
8787
"In pyproject.toml, Codeflash only supports the 'test-framework' as pytest and unittest."
8888
)
8989
if len(config["formatter-cmds"]) > 0:
90-
#see if this is happening during GitHub actions setup
90+
# see if this is happening during GitHub actions setup
9191
if not override_formatter_check:
9292
assert config["formatter-cmds"][0] != "your-formatter $file", (
9393
"The formatter command is not set correctly in pyproject.toml. Please set the "

codeflash/discovery/functions_to_optimize.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ def get_all_replay_test_functions(
300300
if valid_function.qualified_name == function_name
301301
]
302302
)
303-
if len(filtered_list):
303+
if filtered_list:
304304
filtered_valid_functions[file_path] = filtered_list
305305

306306
return filtered_valid_functions

codeflash/models/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,7 @@ def __eq__(self, other: object) -> bool:
527527
if len(self) != len(other):
528528
return False
529529
original_recursion_limit = sys.getrecursionlimit()
530-
cast(TestResults, other)
530+
cast("TestResults", other)
531531
for test_result in self:
532532
other_test_result = other.get_by_unique_invocation_loop_id(test_result.unique_invocation_loop_id)
533533
if other_test_result is None:

0 commit comments

Comments
 (0)