lib/utils/__init__.py

52 lines · 1317 bytes

 1"""Shared helpers for lib/ scripts. Re-exports the public API of each submodule.
 2
 3`.term` (logging/colors) is stdlib-only and always importable. The other
 4submodules need `requests`/`yaml`; some CI jobs install no extra deps, so those
 5imports are skipped there, letting `setup_logging()` work without them.
 6"""
 7
 8from .term import make_colors, setup_logging
 9
10try:
11    from .data import DATA_PATH, PROJECT_ROOT, iter_services, load_yaml, slugify
12    from .github import (
13        AI_BOT_AUTHORS,
14        commit_has_bot,
15        fetch_repo,
16        gh_get,
17        parse_github_field,
18        repo_age_days,
19        repo_has_license,
20        repo_is_archived,
21        repo_is_fork,
22        repo_pushed_days_ago,
23        repo_status,
24    )
25    from .http import DEFAULT_TIMEOUT, DEFAULT_USER_AGENT, check_url, make_session
26except ImportError:
27    pass
28
29__all__ = [
30    "AI_BOT_AUTHORS",
31    "DATA_PATH",
32    "DEFAULT_TIMEOUT",
33    "DEFAULT_USER_AGENT",
34    "PROJECT_ROOT",
35    "check_url",
36    "commit_has_bot",
37    "fetch_repo",
38    "gh_get",
39    "iter_services",
40    "load_yaml",
41    "make_colors",
42    "make_session",
43    "parse_github_field",
44    "repo_age_days",
45    "repo_has_license",
46    "repo_is_archived",
47    "repo_is_fork",
48    "repo_pushed_days_ago",
49    "repo_status",
50    "setup_logging",
51    "slugify",
52]