Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
12 changes: 5 additions & 7 deletions completion.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,22 @@
from tempfile import TemporaryDirectory

import git
import urllib3
from potodo import potodo


@cache
def branches_from_devguide(devguide_dir: Path) -> list[str]:
p = devguide_dir.joinpath('include/release-cycle.json')
data = json.loads(p.read_text())
def branches_from_peps() -> list[str]:
resp = urllib3.request('GET', 'https://peps.python.org/api/release-cycle.json')
data = json.loads(resp.data.decode('utf-8'))
return [
branch for branch in data if data[branch]['status'] in ('bugfix', 'security')
]


def get_completion(clones_dir: str, repo: str) -> tuple[float, str, float]:
clone_path = Path(clones_dir, 'translations', repo)
for branch in branches_from_devguide(Path(clones_dir, 'devguide')) + [
'master',
'main',
]:
for branch in branches_from_peps() + ['master', 'main']:
try:
clone_repo = git.Repo.clone_from(
f'https://github.com/{repo}.git', clone_path, branch=branch
Expand Down
4 changes: 2 additions & 2 deletions generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import translated_names
import contribute
from completion import branches_from_devguide, get_completion
from completion import branches_from_peps, get_completion
from repositories import Language, get_languages_and_repos

generation_time = datetime.now(timezone.utc)
Expand All @@ -27,7 +27,7 @@ def get_completion_progress() -> Iterator['LanguageProjectData']:
devguide_dir := Path(clones_dir, 'devguide'),
depth=1,
)
latest_branch = branches_from_devguide(devguide_dir)[0]
latest_branch = branches_from_peps()[0]
Repo.clone_from(
'https://github.com/python/cpython.git',
cpython_dir := Path(clones_dir, 'cpython'),
Expand Down
Loading