From 8327d960fc993bdf4b142bd825eba17010d8a073 Mon Sep 17 00:00:00 2001 From: Boris Verkhovskiy Date: Tue, 4 Apr 2023 12:06:13 +0100 Subject: [PATCH 1/2] Improve whats_left --signature output --- whats_left.py | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/whats_left.py b/whats_left.py index 0c1426bf96..82916582fe 100755 --- a/whats_left.py +++ b/whats_left.py @@ -34,8 +34,9 @@ implementation = platform.python_implementation() if implementation != "CPython": - sys.exit("whats_left.py must be run under CPython, got {implementation} instead") - + sys.exit(f"whats_left.py must be run under CPython, got {implementation} instead") +if sys.version_info[:2] < (3, 11): + sys.exit(f"whats_left.py must be run under CPython 3.11 or newer, got {implementation} {sys.version} instead") def parse_args(): parser = argparse.ArgumentParser(description="Process some integers.") @@ -483,11 +484,17 @@ def remove_one_indent(s): if args.signature: print("\n# mismatching signatures (warnings)") for modname, mismatched in result["mismatched_items"].items(): - for (item, rustpy_value, cpython_value) in mismatched: - if cpython_value == "ValueError('no signature found')": - continue # these items will never match - - print(f"{item} {rustpy_value} != {cpython_value}") + for i, (item, rustpy_value, cpython_value) in enumerate(mismatched): + if cpython_value and cpython_value.startswith("ValueError("): + continue # these items will never match + if rustpy_value is None or rustpy_value.startswith("ValueError("): + rustpy_value = f" {rustpy_value}" + print(f"{item}{rustpy_value}") + if cpython_value is None or cpython_value.startswith("ValueError("): + cpython_value = f" {cpython_value}" + print(f"{' ' * len(item)}{cpython_value}") + if i < len(mismatched) - 1: + print() if args.doc: print("\n# mismatching `__doc__`s (warnings)") From 1e9d19bedac6800fe56b33bd88de0ab3643e229e Mon Sep 17 00:00:00 2001 From: Boris Verkhovskiy Date: Mon, 10 Apr 2023 19:06:27 +0100 Subject: [PATCH 2/2] Update whats_left.py Co-authored-by: Jeong, YunWon <69878+youknowone@users.noreply.github.com> --- whats_left.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/whats_left.py b/whats_left.py index 82916582fe..7f3ad80c63 100755 --- a/whats_left.py +++ b/whats_left.py @@ -490,7 +490,7 @@ def remove_one_indent(s): if rustpy_value is None or rustpy_value.startswith("ValueError("): rustpy_value = f" {rustpy_value}" print(f"{item}{rustpy_value}") - if cpython_value is None or cpython_value.startswith("ValueError("): + if cpython_value is None: cpython_value = f" {cpython_value}" print(f"{' ' * len(item)}{cpython_value}") if i < len(mismatched) - 1: