Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions codeflash/models/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,11 +331,12 @@ def file_to_path(self) -> dict[str, str]:
dict[str, str]: Mapping from file path (as string) to code.

"""
if "file_to_path" in self._cache:
try:
return self._cache["file_to_path"]
result = {str(code_string.file_path): code_string.code for code_string in self.code_strings}
self._cache["file_to_path"] = result
return result
except KeyError:
result = {str(code_string.file_path): code_string.code for code_string in self.code_strings}
self._cache["file_to_path"] = result
return result

@staticmethod
def parse_markdown_code(markdown_code: str, expected_language: str = "python") -> CodeStringsMarkdown:
Expand Down
Loading