Skip to content

Commit f630096

Browse files
cf optimization
1 parent 3260e4a commit f630096

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

codeflash/lsp/helpers.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
import re
33
from functools import lru_cache
44

5+
_double_quote_pat = re.compile(r'"(.*?)"')
6+
7+
_single_quote_pat = re.compile(r"'(.*?)'")
8+
59

610
@lru_cache(maxsize=1)
711
def is_LSP_enabled() -> bool:
@@ -23,6 +27,6 @@ def simplify_worktree_paths(msg: str, highlight: bool = True) -> str: # noqa: F
2327

2428
def replace_quotes_with_backticks(text: str) -> str:
2529
# double-quoted strings
26-
text = re.sub(r'"(.*?)"', r"`\1`", text)
30+
text = _double_quote_pat.sub(r"`\1`", text)
2731
# single-quoted strings
28-
return re.sub(r"'(.*?)'", r"`\1`", text)
32+
return _single_quote_pat.sub(r"`\1`", text)

0 commit comments

Comments
 (0)