Private
Public Access
more org
This commit is contained in:
@@ -1,29 +0,0 @@
|
||||
"""Minimal reproducer for the auto_switch_sim GUI crash."""
|
||||
import sys
|
||||
import time
|
||||
import os
|
||||
sys.path.insert(0, 'C:/projects/manual_slop')
|
||||
sys.path.insert(0, 'C:/projects/manual_slop/src')
|
||||
|
||||
from src.api_hook_client import ApiHookClient
|
||||
client = ApiHookClient()
|
||||
if not client.wait_for_server(timeout=15):
|
||||
print('FAIL: server not up')
|
||||
sys.exit(1)
|
||||
print('OK: server up')
|
||||
|
||||
print('Step 1: click btn_reset')
|
||||
client.click('btn_reset')
|
||||
time.sleep(1.0)
|
||||
print('Step 1 done, status=', client.get_value('ai_status'))
|
||||
|
||||
print('Step 2: set_value current_provider gemini_cli')
|
||||
client.set_value('current_provider', 'gemini_cli')
|
||||
time.sleep(1.0)
|
||||
print('Step 2 done')
|
||||
|
||||
print('Step 3: set_value gcli_path')
|
||||
mock_path = os.path.abspath('tests/mock_concurrent_mma.py')
|
||||
client.set_value('gcli_path', '"' + sys.executable + '" "' + mock_path + '"')
|
||||
time.sleep(1.0)
|
||||
print('Step 3 done')
|
||||
+18
-24
@@ -1,3 +1,4 @@
|
||||
import difflib
|
||||
import shutil
|
||||
import os
|
||||
|
||||
@@ -25,12 +26,10 @@ def parse_hunk_header(line: str) -> Optional[tuple[int, int, int, int]]:
|
||||
"""
|
||||
[C: tests/test_diff_viewer.py:test_parse_hunk_header]
|
||||
"""
|
||||
if not line.startswith("@@"):
|
||||
return None
|
||||
if not line.startswith("@@"): return None
|
||||
|
||||
parts = line.split()
|
||||
if len(parts) < 2:
|
||||
return None
|
||||
if len(parts) < 2: return None
|
||||
|
||||
old_part = parts[1][1:]
|
||||
new_part = parts[2][1:]
|
||||
@@ -83,21 +82,21 @@ def parse_diff(diff_text: str) -> List[DiffFile]:
|
||||
if hunk_info:
|
||||
old_start, old_count, new_start, new_count = hunk_info
|
||||
current_hunk = DiffHunk(
|
||||
header=line,
|
||||
lines=[],
|
||||
old_start=old_start,
|
||||
old_count=old_count,
|
||||
new_start=new_start,
|
||||
new_count=new_count
|
||||
header = line,
|
||||
lines = [],
|
||||
old_start = old_start,
|
||||
old_count = old_count,
|
||||
new_start = new_start,
|
||||
new_count = new_count
|
||||
)
|
||||
else:
|
||||
current_hunk = DiffHunk(
|
||||
header=line,
|
||||
lines=[],
|
||||
old_start=0,
|
||||
old_count=0,
|
||||
new_start=0,
|
||||
new_count=0
|
||||
header = line,
|
||||
lines = [],
|
||||
old_start = 0,
|
||||
old_count = 0,
|
||||
new_start = 0,
|
||||
new_count = 0
|
||||
)
|
||||
|
||||
elif current_hunk is not None:
|
||||
@@ -117,20 +116,15 @@ def get_line_color(line: str) -> Optional[str]:
|
||||
"""
|
||||
[C: tests/test_diff_viewer.py:test_get_line_color]
|
||||
"""
|
||||
if line.startswith("+"):
|
||||
return "green"
|
||||
elif line.startswith("-"):
|
||||
return "red"
|
||||
elif line.startswith("@@"):
|
||||
return "cyan"
|
||||
if line.startswith("+"): return "green"
|
||||
elif line.startswith("-"): return "red"
|
||||
elif line.startswith("@@"): return "cyan"
|
||||
return None
|
||||
|
||||
def apply_patch_to_file(patch_text: str, base_dir: str = ".") -> Tuple[bool, str]:
|
||||
"""
|
||||
[C: src/gui_2.py:App._apply_pending_patch, tests/test_diff_viewer.py:test_apply_patch_simple, tests/test_diff_viewer.py:test_apply_patch_with_context]
|
||||
"""
|
||||
import difflib
|
||||
|
||||
diff_files = parse_diff(patch_text)
|
||||
if not diff_files:
|
||||
return False, "No valid diff found"
|
||||
|
||||
+4
-9
File diff suppressed because one or more lines are too long
@@ -196,8 +196,6 @@ class GeminiCliAdapter:
|
||||
|
||||
def count_tokens(self, contents: list[str]) -> int:
|
||||
"""
|
||||
|
||||
|
||||
Provides a character-based token estimation for the Gemini CLI.
|
||||
Uses 4 chars/token as a conservative average.
|
||||
[C: tests/test_gemini_cli_adapter_parity.py:TestGeminiCliAdapterParity.test_count_tokens_fallback]
|
||||
|
||||
Reference in New Issue
Block a user