codereader 0.7.0__tar.gz → 0.7.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {codereader-0.7.0 → codereader-0.7.2}/PKG-INFO +3 -1
- {codereader-0.7.0 → codereader-0.7.2}/README.md +2 -0
- {codereader-0.7.0 → codereader-0.7.2}/pyproject.toml +1 -1
- {codereader-0.7.0 → codereader-0.7.2}/src/codereader/runners/runner.py +15 -2
- {codereader-0.7.0 → codereader-0.7.2}/LICENSE +0 -0
- {codereader-0.7.0 → codereader-0.7.2}/src/codereader/__init__.py +0 -0
- {codereader-0.7.0 → codereader-0.7.2}/src/codereader/cli.py +0 -0
- {codereader-0.7.0 → codereader-0.7.2}/src/codereader/logger/result_logger.py +0 -0
- {codereader-0.7.0 → codereader-0.7.2}/src/codereader/orchestration/grading_engine.py +0 -0
- {codereader-0.7.0 → codereader-0.7.2}/src/codereader/orchestration/runner_manager.py +0 -0
- {codereader-0.7.0 → codereader-0.7.2}/src/codereader/runners/llama_runner.py +0 -0
- {codereader-0.7.0 → codereader-0.7.2}/src/codereader/runners/ollama_runner.py +0 -0
- {codereader-0.7.0 → codereader-0.7.2}/src/codereader/runners/openai_runner.py +0 -0
- {codereader-0.7.0 → codereader-0.7.2}/src/codereader/runners/prompts.py +0 -0
- {codereader-0.7.0 → codereader-0.7.2}/src/codereader/runners/transformers_runner.py +0 -0
- {codereader-0.7.0 → codereader-0.7.2}/src/codereader/runners/utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: codereader
|
|
3
|
-
Version: 0.7.
|
|
3
|
+
Version: 0.7.2
|
|
4
4
|
Summary: Local code readability grader using LLMs
|
|
5
5
|
License: GPLv3
|
|
6
6
|
License-File: LICENSE
|
|
@@ -159,6 +159,8 @@ models:
|
|
|
159
159
|
type: ollama
|
|
160
160
|
model: qwen2.5-coder
|
|
161
161
|
weight: 1.0
|
|
162
|
+
runner_config:
|
|
163
|
+
no_think: true # to disable deep thinking to shorten
|
|
162
164
|
|
|
163
165
|
settings:
|
|
164
166
|
log_path: readability_log.txt
|
|
@@ -3,6 +3,7 @@ from __future__ import annotations
|
|
|
3
3
|
import asyncio
|
|
4
4
|
import json
|
|
5
5
|
import re
|
|
6
|
+
import os
|
|
6
7
|
|
|
7
8
|
from dataclasses import dataclass
|
|
8
9
|
from typing import Any, Dict, List, Optional, Protocol
|
|
@@ -89,13 +90,15 @@ async def run_subprocess(
|
|
|
89
90
|
loop = asyncio.get_running_loop()
|
|
90
91
|
start = loop.time()
|
|
91
92
|
|
|
93
|
+
clean_env = {**os.environ, "TERM": "dumb", "NO_COLOR": "1", **(env or {})}
|
|
94
|
+
|
|
92
95
|
try:
|
|
93
96
|
proc = await asyncio.create_subprocess_exec(
|
|
94
97
|
*cmd,
|
|
95
98
|
stdin=asyncio.subprocess.PIPE if stdin_text is not None else None,
|
|
96
99
|
stdout=asyncio.subprocess.PIPE,
|
|
97
100
|
stderr=asyncio.subprocess.PIPE,
|
|
98
|
-
env=
|
|
101
|
+
env=clean_env,
|
|
99
102
|
)
|
|
100
103
|
except FileNotFoundError as e:
|
|
101
104
|
dur = loop.time() - start
|
|
@@ -184,6 +187,16 @@ def _try_parse_from(text: str, start: int) -> Optional[Dict[str, Any]]:
|
|
|
184
187
|
return None
|
|
185
188
|
|
|
186
189
|
|
|
190
|
+
def clean_output(text: str):
|
|
191
|
+
text = re.sub(r"\x1b\[[0-9;]*[A-Za-z]", "", text)
|
|
192
|
+
|
|
193
|
+
text = re.sub(r"<think>.*?</think>", "", text, flags=re.DOTALL)
|
|
194
|
+
|
|
195
|
+
text = re.sub(r"Thinking\.\.\..*?\.\.\.done thinking\.", "", text, flags=re.DOTALL)
|
|
196
|
+
|
|
197
|
+
return text
|
|
198
|
+
|
|
199
|
+
|
|
187
200
|
def extract_json_object(text: str) -> Optional[Dict[str, Any]]:
|
|
188
201
|
"""
|
|
189
202
|
Robustly extract the first valid JSON object from model output.
|
|
@@ -199,7 +212,7 @@ def extract_json_object(text: str) -> Optional[Dict[str, Any]]:
|
|
|
199
212
|
- Nested objects: {"subscores": {"a": 1}}
|
|
200
213
|
"""
|
|
201
214
|
|
|
202
|
-
text =
|
|
215
|
+
text = clean_output(text)
|
|
203
216
|
|
|
204
217
|
fenced = re.search(r"```(?:json)?\s*(\{.*?\})\s*```", text, re.DOTALL)
|
|
205
218
|
if fenced:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|