Skip to content

Commit a95ad4f

Browse files
committed
NoneType and List are not hashable
1 parent 8e3059a commit a95ad4f

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

codeflash/code_utils/config_parser.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
from __future__ import annotations
22

3-
from functools import cache
43
from pathlib import Path
54
from typing import Any
65

76
import tomlkit
87

8+
PYPROJECT_TOML_CACHE = {}
9+
910

10-
@cache
1111
def find_pyproject_toml(config_file: Path | None = None) -> Path:
1212
# Find the pyproject.toml file on the root of the project
1313

@@ -21,10 +21,15 @@ def find_pyproject_toml(config_file: Path | None = None) -> Path:
2121
raise ValueError(msg)
2222
return config_file
2323
dir_path = Path.cwd()
24-
24+
cur_path = dir_path
25+
# see if it was encountered before in search
26+
if cur_path in PYPROJECT_TOML_CACHE:
27+
return PYPROJECT_TOML_CACHE[cur_path]
28+
# map current path to closest file
2529
while dir_path != dir_path.parent:
2630
config_file = dir_path / "pyproject.toml"
2731
if config_file.exists():
32+
PYPROJECT_TOML_CACHE[cur_path] = config_file
2833
return config_file
2934
# Search for pyproject.toml in the parent directories
3035
dir_path = dir_path.parent
@@ -33,7 +38,6 @@ def find_pyproject_toml(config_file: Path | None = None) -> Path:
3338
raise ValueError(msg)
3439

3540

36-
@cache
3741
def find_conftest_files(test_paths: list[Path]) -> list[Path]:
3842
list_of_conftest_files = set()
3943
for test_path in test_paths:

0 commit comments

Comments
 (0)