Skip to content

Commit a7b9e85

Browse files
authored
Merge pull request #929 from codeflash-ai/fix/correct-sample-optimization-code
Correct sample code for demo optimization (CF-876)
2 parents c143fcc + 265b7d0 commit a7b9e85

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

codeflash/cli_cmds/cmd_init.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1228,13 +1228,16 @@ def enter_api_key_and_save_to_rc() -> None:
12281228

12291229

12301230
def create_find_common_tags_file(args: Namespace, file_name: str) -> Path:
1231-
find_common_tags_content = """def find_common_tags(articles: list[dict[str, list[str]]]) -> set[str]:
1231+
find_common_tags_content = """from __future__ import annotations
1232+
1233+
1234+
def find_common_tags(articles: list[dict[str, list[str]]]) -> set[str]:
12321235
if not articles:
12331236
return set()
12341237
1235-
common_tags = articles[0]["tags"]
1238+
common_tags = articles[0].get("tags", [])
12361239
for article in articles[1:]:
1237-
common_tags = [tag for tag in common_tags if tag in article["tags"]]
1240+
common_tags = [tag for tag in common_tags if tag in article.get("tags", [])]
12381241
return set(common_tags)
12391242
"""
12401243

0 commit comments

Comments
 (0)