Another attempt at fixing external numpad detection. I *think* some of them send numlock state with every event. If that's the case, this should fix it.

This commit is contained in:
Storm Dragon
2025-09-13 14:11:27 -04:00
parent 96cdda99c4
commit 2c38bcf5f4
7 changed files with 55 additions and 20 deletions

View File

@@ -43,11 +43,18 @@ if [ -n "$STAGED_PYTHON_FILES" ]; then
for file in $STAGED_PYTHON_FILES; do
if [ -f "$file" ]; then
# Check for unterminated strings (the main issue from the email)
if grep -n 'f".*{$' "$file" >/dev/null 2>&1; then
echo -e "${RED}✗ $file: Potential unterminated f-string${NC}"
# Check for broken f-strings (multiline issues that cause syntax errors)
# Pattern 1: f-string with opening brace at end of line (likely broken across lines)
if grep -n 'f"[^"]*{[^}]*$' "$file" >/dev/null 2>&1; then
echo -e "${RED}✗ $file: Potential broken multiline f-string${NC}"
grep -n 'f"[^"]*{[^}]*$' "$file" | head -3
ISSUES_FOUND=1
fi
# Pattern 2: Lines that end with just an opening brace (common in broken f-strings)
if grep -n '^\s*[^#]*{$' "$file" >/dev/null 2>&1; then
echo -e "${YELLOW}⚠ $file: Lines ending with lone opening brace (check f-strings)${NC}"
fi
# Check for missing imports that are commonly used
if grep -q 'debug\.DebugLevel\.' "$file" && ! grep -q 'from.*debug' "$file" && ! grep -q 'import.*debug' "$file"; then
@@ -110,7 +117,7 @@ if [ -n "$STAGED_PYTHON_FILES" ]; then
for file in $STAGED_PYTHON_FILES; do
if [ -f "$file" ]; then
# Check for potential passwords, keys, tokens
if grep -i -E '(password|passwd|pwd|key|token|secret|api_key).*=.*["\'][^"\']{8,}["\']' "$file" >/dev/null 2>&1; then
if grep -i -E '(password|passwd|pwd|key|token|secret|api_key).*=.*["'"'"'][^"'"'"']{8,}["'"'"']' "$file" >/dev/null 2>&1; then
echo -e "${RED}✗ $file: Potential hardcoded secret detected${NC}"
SECRETS_FOUND=1
fi
@@ -126,7 +133,7 @@ else
fi
# Summary
echo -e "\n${'='*50}"
echo -e "\n=================================================="
if [ $VALIDATION_FAILED -eq 0 ]; then
echo -e "${GREEN}✓ All pre-commit validations passed${NC}"
echo -e "${GREEN}Commit allowed to proceed${NC}"