Skip to content
Merged
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
16 changes: 15 additions & 1 deletion completion.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,25 @@

import git
from potodo import potodo
import requests


def branches_from_devguide() -> list[str]:
r = requests.get(
"https://raw.githubusercontent.com/"
"python/devguide/main/include/release-cycle.json",
timeout=10,
)
data = r.json()
return [
branch for branch in data if data[branch]["status"] in ("bugfix", "security")
]


def get_completion_and_branch(tmpdir: str, language: str) -> tuple[float, str]:
clone_path = pathlib.Path(tmpdir, language)
for branch in ('3.13', '3.12', '3.11', '3.10', '3.9'):

for branch in branches_from_devguide():
try:
git.Repo.clone_from(f'https://github.com/python/python-docs-{language}.git', clone_path, depth=1, branch=branch)
except git.GitCommandError:
Expand Down
Loading