From 196d9f12f3af56a5b8c567cfef3b853bd81c0752 Mon Sep 17 00:00:00 2001 From: Ed_ Date: Sat, 28 Feb 2026 00:23:47 -0500 Subject: [PATCH] hinters --- check_hints.py | 22 ++++++++++++++++++++++ check_hints_v2.py | 31 +++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 check_hints.py create mode 100644 check_hints_v2.py diff --git a/check_hints.py b/check_hints.py new file mode 100644 index 0000000..2735bcb --- /dev/null +++ b/check_hints.py @@ -0,0 +1,22 @@ +import re +import sys + +files = ['ai_client.py', 'aggregate.py', 'mcp_client.py', 'shell_runner.py'] +for file_path in files: + print(f"Checking {file_path}...") + with open(file_path, 'r', encoding='utf-8') as f: + lines = f.readlines() + for i, line in enumerate(lines): + if line.strip().startswith('def '): + if '->' not in line: + # Check next line if it's a multiline def + if '):' not in line: + full_def = line + j = i + 1 + while j < len(lines) and '):' not in lines[j-1]: + full_def += lines[j] + j += 1 + if '->' not in full_def: + print(f" Missing hint at line {i+1}: {line.strip()}") + else: + print(f" Missing hint at line {i+1}: {line.strip()}") diff --git a/check_hints_v2.py b/check_hints_v2.py new file mode 100644 index 0000000..1daf17f --- /dev/null +++ b/check_hints_v2.py @@ -0,0 +1,31 @@ +import re +import sys + +files = ['ai_client.py', 'aggregate.py', 'mcp_client.py', 'shell_runner.py'] +for file_path in files: + print(f"Checking {file_path}...") + with open(file_path, 'r', encoding='utf-8') as f: + content = f.read() + # Find all function definitions + # This regex is simplified and might miss some edge cases (like multi-line defs) + # But it's better than nothing. + defs = re.finditer(r'def\s+([a-zA-Z_][a-zA-Z0-9_]*)\s*\((.*?)\)\s*(->\s*.*?)?:', content, re.DOTALL) + for m in defs: + name = m.group(1) + args = m.group(2).strip() + ret = m.group(3) + + if not ret: + print(f" Missing return type: {name}({args})") + + # Check arguments + if args: + arg_list = [a.strip() for a in args.split(',')] + for arg in arg_list: + if not arg or arg == 'self' or arg == 'cls': + continue + if ':' not in arg and '=' not in arg: + print(f" Missing arg type: {name} -> {arg}") + elif ':' not in arg and '=' in arg: + # arg=val (missing type) + print(f" Missing arg type: {name} -> {arg}")