Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions ace/utils/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,13 @@
logger = get_logger(__name__, component="database")


def _enable_sqlite_wal_mode(dbapi_connection, connection_record):
"""Enable WAL mode for SQLite to support concurrent reads."""
def _enable_sqlite_wal_mode(dbapi_connection: any, connection_record: any) -> None:
"""Enable WAL mode for SQLite to support concurrent reads.

Args:
dbapi_connection: Database API connection object
connection_record: SQLAlchemy connection record
"""
if "sqlite" in str(connection_record):
cursor = dbapi_connection.cursor()
cursor.execute("PRAGMA journal_mode=WAL")
Expand Down
8 changes: 7 additions & 1 deletion ace/utils/embeddings.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,13 @@
_original_print = builtins.print


def _suppress_bitsandbytes_message(*args, **kwargs):
def _suppress_bitsandbytes_message(*args: any, **kwargs: any) -> None:
"""Suppress noisy bitsandbytes initialization messages.

Args:
*args: Positional arguments to print
**kwargs: Keyword arguments to print
"""
if len(args) == 1 and isinstance(args[0], str) and "cadam32bit_grad_fp32" in args[0]:
return
_original_print(*args, **kwargs)
Expand Down
7 changes: 6 additions & 1 deletion ace/utils/json_mode.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,14 @@ def _resolve_model(preferred: Optional[str] = None) -> Optional[str]:

@lru_cache(maxsize=1)
def _load_dspy():
"""Load DSPy module with error handling.

Returns:
dspy module if available, None otherwise
"""
try:
import dspy # type: ignore
except Exception as exc: # pragma: no cover - defensive import guard
except (ImportError, ModuleNotFoundError) as exc: # pragma: no cover - defensive import guard
logger.error("json_mode_adapter_unavailable", error=str(exc))
return None
return dspy
Expand Down
2 changes: 1 addition & 1 deletion examples/multiplication_analysis/difficulty_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def analyze_difficulty_distribution(session):
parts = problem.replace("×", "*").split("*")
a = int(parts[0].strip())
b = int(parts[1].strip())
except:
except (ValueError, IndexError, AttributeError):
continue

difficulty = calculate_problem_difficulty(a, b)
Expand Down