mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-23 18:17:53 -06:00
refactor: public names for cross-module reads
This commit is contained in:
1 parent
f371790dc6
commit
3853ca2f1c
254 files changed
+2955
-2969
No files matched your search
@@ -15,7 +15,7 @@ import yaml
|
||||
|
||||
from core import upstream
|
||||
from core.hashing import parse_hash_list
|
||||
from model.sourceref import RefPart, _prose_runs, ref_prose_text, ref_role, source_ref_values
|
||||
from model.sourceref import RefPart, prose_runs, ref_prose_text, ref_role, source_ref_values
|
||||
from profiling.repos import declared_repositories
|
||||
|
||||
|
||||
@@ -155,7 +155,7 @@ def symlink_target(path: str, lines: list[str] | None) -> str | None:
|
||||
return None if resolved.startswith("..") or resolved == path else resolved
|
||||
|
||||
|
||||
def _anchor_tokens(entry: dict) -> list[str]:
|
||||
def anchor_tokens(entry: dict) -> list[str]:
|
||||
"""Values worth searching for when a cited line misses its subject.
|
||||
|
||||
Both the content values and the set name are searched, because profiles
|
||||
@@ -309,7 +309,7 @@ def comment_citations(
|
||||
continue
|
||||
comment = line[column + 1:].rstrip("\r\n")
|
||||
shift = column + 1
|
||||
for _, path_span, run_spans, parts, run, _ in _prose_runs(comment, known):
|
||||
for _, path_span, run_spans, parts, run, _ in prose_runs(comment, known):
|
||||
citations.append(Citation(
|
||||
field=f"comment line {number + 1}", kind="prose", ref=run,
|
||||
line=number,
|
||||
@@ -346,7 +346,7 @@ def collect_citations(document: dict, text: str | None = None) -> list[Citation]
|
||||
holder=holder, key=key, label=label,
|
||||
))
|
||||
if isinstance(value, str):
|
||||
for line, path_span, spans, parts, run, joined_at in _prose_runs(
|
||||
for line, path_span, spans, parts, run, joined_at in prose_runs(
|
||||
ref_prose_text(value), known
|
||||
):
|
||||
citations.append(Citation(
|
||||
@@ -355,7 +355,7 @@ def collect_citations(document: dict, text: str | None = None) -> list[Citation]
|
||||
parts=parts, wrapped=bool(joined_at), joined_at=joined_at,
|
||||
))
|
||||
continue
|
||||
for line, path_span, spans, parts, run, joined_at in _prose_runs(
|
||||
for line, path_span, spans, parts, run, joined_at in prose_runs(
|
||||
value, known
|
||||
):
|
||||
citations.append(Citation(
|
||||
@@ -368,7 +368,7 @@ def collect_citations(document: dict, text: str | None = None) -> list[Citation]
|
||||
return citations
|
||||
|
||||
|
||||
def _citation_key(ref: str) -> str:
|
||||
def citation_key(ref: str) -> str:
|
||||
"""A citation compared without the spacing the author chose.
|
||||
|
||||
A recale rewrites the located tokens and leaves the sentence alone, so
|
||||
|
||||
@@ -194,20 +194,20 @@ def tree_diff(result: CompareResult, ref_dirs: set[str]) -> list[str]:
|
||||
return lines
|
||||
|
||||
|
||||
def _cited_paths(report: ProfileReport) -> list[str]:
|
||||
def cited_paths(report: ProfileReport) -> list[str]:
|
||||
return sorted(
|
||||
{part.new_path or part.part.path for e in report.entries for part in e.parts}
|
||||
)
|
||||
|
||||
|
||||
def _detect(
|
||||
def detect_upstream_changes(
|
||||
args: argparse.Namespace, profile: dict, report: ProfileReport,
|
||||
repo: upstream.Repo,
|
||||
) -> None:
|
||||
names, hashes = declared_names(profile), declared_hashes(profile)
|
||||
new_files: list[dict] = []
|
||||
new_hashes: list[dict] = []
|
||||
for path in _cited_paths(report):
|
||||
for path in cited_paths(report):
|
||||
head_lines = upstream.fetch_file(
|
||||
repo, report.head, path, args.cache_dir, args.offline
|
||||
)
|
||||
@@ -259,7 +259,7 @@ def _print_detection(report: ProfileReport) -> None:
|
||||
print(f" new {item['kind']}: {item['path']} {item['value']}")
|
||||
|
||||
|
||||
def _print_extras(
|
||||
def print_extras(
|
||||
args: argparse.Namespace, profile: dict, report: ProfileReport
|
||||
) -> None:
|
||||
"""Optional per-profile sections beyond the ref report.
|
||||
@@ -288,7 +288,7 @@ def _print_extras_from(
|
||||
repo: upstream.Repo,
|
||||
) -> None:
|
||||
if args.full_diff:
|
||||
for path in _cited_paths(report):
|
||||
for path in cited_paths(report):
|
||||
if args.ref and args.ref not in path:
|
||||
continue
|
||||
pin_lines = (
|
||||
@@ -312,6 +312,6 @@ def _print_extras_from(
|
||||
)
|
||||
# The repository root is a directory like any other: dropping the
|
||||
# empty dirname would turn the filter off and list the whole tree.
|
||||
ref_dirs = {posixpath.dirname(p) for p in _cited_paths(report)}
|
||||
ref_dirs = {posixpath.dirname(p) for p in cited_paths(report)}
|
||||
for line in tree_diff(comparison, ref_dirs):
|
||||
print(f" {line}")
|
||||
@@ -15,7 +15,7 @@ from profiling.citations import Citation
|
||||
_RANGE_TOKEN_RE = re.compile(r"\d+(?:-\d+)?")
|
||||
|
||||
|
||||
def _run_after_moves(
|
||||
def run_after_moves(
|
||||
parts: Sequence[RefPart],
|
||||
moves: dict[int, tuple[int, int, str | None]],
|
||||
run: str = "",
|
||||
@@ -108,7 +108,7 @@ def _scalar(holder: object, key: object) -> object:
|
||||
raise TypeError(f"no scalar under {key!r} in a {type(holder).__name__}")
|
||||
|
||||
|
||||
def _set_scalar(holder: object, key: object, value: str) -> None:
|
||||
def set_scalar(holder: object, key: object, value: str) -> None:
|
||||
"""Replace the value a citation's holder keeps under its key."""
|
||||
if isinstance(holder, dict):
|
||||
holder[key] = value
|
||||
@@ -275,7 +275,7 @@ def _edit_scalar_run(
|
||||
edits.applied.append(f"{citation.field}: {citation.ref} -> {recaled}")
|
||||
|
||||
|
||||
def _apply_prose_edits(
|
||||
def apply_prose_edits(
|
||||
text: str, jobs: list[tuple[Citation, dict]], document: object = None
|
||||
) -> tuple[str, list[str], list[str]]:
|
||||
"""Rewrite prose citation tokens in place, nothing else.
|
||||
@@ -297,7 +297,7 @@ def _apply_prose_edits(
|
||||
|
||||
for citation, moves in jobs:
|
||||
replacements = _prose_replacements(citation, moves)
|
||||
recaled = _run_after_moves(citation.parts, moves, citation.ref)
|
||||
recaled = run_after_moves(citation.parts, moves, citation.ref)
|
||||
if citation.in_comment:
|
||||
_edit_comment_run(edits, citation, replacements, recaled)
|
||||
else:
|
||||
@@ -311,7 +311,7 @@ def _apply_prose_edits(
|
||||
value_lines = value.splitlines()
|
||||
for line_number, spans in by_line.items():
|
||||
value_lines[line_number] = _replace_spans(value_lines[line_number], spans)
|
||||
_set_scalar(holder, key, "\n".join(value_lines) + (
|
||||
set_scalar(holder, key, "\n".join(value_lines) + (
|
||||
"\n" if value.endswith("\n") else ""
|
||||
))
|
||||
return "\n".join(lines) + trailing, edits.applied, edits.left
|
||||
|
||||
@@ -14,8 +14,8 @@ import yaml
|
||||
from core import upstream
|
||||
from model.sourceref import RefPart
|
||||
from profiling.anchoring import anchor_block
|
||||
from profiling.citations import Citation, _citation_key, collect_citations, is_external_citation
|
||||
from profiling.proseedit import _apply_prose_edits, _run_after_moves
|
||||
from profiling.citations import Citation, citation_key, collect_citations, is_external_citation
|
||||
from profiling.proseedit import apply_prose_edits, run_after_moves
|
||||
from profiling.repos import declared_repositories
|
||||
from profiling.yamledit import apply_edit
|
||||
|
||||
@@ -383,7 +383,7 @@ class _ProseHistory:
|
||||
|
||||
def _carried_by(past: dict) -> set[tuple[str, str]]:
|
||||
return {
|
||||
(c.field, _citation_key(c.ref))
|
||||
(c.field, citation_key(c.ref))
|
||||
for c in collect_citations(past) if c.kind == "prose"
|
||||
}
|
||||
|
||||
@@ -510,18 +510,18 @@ def realign_prose(
|
||||
# one of its citations is corrected by hand, and dating the whole field
|
||||
# from that commit put idtech4a++'s untouched Game.java:69-72 under the
|
||||
# current pin, so the stale range was never offered again.
|
||||
keys = [(c.field, _citation_key(c.ref)) for c in citations]
|
||||
keys = [(c.field, citation_key(c.ref)) for c in citations]
|
||||
dated = _date_prose(path, document, keys, history)
|
||||
messages, jobs = _prose_jobs(document, citations, dated, declared, cache_dir, offline)
|
||||
|
||||
if dry_run:
|
||||
messages.extend(
|
||||
f"would recale {citation.field}: {citation.ref} -> "
|
||||
f"{_run_after_moves(citation.parts, moves, citation.ref)}"
|
||||
f"{run_after_moves(citation.parts, moves, citation.ref)}"
|
||||
for citation, moves in jobs
|
||||
)
|
||||
return messages
|
||||
new_text, applied, left = _apply_prose_edits(text, jobs, document)
|
||||
new_text, applied, left = apply_prose_edits(text, jobs, document)
|
||||
messages.extend(applied)
|
||||
messages.extend(f"left in place: {item}" for item in left)
|
||||
if applied:
|
||||
|
||||
+16
-16
@@ -10,9 +10,9 @@ import yaml
|
||||
from core import upstream
|
||||
from model.sourceref import ref_role, split_outside_parentheses, split_source_ref
|
||||
from profiling.anchoring import PartResult, REBASE_STATUSES, REVIEW_STATUSES
|
||||
from profiling.citations import Citation, _citation_key, collect_citations
|
||||
from profiling.proseedit import _apply_prose_edits, _run_after_moves, _set_scalar
|
||||
from profiling.reports import EntryReport, ProfileReport, _original_part, _rendered_part
|
||||
from profiling.citations import Citation, citation_key, collect_citations
|
||||
from profiling.proseedit import apply_prose_edits, run_after_moves, set_scalar
|
||||
from profiling.reports import EntryReport, ProfileReport, original_part, rendered_part
|
||||
from profiling.repos import declared_repositories
|
||||
from profiling.yamledit import YamlWriteError, apply_edit, find_field_line, replace_field_line
|
||||
|
||||
@@ -107,7 +107,7 @@ def pin_blockers(report: ProfileReport, accept_changed: bool = False) -> list[st
|
||||
if not any(
|
||||
part.status in movable
|
||||
and part.start is not None
|
||||
and _rendered_part(part) != _original_part(part)
|
||||
and rendered_part(part) != original_part(part)
|
||||
for part in entry.parts
|
||||
):
|
||||
continue
|
||||
@@ -156,7 +156,7 @@ def attribute_refs(path: Path, report: ProfileReport, profile: dict) -> list[str
|
||||
continue
|
||||
rendered = []
|
||||
for part in entry.parts:
|
||||
raw = part.part.raw or _original_part(part)
|
||||
raw = part.part.raw or original_part(part)
|
||||
role, bare = ref_role(raw)
|
||||
written_path = bare.startswith(part.part.path)
|
||||
owner = role_of.get(part.repo or "", primary) if part.repo else primary
|
||||
@@ -185,7 +185,7 @@ def _moved_by_hand(entry: EntryReport, statuses: tuple[str, ...]) -> bool:
|
||||
return any(
|
||||
part.status in statuses
|
||||
and part.start is not None
|
||||
and _rendered_part(part) != _original_part(part)
|
||||
and rendered_part(part) != original_part(part)
|
||||
for part in entry.parts
|
||||
)
|
||||
|
||||
@@ -196,12 +196,12 @@ def _recaled_ref(entry: EntryReport, statuses: tuple[str, ...]) -> str | None:
|
||||
touched = False
|
||||
for part in entry.parts:
|
||||
if part.status in statuses and part.start is not None:
|
||||
recaled = _rendered_part(part)
|
||||
if recaled != _original_part(part):
|
||||
recaled = rendered_part(part)
|
||||
if recaled != original_part(part):
|
||||
touched = True
|
||||
rendered.append(recaled)
|
||||
else:
|
||||
rendered.append(_original_part(part))
|
||||
rendered.append(original_part(part))
|
||||
return ", ".join(rendered) if touched else None
|
||||
|
||||
|
||||
@@ -285,10 +285,10 @@ def rebase_refs(
|
||||
text, "source_ref", entry.source_ref, new_ref, cursor
|
||||
)
|
||||
cursor = index + 1
|
||||
_set_scalar(citation.holder, citation.key, new_ref)
|
||||
set_scalar(citation.holder, citation.key, new_ref)
|
||||
applied.append(f"{entry.source_ref} -> {new_ref}")
|
||||
|
||||
text, prose_applied, left = _apply_prose_edits(text, prose_jobs, document)
|
||||
text, prose_applied, left = apply_prose_edits(text, prose_jobs, document)
|
||||
refused.extend(left)
|
||||
if refused:
|
||||
# A citation left on the pinned lines holds the pin, so writing the
|
||||
@@ -336,7 +336,7 @@ def _pending_refs(
|
||||
for part in entry.parts
|
||||
if part.status in movable
|
||||
and part.start is not None
|
||||
and _rendered_part(part) != _original_part(part)
|
||||
and rendered_part(part) != original_part(part)
|
||||
)
|
||||
return pending
|
||||
|
||||
@@ -348,7 +348,7 @@ def _pending_prose(
|
||||
pool: dict[tuple[str, str], int] = {}
|
||||
for citation in collect_citations(document, text):
|
||||
if citation.kind == "prose":
|
||||
slot = (citation.field, _citation_key(citation.ref))
|
||||
slot = (citation.field, citation_key(citation.ref))
|
||||
pool[slot] = pool.get(slot, 0) + 1
|
||||
pending = 0
|
||||
for entry in report.entries or []:
|
||||
@@ -361,12 +361,12 @@ def _pending_prose(
|
||||
if any(_part_moves(part, movable) for part in entry.parts):
|
||||
pending += 1
|
||||
continue
|
||||
rendered = _run_after_moves(
|
||||
rendered = run_after_moves(
|
||||
[p.part for p in entry.parts], moves, entry.source_ref
|
||||
)
|
||||
if _citation_key(rendered) == _citation_key(entry.source_ref):
|
||||
if citation_key(rendered) == citation_key(entry.source_ref):
|
||||
continue
|
||||
slot = (entry.field, _citation_key(rendered))
|
||||
slot = (entry.field, citation_key(rendered))
|
||||
if pool.get(slot, 0) > 0:
|
||||
pool[slot] -= 1
|
||||
continue
|
||||
|
||||
@@ -5,7 +5,7 @@ from __future__ import annotations
|
||||
from dataclasses import asdict, dataclass, field
|
||||
|
||||
from core import upstream
|
||||
from model.sourceref import _ANNOTATION_RE, _trim_prose
|
||||
from model.sourceref import ANNOTATION_RE, trim_prose
|
||||
from profiling.anchoring import PartResult, REVIEW_STATUSES
|
||||
from profiling.versions import VersionReport
|
||||
|
||||
@@ -142,20 +142,20 @@ def _render_span(path: str, start: int | None, end: int | None) -> str:
|
||||
return f"{path}:{start}"
|
||||
|
||||
|
||||
def _original_part(part: PartResult) -> str:
|
||||
def original_part(part: PartResult) -> str:
|
||||
"""The part exactly as the profile writes it today."""
|
||||
return part.part.raw or _render_span(
|
||||
part.part.path, part.part.start, part.part.end
|
||||
)
|
||||
|
||||
|
||||
def _rendered_part(part: PartResult) -> str:
|
||||
def rendered_part(part: PartResult) -> str:
|
||||
"""The part rewritten onto its new location, annotation preserved."""
|
||||
span = _render_span(part.new_path or part.part.path, part.start, part.end)
|
||||
raw = part.part.raw
|
||||
if not raw:
|
||||
return span
|
||||
located = _trim_prose(_ANNOTATION_RE.sub("", raw).strip())
|
||||
located = trim_prose(ANNOTATION_RE.sub("", raw).strip())
|
||||
# `stella src/emucore/Cart.cxx:120` names the repository the lines are
|
||||
# in. The path was read without that word, and a recale wrote it back
|
||||
# without it: the attribution went with the old line numbers.
|
||||
@@ -182,7 +182,7 @@ def _part_line(part: PartResult) -> str:
|
||||
detail += f" ({part.reason})"
|
||||
if part.repo:
|
||||
detail += f" [{part.repo}]"
|
||||
return f" {_original_part(part)} {detail}"
|
||||
return f" {original_part(part)} {detail}"
|
||||
|
||||
|
||||
def _report_header(report: ProfileReport) -> list[str]:
|
||||
|
||||
@@ -407,6 +407,6 @@ def build_revision(profile: dict, platform: str) -> str | None:
|
||||
return None
|
||||
|
||||
|
||||
def _on_own_revision(view: RepoView, tagged: dict[tuple[str, str], str]) -> bool:
|
||||
def reads_own_revision(view: RepoView, tagged: dict[tuple[str, str], str]) -> bool:
|
||||
"""Whether a view is read at its own revision: on HEAD, or on its tag."""
|
||||
return view.pin == view.head or (view.repo.host, view.repo.slug) in tagged
|
||||
@@ -29,7 +29,7 @@ from profiling.anchoring import (
|
||||
)
|
||||
from profiling.citations import (
|
||||
Citation,
|
||||
_anchor_tokens,
|
||||
anchor_tokens,
|
||||
cites_another_version,
|
||||
collect_citations,
|
||||
entry_hashes,
|
||||
@@ -42,7 +42,7 @@ from profiling.reports import EntryReport, ProfileReport
|
||||
from profiling.repos import (
|
||||
PIN,
|
||||
RepoView,
|
||||
_on_own_revision,
|
||||
reads_own_revision,
|
||||
build_revision,
|
||||
declared_repositories,
|
||||
detect_pinned_tag,
|
||||
@@ -187,7 +187,7 @@ def _gather_refs(
|
||||
for p in split_source_ref(citation.ref)
|
||||
]
|
||||
refs.append((
|
||||
display, citation.ref, _anchor_tokens(entry),
|
||||
display, citation.ref, anchor_tokens(entry),
|
||||
entry_hashes(entry), parts, citation,
|
||||
))
|
||||
else:
|
||||
@@ -314,7 +314,7 @@ def _record_revisions(
|
||||
report.orphaned = [
|
||||
f"{view.repo.slug}: pin {view.pin[:8]} is no ancestor of {view.head[:8]}"
|
||||
for view in views
|
||||
if not _on_own_revision(view, tagged)
|
||||
if not reads_own_revision(view, tagged)
|
||||
and upstream.compare(
|
||||
view.repo, view.pin, view.head, cache_dir, offline
|
||||
).diverged
|
||||
@@ -397,7 +397,7 @@ class _Resolver:
|
||||
return next(iter(lent)) if len(lent) == 1 else ""
|
||||
|
||||
def on_own_revision(self, view: RepoView) -> bool:
|
||||
return _on_own_revision(view, self.tagged)
|
||||
return reads_own_revision(view, self.tagged)
|
||||
|
||||
def trees_in_order(self) -> Iterable[list[str] | None]:
|
||||
"""Pin trees before HEAD trees, each read only when reached."""
|
||||
|
||||
+13
-13
@@ -13,7 +13,7 @@ import yaml
|
||||
|
||||
from core import upstream
|
||||
from profiling.bump import bump_commit, pins_changed
|
||||
from profiling.detection import _detect, _print_extras
|
||||
from profiling.detection import detect_upstream_changes, print_extras
|
||||
from profiling.realign import realign_prose
|
||||
from profiling.rebase import attribute_refs, rebase_refs
|
||||
from profiling.reports import (
|
||||
@@ -25,10 +25,10 @@ from profiling.reports import (
|
||||
)
|
||||
from profiling.repos import select_repo
|
||||
from profiling.resolver import build_report
|
||||
from profiling.triage import _print_triage
|
||||
from profiling.triage import print_triage
|
||||
from profiling.versions import (
|
||||
_newer_release,
|
||||
_passed_release,
|
||||
newer_release,
|
||||
latest_passed_release,
|
||||
check_version,
|
||||
page_version,
|
||||
version_warning,
|
||||
@@ -135,7 +135,7 @@ def _promote(
|
||||
file=sys.stderr,
|
||||
)
|
||||
return False
|
||||
_WRITTEN.add(name)
|
||||
WRITTEN_PROFILES.add(name)
|
||||
return True
|
||||
|
||||
|
||||
@@ -254,7 +254,7 @@ def _attach_detection(
|
||||
if repo is None:
|
||||
return
|
||||
try:
|
||||
_detect(args, profile, report, repo)
|
||||
detect_upstream_changes(args, profile, report, repo)
|
||||
except upstream.RateLimitError:
|
||||
raise
|
||||
except upstream.UpstreamError as exc:
|
||||
@@ -287,8 +287,8 @@ def _attach_version(
|
||||
relation = upstream.ancestry(
|
||||
repo, version.tag_commit, report.pin, args.cache_dir, args.offline
|
||||
)
|
||||
passed = _passed_release(args, repo, version, report.pin)
|
||||
newer = None if passed or profile.get("pin_frozen") else _newer_release(
|
||||
passed = latest_passed_release(args, repo, version, report.pin)
|
||||
newer = None if passed or profile.get("pin_frozen") else newer_release(
|
||||
args, repo, version, report.pin
|
||||
)
|
||||
except upstream.RateLimitError:
|
||||
@@ -303,7 +303,7 @@ def _attach_version(
|
||||
)
|
||||
|
||||
|
||||
def _read_one(
|
||||
def read_one_profile(
|
||||
args: argparse.Namespace,
|
||||
name: str,
|
||||
profile: dict,
|
||||
@@ -344,7 +344,7 @@ def _read_one(
|
||||
|
||||
# Profiles this run wrote. Their new pins name trees the site's record of
|
||||
# cited source paths does not hold yet.
|
||||
_WRITTEN: set[str] = set()
|
||||
WRITTEN_PROFILES: set[str] = set()
|
||||
|
||||
|
||||
def _build_full_report(
|
||||
@@ -402,7 +402,7 @@ def _build_full_report(
|
||||
return report
|
||||
|
||||
|
||||
def _emit(
|
||||
def emit_reports(
|
||||
args: argparse.Namespace,
|
||||
selected: dict,
|
||||
reports: list[ProfileReport],
|
||||
@@ -425,10 +425,10 @@ def _emit(
|
||||
print(url)
|
||||
return None
|
||||
if args.triage:
|
||||
return _print_triage(args, selected, shown)
|
||||
return print_triage(args, selected, shown)
|
||||
for report in shown:
|
||||
print(format_report(report, args.changed_only))
|
||||
_print_extras(args, selected[report.name], report)
|
||||
print_extras(args, selected[report.name], report)
|
||||
print()
|
||||
if args.changed_only:
|
||||
_print_elided(reports, len(shown), frozenset(report.name for report in shown))
|
||||
|
||||
@@ -7,7 +7,7 @@ import sys
|
||||
import time
|
||||
|
||||
from core import upstream
|
||||
from profiling.detection import _cited_paths
|
||||
from profiling.detection import cited_paths
|
||||
from profiling.reports import ProfileReport, triage_state
|
||||
from profiling.repos import select_repo
|
||||
from profiling.versions import VersionReport, check_version
|
||||
@@ -51,7 +51,7 @@ def drift_score(
|
||||
return score
|
||||
|
||||
|
||||
class _Progress:
|
||||
class Progress:
|
||||
"""A stderr line every PROGRESS_SECONDS while a pass asks the forges."""
|
||||
|
||||
def __init__(self, total: int, doing: str, quiet: bool) -> None:
|
||||
@@ -65,25 +65,25 @@ class _Progress:
|
||||
self.last = now
|
||||
|
||||
|
||||
def _interrupted(done: int, total: int, what: str) -> None:
|
||||
def print_interrupted(done: int, total: int, what: str) -> None:
|
||||
print(f"interrupted after {done} of {total} profiles: {what}", file=sys.stderr, flush=True)
|
||||
|
||||
|
||||
def _print_triage(
|
||||
def print_triage(
|
||||
args: argparse.Namespace, selected: dict, reports: list[ProfileReport]
|
||||
) -> bool:
|
||||
"""Profiles ranked by drift, worst first. False when Ctrl-C cut the
|
||||
scoring short: the ranking then covers the profiles scored."""
|
||||
ranked: list[tuple[int, ProfileReport, str]] = []
|
||||
sampled = 0
|
||||
progress = _Progress(len(reports), "scored", args.offline or len(reports) < 2)
|
||||
progress = Progress(len(reports), "scored", args.offline or len(reports) < 2)
|
||||
complete = True
|
||||
try:
|
||||
for done, report in enumerate(reports):
|
||||
progress.step(done, report.name)
|
||||
sampled += _score(args, selected, report, ranked)
|
||||
except KeyboardInterrupt:
|
||||
_interrupted(len(ranked), len(reports), "the ranking covers those scored")
|
||||
print_interrupted(len(ranked), len(reports), "the ranking covers those scored")
|
||||
complete = False
|
||||
if sampled:
|
||||
# One line for the run: a notice per profile buried the ranking
|
||||
@@ -117,7 +117,7 @@ def _score(
|
||||
sampled = False
|
||||
repo = select_repo(profile)
|
||||
if report.head and repo is not None:
|
||||
paths = _cited_paths(report)
|
||||
paths = cited_paths(report)
|
||||
try:
|
||||
version = check_version(profile, repo, args.cache_dir, args.offline)
|
||||
for path in paths[:TRIAGE_PATH_SAMPLE]:
|
||||
|
||||
@@ -149,7 +149,7 @@ def _later_number(candidate: str, declared: str) -> bool:
|
||||
return high[0] == low[0] and high > low
|
||||
|
||||
|
||||
def _newer_release(
|
||||
def newer_release(
|
||||
args: argparse.Namespace,
|
||||
repo: upstream.Repo,
|
||||
version: VersionReport | None,
|
||||
@@ -178,7 +178,7 @@ def _newer_release(
|
||||
return published
|
||||
|
||||
|
||||
def _passed_release(
|
||||
def latest_passed_release(
|
||||
args: argparse.Namespace,
|
||||
repo: upstream.Repo,
|
||||
version: VersionReport | None,
|
||||
|
||||
Reference in new issue
Block a user