Coverage for little_loops/issue_history/_utils.py: 0%

1"""Shared utilities for issue_history sub-modules."""

2

3 from __future__ import annotations

4

5 from pathlib import Path

6

7 from little_loops.issue_history.models import CompletedIssue

8

9

10 def get_issue_content(issue: CompletedIssue, contents: dict[Path, str] | None) -> str | None:

11 """Retrieve issue content from cache or filesystem.

12

13 Args:

14 issue: The completed issue to retrieve content for

15 contents: Optional pre-loaded content cache (path -> content)

16

17 Returns:

18 Issue file content string, or None if unavailable

19 """

20 if contents is not None and issue.path in contents:

21 return contents[issue.path]

22 try:

23 return issue.path.read_text(encoding="utf-8")

24 except Exception:

25 return None