devops-analyzer 0.1.1__tar.gz → 0.1.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.
- {devops_analyzer-0.1.1/devops_analyzer.egg-info → devops_analyzer-0.1.2}/PKG-INFO +1 -1
- {devops_analyzer-0.1.1 → devops_analyzer-0.1.2}/devops/analysis.py +3 -1
- devops_analyzer-0.1.2/devops/ui.py +41 -0
- {devops_analyzer-0.1.1 → devops_analyzer-0.1.2/devops_analyzer.egg-info}/PKG-INFO +1 -1
- {devops_analyzer-0.1.1 → devops_analyzer-0.1.2}/devops_analyzer.egg-info/SOURCES.txt +1 -0
- {devops_analyzer-0.1.1 → devops_analyzer-0.1.2}/pyproject.toml +1 -1
- {devops_analyzer-0.1.1 → devops_analyzer-0.1.2}/LICENSE +0 -0
- {devops_analyzer-0.1.1 → devops_analyzer-0.1.2}/MANIFEST.in +0 -0
- {devops_analyzer-0.1.1 → devops_analyzer-0.1.2}/README.md +0 -0
- {devops_analyzer-0.1.1 → devops_analyzer-0.1.2}/devops/__init__.py +0 -0
- {devops_analyzer-0.1.1 → devops_analyzer-0.1.2}/devops/__main__.py +0 -0
- {devops_analyzer-0.1.1 → devops_analyzer-0.1.2}/devops/cli.py +0 -0
- {devops_analyzer-0.1.1 → devops_analyzer-0.1.2}/devops/config.py +0 -0
- {devops_analyzer-0.1.1 → devops_analyzer-0.1.2}/devops/config_cmd.py +0 -0
- {devops_analyzer-0.1.1 → devops_analyzer-0.1.2}/devops/extract.py +0 -0
- {devops_analyzer-0.1.1 → devops_analyzer-0.1.2}/devops/models/__init__.py +0 -0
- {devops_analyzer-0.1.1 → devops_analyzer-0.1.2}/devops/models/base.py +0 -0
- {devops_analyzer-0.1.1 → devops_analyzer-0.1.2}/devops/models/openai.py +0 -0
- {devops_analyzer-0.1.1 → devops_analyzer-0.1.2}/devops/models/zhipuai.py +0 -0
- {devops_analyzer-0.1.1 → devops_analyzer-0.1.2}/devops/scan/__init__.py +0 -0
- {devops_analyzer-0.1.1 → devops_analyzer-0.1.2}/devops/scan/scan.cpp +0 -0
- {devops_analyzer-0.1.1 → devops_analyzer-0.1.2}/devops/scan/scan.h +0 -0
- {devops_analyzer-0.1.1 → devops_analyzer-0.1.2}/devops/scan/scan_bindings.cpp +0 -0
- {devops_analyzer-0.1.1 → devops_analyzer-0.1.2}/devops_analyzer.egg-info/dependency_links.txt +0 -0
- {devops_analyzer-0.1.1 → devops_analyzer-0.1.2}/devops_analyzer.egg-info/entry_points.txt +0 -0
- {devops_analyzer-0.1.1 → devops_analyzer-0.1.2}/devops_analyzer.egg-info/not-zip-safe +0 -0
- {devops_analyzer-0.1.1 → devops_analyzer-0.1.2}/devops_analyzer.egg-info/requires.txt +0 -0
- {devops_analyzer-0.1.1 → devops_analyzer-0.1.2}/devops_analyzer.egg-info/top_level.txt +0 -0
- {devops_analyzer-0.1.1 → devops_analyzer-0.1.2}/requirements.txt +0 -0
- {devops_analyzer-0.1.1 → devops_analyzer-0.1.2}/setup.cfg +0 -0
- {devops_analyzer-0.1.1 → devops_analyzer-0.1.2}/setup.py +0 -0
|
@@ -9,6 +9,7 @@ from typing import Any
|
|
|
9
9
|
|
|
10
10
|
from devops.extract import CodeBlock, extract_blocks_from_paths
|
|
11
11
|
from devops.models import BaseChatModel, get_chat_model
|
|
12
|
+
from devops.ui import thinking
|
|
12
13
|
|
|
13
14
|
MAX_CODE_LINES = 80
|
|
14
15
|
MAX_CHARS_PER_REQUEST = 24_000
|
|
@@ -44,7 +45,8 @@ def _format_blocks_for_prompt(blocks: list[CodeBlock]) -> str:
|
|
|
44
45
|
|
|
45
46
|
|
|
46
47
|
def _chat(model: BaseChatModel, prompt: str) -> str:
|
|
47
|
-
|
|
48
|
+
with thinking():
|
|
49
|
+
return model.chat(SYSTEM_PROMPT, prompt, temperature=0.2)
|
|
48
50
|
|
|
49
51
|
|
|
50
52
|
def analyze_blocks(
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"""终端 UI 辅助(等待动画等)。"""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import sys
|
|
6
|
+
import threading
|
|
7
|
+
from contextlib import contextmanager
|
|
8
|
+
from typing import Iterator
|
|
9
|
+
|
|
10
|
+
_SPINNER = ("⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏")
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
@contextmanager
|
|
14
|
+
def thinking(message: str = "thinking") -> Iterator[None]:
|
|
15
|
+
"""在阻塞操作期间于 stderr 显示转圈与文案。"""
|
|
16
|
+
if not sys.stderr.isatty():
|
|
17
|
+
print(f"{message}...", file=sys.stderr, flush=True)
|
|
18
|
+
yield
|
|
19
|
+
return
|
|
20
|
+
|
|
21
|
+
stop = threading.Event()
|
|
22
|
+
prefix = f"{message} "
|
|
23
|
+
|
|
24
|
+
def _spin() -> None:
|
|
25
|
+
i = 0
|
|
26
|
+
while not stop.wait(0.08):
|
|
27
|
+
frame = _SPINNER[i % len(_SPINNER)]
|
|
28
|
+
sys.stderr.write(f"\r{frame} {prefix}")
|
|
29
|
+
sys.stderr.flush()
|
|
30
|
+
i += 1
|
|
31
|
+
|
|
32
|
+
thread = threading.Thread(target=_spin, daemon=True)
|
|
33
|
+
thread.start()
|
|
34
|
+
try:
|
|
35
|
+
yield
|
|
36
|
+
finally:
|
|
37
|
+
stop.set()
|
|
38
|
+
thread.join(timeout=0.5)
|
|
39
|
+
clear = "\r" + " " * (len(prefix) + 2) + "\r"
|
|
40
|
+
sys.stderr.write(clear)
|
|
41
|
+
sys.stderr.flush()
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{devops_analyzer-0.1.1 → devops_analyzer-0.1.2}/devops_analyzer.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|