Skip to content
Closed
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
14 changes: 7 additions & 7 deletions codeflash/models/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from collections import defaultdict
from typing import TYPE_CHECKING

from pydantic import BaseModel
from rich.tree import Tree

from codeflash.cli_cmds.console import DEBUG_MODE
Expand All @@ -19,7 +20,7 @@
from typing import Annotated, Optional, cast

from jedi.api.classes import Name
from pydantic import AfterValidator, BaseModel, ConfigDict, PrivateAttr
from pydantic import AfterValidator, ConfigDict, PrivateAttr
from pydantic.dataclasses import dataclass

from codeflash.cli_cmds.console import console, logger
Expand Down Expand Up @@ -192,12 +193,11 @@ def markdown(self) -> str:
)

def file_to_path(self) -> dict[str, str]:
if self._cache.get("file_to_path") is not None:
return self._cache["file_to_path"]
self._cache["file_to_path"] = {
str(code_string.file_path): code_string.code for code_string in self.code_strings
}
return self._cache["file_to_path"]
cache = self._cache
if cache.get("file_to_path") is not None:
return cache["file_to_path"]
cache["file_to_path"] = {str(code_string.file_path): code_string.code for code_string in self.code_strings}
return cache["file_to_path"]

@staticmethod
def parse_flattened_code(flat_code: str) -> CodeStringsMarkdown:
Expand Down
Loading