From 5f5d9b419aebc23c34e3e827d4be32f4b2c25b77 Mon Sep 17 00:00:00 2001 From: jakkdl Date: Mon, 21 Aug 2023 14:11:30 +0200 Subject: [PATCH 1/2] check type completeness on all platforms --- trio/_tests/check_type_completeness.py | 52 +- trio/_tests/verify_types.json | 60 --- trio/_tests/verify_types_darwin.json | 221 +++++++++ trio/_tests/verify_types_linux.json | 146 ++++++ trio/_tests/verify_types_windows.json | 661 +++++++++++++++++++++++++ 5 files changed, 1051 insertions(+), 89 deletions(-) delete mode 100644 trio/_tests/verify_types.json create mode 100644 trio/_tests/verify_types_darwin.json create mode 100644 trio/_tests/verify_types_linux.json create mode 100644 trio/_tests/verify_types_windows.json diff --git a/trio/_tests/check_type_completeness.py b/trio/_tests/check_type_completeness.py index 6a8761b88c..449f18f9ab 100755 --- a/trio/_tests/check_type_completeness.py +++ b/trio/_tests/check_type_completeness.py @@ -9,18 +9,21 @@ from pathlib import Path # the result file is not marked in MANIFEST.in so it's not included in the package -RESULT_FILE = Path(__file__).parent / "verify_types.json" failed = False +def get_result_file_name(platform: str): + return Path(__file__).parent / f"verify_types_{platform.lower()}.json" + + # TODO: consider checking manually without `--ignoreexternal`, and/or # removing it from the below call later on. -def run_pyright(): +def run_pyright(platform: str): return subprocess.run( [ "pyright", # Specify a platform and version to keep imported modules consistent. - "--pythonplatform=Linux", + f"--pythonplatform={platform}", "--pythonversion=3.8", "--verifytypes=trio", "--outputjson", @@ -43,9 +46,11 @@ def check_less_than(key, current_dict, last_dict, /, invert=False): print("ERROR: ", end="") if isinstance(current, float): strcurrent = f"{current:.4}" - strlast = f"{last:.4}" else: strcurrent = str(current) + if isinstance(last, float): + strlast = f"{last:.4}" + else: strlast = str(last) print( f"{key} has gone {'down' if current int: +def check_type(args: argparse.Namespace, platform: str) -> int: print("*" * 20, "\nChecking type completeness hasn't gone down...") - res = run_pyright() + res = run_pyright(platform) current_result = json.loads(res.stdout) py_typed_file: Path | None = None @@ -79,26 +84,13 @@ def main(args: argparse.Namespace) -> int: ) py_typed_file.write_text("") - res = run_pyright() + res = run_pyright(platform) current_result = json.loads(res.stdout) if res.stderr: print(res.stderr) - if args.full_diagnostics_file is not None: - with open(args.full_diagnostics_file, "w") as file: - json.dump( - [ - sym - for sym in current_result["typeCompleteness"]["symbols"] - if sym["diagnostics"] - ], - file, - sort_keys=True, - indent=2, - ) - - last_result = json.loads(RESULT_FILE.read_text()) + last_result = json.loads(get_result_file_name(platform).read_text()) for key in "errorCount", "warningCount", "informationCount": check_zero(key, current_result["summary"]) @@ -128,11 +120,6 @@ def main(args: argparse.Namespace) -> int: invert=invert, ) - # handle in separate PR - # assert ( - # res.returncode != 0 - # ), "Fully type complete! Delete this script and instead directly run `pyright --verifytypes=trio` (consider `--ignoreexternal`) in CI and checking exit code." - if args.overwrite_file: print("Overwriting file") @@ -156,11 +143,11 @@ def main(args: argparse.Namespace) -> int: new_symbols = [] for symbol in current_result["typeCompleteness"]["symbols"]: if symbol["diagnostics"]: - new_symbols.append(symbol["name"]) + new_symbols.append(symbol) continue # Ensure order of arrays does not affect result. - new_symbols.sort() + new_symbols.sort(key=lambda module: module.get("name", "")) current_result["generalDiagnostics"].sort() current_result["typeCompleteness"]["modules"].sort( key=lambda module: module.get("name", "") @@ -168,7 +155,7 @@ def main(args: argparse.Namespace) -> int: current_result["typeCompleteness"]["symbols"] = new_symbols - with open(RESULT_FILE, "w") as file: + with open(get_result_file_name(platform), "w") as file: json.dump(current_result, file, sort_keys=True, indent=2) # add newline at end of file so it's easier to manually modify file.write("\n") @@ -182,6 +169,13 @@ def main(args: argparse.Namespace) -> int: return int(failed) +def main(args: argparse.Namespace) -> int: + res = 0 + for platform in "Linux", "Windows", "Darwin": + res += check_type(args, platform) + return res + + parser = argparse.ArgumentParser() parser.add_argument("--overwrite-file", action="store_true", default=False) parser.add_argument("--full-diagnostics-file", type=Path, default=None) diff --git a/trio/_tests/verify_types.json b/trio/_tests/verify_types.json deleted file mode 100644 index 2d93f0fb3f..0000000000 --- a/trio/_tests/verify_types.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "generalDiagnostics": [], - "summary": { - "errorCount": 0, - "filesAnalyzed": 8, - "informationCount": 0, - "warningCount": 0 - }, - "typeCompleteness": { - "completenessScore": 1, - "exportedSymbolCounts": { - "withAmbiguousType": 0, - "withKnownType": 628, - "withUnknownType": 0 - }, - "ignoreUnknownTypesFromImports": true, - "missingClassDocStringCount": 1, - "missingDefaultParamCount": 0, - "missingFunctionDocStringCount": 3, - "moduleName": "trio", - "modules": [ - { - "name": "trio" - }, - { - "name": "trio.abc" - }, - { - "name": "trio.from_thread" - }, - { - "name": "trio.lowlevel" - }, - { - "name": "trio.socket" - }, - { - "name": "trio.testing" - }, - { - "name": "trio.tests" - }, - { - "name": "trio.to_thread" - } - ], - "otherSymbolCounts": { - "withAmbiguousType": 0, - "withKnownType": 682, - "withUnknownType": 0 - }, - "packageName": "trio", - "symbols": [ - "trio.lowlevel.notify_closing", - "trio.lowlevel.wait_readable", - "trio.lowlevel.wait_writable", - "trio.tests.TestsDeprecationWrapper" - ] - } -} diff --git a/trio/_tests/verify_types_darwin.json b/trio/_tests/verify_types_darwin.json new file mode 100644 index 0000000000..7329946baa --- /dev/null +++ b/trio/_tests/verify_types_darwin.json @@ -0,0 +1,221 @@ +{ + "generalDiagnostics": [], + "summary": { + "errorCount": 0, + "filesAnalyzed": 8, + "informationCount": 0, + "warningCount": 0 + }, + "typeCompleteness": { + "completenessScore": 1, + "exportedSymbolCounts": { + "withAmbiguousType": 0, + "withKnownType": 631, + "withUnknownType": 0 + }, + "ignoreUnknownTypesFromImports": true, + "missingClassDocStringCount": 1, + "missingDefaultParamCount": 0, + "missingFunctionDocStringCount": 6, + "moduleName": "trio", + "modules": [ + { + "name": "trio" + }, + { + "name": "trio.abc" + }, + { + "name": "trio.from_thread" + }, + { + "name": "trio.lowlevel" + }, + { + "name": "trio.socket" + }, + { + "name": "trio.testing" + }, + { + "name": "trio.tests" + }, + { + "name": "trio.to_thread" + } + ], + "otherSymbolCounts": { + "withAmbiguousType": 0, + "withKnownType": 682, + "withUnknownType": 0 + }, + "packageName": "trio", + "symbols": [ + { + "category": "function", + "diagnostics": [ + { + "file": "/home/h/Git/trio/typing_improvements/.tox/verifytypes/lib/python3.8/site-packages/trio/_core/__init__.py", + "message": "No docstring found for function \"trio.lowlevel.current_kqueue\"", + "range": { + "end": { + "character": 44, + "line": 72 + }, + "start": { + "character": 30, + "line": 72 + } + }, + "severity": "warning" + } + ], + "isExported": true, + "isTypeAmbiguous": false, + "isTypeKnown": true, + "name": "trio.lowlevel.current_kqueue", + "referenceCount": 1 + }, + { + "category": "function", + "diagnostics": [ + { + "file": "/home/h/Git/trio/typing_improvements/.tox/verifytypes/lib/python3.8/site-packages/trio/_core/__init__.py", + "message": "No docstring found for function \"trio.lowlevel.monitor_kevent\"", + "range": { + "end": { + "character": 44, + "line": 73 + }, + "start": { + "character": 30, + "line": 73 + } + }, + "severity": "warning" + } + ], + "isExported": true, + "isTypeAmbiguous": false, + "isTypeKnown": true, + "name": "trio.lowlevel.monitor_kevent", + "referenceCount": 1 + }, + { + "category": "function", + "diagnostics": [ + { + "file": "/home/h/Git/trio/typing_improvements/.tox/verifytypes/lib/python3.8/site-packages/trio/_core/__init__.py", + "message": "No docstring found for function \"trio.lowlevel.notify_closing\"", + "range": { + "end": { + "character": 36, + "line": 33 + }, + "start": { + "character": 22, + "line": 33 + } + }, + "severity": "warning" + } + ], + "isExported": true, + "isTypeAmbiguous": false, + "isTypeKnown": true, + "name": "trio.lowlevel.notify_closing", + "referenceCount": 1 + }, + { + "category": "function", + "diagnostics": [ + { + "file": "/home/h/Git/trio/typing_improvements/.tox/verifytypes/lib/python3.8/site-packages/trio/_core/__init__.py", + "message": "No docstring found for function \"trio.lowlevel.wait_kevent\"", + "range": { + "end": { + "character": 38, + "line": 74 + }, + "start": { + "character": 27, + "line": 74 + } + }, + "severity": "warning" + } + ], + "isExported": true, + "isTypeAmbiguous": false, + "isTypeKnown": true, + "name": "trio.lowlevel.wait_kevent", + "referenceCount": 1 + }, + { + "category": "function", + "diagnostics": [ + { + "file": "/home/h/Git/trio/typing_improvements/.tox/verifytypes/lib/python3.8/site-packages/trio/_core/__init__.py", + "message": "No docstring found for function \"trio.lowlevel.wait_readable\"", + "range": { + "end": { + "character": 34, + "line": 42 + }, + "start": { + "character": 21, + "line": 42 + } + }, + "severity": "warning" + } + ], + "isExported": true, + "isTypeAmbiguous": false, + "isTypeKnown": true, + "name": "trio.lowlevel.wait_readable", + "referenceCount": 1 + }, + { + "category": "function", + "diagnostics": [ + { + "file": "/home/h/Git/trio/typing_improvements/.tox/verifytypes/lib/python3.8/site-packages/trio/_core/__init__.py", + "message": "No docstring found for function \"trio.lowlevel.wait_writable\"", + "range": { + "end": { + "character": 34, + "line": 44 + }, + "start": { + "character": 21, + "line": 44 + } + }, + "severity": "warning" + } + ], + "isExported": true, + "isTypeAmbiguous": false, + "isTypeKnown": true, + "name": "trio.lowlevel.wait_writable", + "referenceCount": 1 + }, + { + "category": "class", + "diagnostics": [ + { + "file": "", + "message": "No docstring found for class \"trio.tests.TestsDeprecationWrapper\"", + "severity": "warning" + } + ], + "isExported": true, + "isTypeAmbiguous": false, + "isTypeKnown": true, + "name": "trio.tests.TestsDeprecationWrapper", + "referenceCount": 1 + } + ] + } +} diff --git a/trio/_tests/verify_types_linux.json b/trio/_tests/verify_types_linux.json new file mode 100644 index 0000000000..76d66813e5 --- /dev/null +++ b/trio/_tests/verify_types_linux.json @@ -0,0 +1,146 @@ +{ + "generalDiagnostics": [], + "summary": { + "errorCount": 0, + "filesAnalyzed": 8, + "informationCount": 0, + "warningCount": 0 + }, + "typeCompleteness": { + "completenessScore": 1, + "exportedSymbolCounts": { + "withAmbiguousType": 0, + "withKnownType": 628, + "withUnknownType": 0 + }, + "ignoreUnknownTypesFromImports": true, + "missingClassDocStringCount": 1, + "missingDefaultParamCount": 0, + "missingFunctionDocStringCount": 3, + "moduleName": "trio", + "modules": [ + { + "name": "trio" + }, + { + "name": "trio.abc" + }, + { + "name": "trio.from_thread" + }, + { + "name": "trio.lowlevel" + }, + { + "name": "trio.socket" + }, + { + "name": "trio.testing" + }, + { + "name": "trio.tests" + }, + { + "name": "trio.to_thread" + } + ], + "otherSymbolCounts": { + "withAmbiguousType": 0, + "withKnownType": 682, + "withUnknownType": 0 + }, + "packageName": "trio", + "symbols": [ + { + "category": "function", + "diagnostics": [ + { + "file": "/home/h/Git/trio/typing_improvements/.tox/verifytypes/lib/python3.8/site-packages/trio/_core/__init__.py", + "message": "No docstring found for function \"trio.lowlevel.notify_closing\"", + "range": { + "end": { + "character": 36, + "line": 33 + }, + "start": { + "character": 22, + "line": 33 + } + }, + "severity": "warning" + } + ], + "isExported": true, + "isTypeAmbiguous": false, + "isTypeKnown": true, + "name": "trio.lowlevel.notify_closing", + "referenceCount": 1 + }, + { + "category": "function", + "diagnostics": [ + { + "file": "/home/h/Git/trio/typing_improvements/.tox/verifytypes/lib/python3.8/site-packages/trio/_core/__init__.py", + "message": "No docstring found for function \"trio.lowlevel.wait_readable\"", + "range": { + "end": { + "character": 34, + "line": 42 + }, + "start": { + "character": 21, + "line": 42 + } + }, + "severity": "warning" + } + ], + "isExported": true, + "isTypeAmbiguous": false, + "isTypeKnown": true, + "name": "trio.lowlevel.wait_readable", + "referenceCount": 1 + }, + { + "category": "function", + "diagnostics": [ + { + "file": "/home/h/Git/trio/typing_improvements/.tox/verifytypes/lib/python3.8/site-packages/trio/_core/__init__.py", + "message": "No docstring found for function \"trio.lowlevel.wait_writable\"", + "range": { + "end": { + "character": 34, + "line": 44 + }, + "start": { + "character": 21, + "line": 44 + } + }, + "severity": "warning" + } + ], + "isExported": true, + "isTypeAmbiguous": false, + "isTypeKnown": true, + "name": "trio.lowlevel.wait_writable", + "referenceCount": 1 + }, + { + "category": "class", + "diagnostics": [ + { + "file": "", + "message": "No docstring found for class \"trio.tests.TestsDeprecationWrapper\"", + "severity": "warning" + } + ], + "isExported": true, + "isTypeAmbiguous": false, + "isTypeKnown": true, + "name": "trio.tests.TestsDeprecationWrapper", + "referenceCount": 1 + } + ] + } +} diff --git a/trio/_tests/verify_types_windows.json b/trio/_tests/verify_types_windows.json new file mode 100644 index 0000000000..24ef5f355b --- /dev/null +++ b/trio/_tests/verify_types_windows.json @@ -0,0 +1,661 @@ +{ + "generalDiagnostics": [], + "summary": { + "errorCount": 0, + "filesAnalyzed": 8, + "informationCount": 0, + "warningCount": 0 + }, + "typeCompleteness": { + "completenessScore": 0.9857369255150554, + "exportedSymbolCounts": { + "withAmbiguousType": 0, + "withKnownType": 622, + "withUnknownType": 9 + }, + "ignoreUnknownTypesFromImports": true, + "missingClassDocStringCount": 1, + "missingDefaultParamCount": 0, + "missingFunctionDocStringCount": 11, + "moduleName": "trio", + "modules": [ + { + "name": "trio" + }, + { + "name": "trio.abc" + }, + { + "name": "trio.from_thread" + }, + { + "name": "trio.lowlevel" + }, + { + "name": "trio.socket" + }, + { + "name": "trio.testing" + }, + { + "name": "trio.tests" + }, + { + "name": "trio.to_thread" + } + ], + "otherSymbolCounts": { + "withAmbiguousType": 0, + "withKnownType": 673, + "withUnknownType": 0 + }, + "packageName": "trio", + "symbols": [ + { + "category": "function", + "diagnostics": [ + { + "file": "/home/h/Git/trio/typing_improvements/.tox/verifytypes/lib/python3.8/site-packages/trio/_core/__init__.py", + "message": "Return type annotation is missing", + "range": { + "end": { + "character": 36, + "line": 57 + }, + "start": { + "character": 24, + "line": 57 + } + }, + "severity": "error" + }, + { + "file": "/home/h/Git/trio/typing_improvements/.tox/verifytypes/lib/python3.8/site-packages/trio/_core/__init__.py", + "message": "No docstring found for function \"trio.lowlevel.current_iocp\"", + "range": { + "end": { + "character": 36, + "line": 57 + }, + "start": { + "character": 24, + "line": 57 + } + }, + "severity": "warning" + } + ], + "isExported": true, + "isTypeAmbiguous": false, + "isTypeKnown": false, + "name": "trio.lowlevel.current_iocp", + "referenceCount": 1 + }, + { + "category": "function", + "diagnostics": [ + { + "file": "/home/h/Git/trio/typing_improvements/.tox/verifytypes/lib/python3.8/site-packages/trio/_core/__init__.py", + "message": "Return type annotation is missing", + "range": { + "end": { + "character": 56, + "line": 58 + }, + "start": { + "character": 34, + "line": 58 + } + }, + "severity": "error" + }, + { + "file": "/home/h/Git/trio/typing_improvements/.tox/verifytypes/lib/python3.8/site-packages/trio/_core/__init__.py", + "message": "No docstring found for function \"trio.lowlevel.monitor_completion_key\"", + "range": { + "end": { + "character": 56, + "line": 58 + }, + "start": { + "character": 34, + "line": 58 + } + }, + "severity": "warning" + } + ], + "isExported": true, + "isTypeAmbiguous": false, + "isTypeKnown": false, + "name": "trio.lowlevel.monitor_completion_key", + "referenceCount": 1 + }, + { + "category": "function", + "diagnostics": [ + { + "file": "/home/h/Git/trio/typing_improvements/.tox/verifytypes/lib/python3.8/site-packages/trio/_core/__init__.py", + "message": "Type annotation for parameter \"handle\" is missing", + "range": { + "end": { + "character": 36, + "line": 33 + }, + "start": { + "character": 22, + "line": 33 + } + }, + "severity": "error" + }, + { + "file": "/home/h/Git/trio/typing_improvements/.tox/verifytypes/lib/python3.8/site-packages/trio/_core/__init__.py", + "message": "Return type annotation is missing", + "range": { + "end": { + "character": 36, + "line": 33 + }, + "start": { + "character": 22, + "line": 33 + } + }, + "severity": "error" + }, + { + "file": "/home/h/Git/trio/typing_improvements/.tox/verifytypes/lib/python3.8/site-packages/trio/_core/__init__.py", + "message": "No docstring found for function \"trio.lowlevel.notify_closing\"", + "range": { + "end": { + "character": 36, + "line": 33 + }, + "start": { + "character": 22, + "line": 33 + } + }, + "severity": "warning" + } + ], + "isExported": true, + "isTypeAmbiguous": false, + "isTypeKnown": false, + "name": "trio.lowlevel.notify_closing", + "referenceCount": 1 + }, + { + "category": "function", + "diagnostics": [ + { + "file": "/home/h/Git/trio/typing_improvements/.tox/verifytypes/lib/python3.8/site-packages/trio/_subprocess.py", + "message": "No docstring found for function \"trio.lowlevel.open_process\"", + "range": { + "end": { + "character": 53, + "line": 46 + }, + "start": { + "character": 41, + "line": 46 + } + }, + "severity": "warning" + } + ], + "isExported": true, + "isTypeAmbiguous": false, + "isTypeKnown": true, + "name": "trio.lowlevel.open_process", + "referenceCount": 1 + }, + { + "category": "function", + "diagnostics": [ + { + "file": "/home/h/Git/trio/typing_improvements/.tox/verifytypes/lib/python3.8/site-packages/trio/_core/__init__.py", + "message": "Type annotation for parameter \"handle\" is missing", + "range": { + "end": { + "character": 50, + "line": 59 + }, + "start": { + "character": 31, + "line": 59 + } + }, + "severity": "error" + }, + { + "file": "/home/h/Git/trio/typing_improvements/.tox/verifytypes/lib/python3.8/site-packages/trio/_core/__init__.py", + "message": "Type annotation for parameter \"buffer\" is missing", + "range": { + "end": { + "character": 50, + "line": 59 + }, + "start": { + "character": 31, + "line": 59 + } + }, + "severity": "error" + }, + { + "file": "/home/h/Git/trio/typing_improvements/.tox/verifytypes/lib/python3.8/site-packages/trio/_core/__init__.py", + "message": "Type annotation for parameter \"file_offset\" is missing", + "range": { + "end": { + "character": 50, + "line": 59 + }, + "start": { + "character": 31, + "line": 59 + } + }, + "severity": "error" + }, + { + "file": "/home/h/Git/trio/typing_improvements/.tox/verifytypes/lib/python3.8/site-packages/trio/_core/__init__.py", + "message": "Return type annotation is missing", + "range": { + "end": { + "character": 50, + "line": 59 + }, + "start": { + "character": 31, + "line": 59 + } + }, + "severity": "error" + }, + { + "file": "/home/h/Git/trio/typing_improvements/.tox/verifytypes/lib/python3.8/site-packages/trio/_core/__init__.py", + "message": "No docstring found for function \"trio.lowlevel.readinto_overlapped\"", + "range": { + "end": { + "character": 50, + "line": 59 + }, + "start": { + "character": 31, + "line": 59 + } + }, + "severity": "warning" + } + ], + "isExported": true, + "isTypeAmbiguous": false, + "isTypeKnown": false, + "name": "trio.lowlevel.readinto_overlapped", + "referenceCount": 1 + }, + { + "category": "function", + "diagnostics": [ + { + "file": "/home/h/Git/trio/typing_improvements/.tox/verifytypes/lib/python3.8/site-packages/trio/_core/__init__.py", + "message": "Type annotation for parameter \"handle\" is missing", + "range": { + "end": { + "character": 48, + "line": 60 + }, + "start": { + "character": 30, + "line": 60 + } + }, + "severity": "error" + }, + { + "file": "/home/h/Git/trio/typing_improvements/.tox/verifytypes/lib/python3.8/site-packages/trio/_core/__init__.py", + "message": "Return type annotation is missing", + "range": { + "end": { + "character": 48, + "line": 60 + }, + "start": { + "character": 30, + "line": 60 + } + }, + "severity": "error" + }, + { + "file": "/home/h/Git/trio/typing_improvements/.tox/verifytypes/lib/python3.8/site-packages/trio/_core/__init__.py", + "message": "No docstring found for function \"trio.lowlevel.register_with_iocp\"", + "range": { + "end": { + "character": 48, + "line": 60 + }, + "start": { + "character": 30, + "line": 60 + } + }, + "severity": "warning" + } + ], + "isExported": true, + "isTypeAmbiguous": false, + "isTypeKnown": false, + "name": "trio.lowlevel.register_with_iocp", + "referenceCount": 1 + }, + { + "category": "function", + "diagnostics": [ + { + "file": "/home/h/Git/trio/typing_improvements/.tox/verifytypes/lib/python3.8/site-packages/trio/_core/__init__.py", + "message": "Type annotation for parameter \"handle\" is missing", + "range": { + "end": { + "character": 42, + "line": 61 + }, + "start": { + "character": 27, + "line": 61 + } + }, + "severity": "error" + }, + { + "file": "/home/h/Git/trio/typing_improvements/.tox/verifytypes/lib/python3.8/site-packages/trio/_core/__init__.py", + "message": "Type annotation for parameter \"lpOverlapped\" is missing", + "range": { + "end": { + "character": 42, + "line": 61 + }, + "start": { + "character": 27, + "line": 61 + } + }, + "severity": "error" + }, + { + "file": "/home/h/Git/trio/typing_improvements/.tox/verifytypes/lib/python3.8/site-packages/trio/_core/__init__.py", + "message": "Return type annotation is missing", + "range": { + "end": { + "character": 42, + "line": 61 + }, + "start": { + "character": 27, + "line": 61 + } + }, + "severity": "error" + }, + { + "file": "/home/h/Git/trio/typing_improvements/.tox/verifytypes/lib/python3.8/site-packages/trio/_core/__init__.py", + "message": "No docstring found for function \"trio.lowlevel.wait_overlapped\"", + "range": { + "end": { + "character": 42, + "line": 61 + }, + "start": { + "character": 27, + "line": 61 + } + }, + "severity": "warning" + } + ], + "isExported": true, + "isTypeAmbiguous": false, + "isTypeKnown": false, + "name": "trio.lowlevel.wait_overlapped", + "referenceCount": 1 + }, + { + "category": "function", + "diagnostics": [ + { + "file": "/home/h/Git/trio/typing_improvements/.tox/verifytypes/lib/python3.8/site-packages/trio/_core/__init__.py", + "message": "Type annotation for parameter \"sock\" is missing", + "range": { + "end": { + "character": 34, + "line": 42 + }, + "start": { + "character": 21, + "line": 42 + } + }, + "severity": "error" + }, + { + "file": "/home/h/Git/trio/typing_improvements/.tox/verifytypes/lib/python3.8/site-packages/trio/_core/__init__.py", + "message": "Return type annotation is missing", + "range": { + "end": { + "character": 34, + "line": 42 + }, + "start": { + "character": 21, + "line": 42 + } + }, + "severity": "error" + }, + { + "file": "/home/h/Git/trio/typing_improvements/.tox/verifytypes/lib/python3.8/site-packages/trio/_core/__init__.py", + "message": "No docstring found for function \"trio.lowlevel.wait_readable\"", + "range": { + "end": { + "character": 34, + "line": 42 + }, + "start": { + "character": 21, + "line": 42 + } + }, + "severity": "warning" + } + ], + "isExported": true, + "isTypeAmbiguous": false, + "isTypeKnown": false, + "name": "trio.lowlevel.wait_readable", + "referenceCount": 1 + }, + { + "category": "function", + "diagnostics": [ + { + "file": "/home/h/Git/trio/typing_improvements/.tox/verifytypes/lib/python3.8/site-packages/trio/_core/__init__.py", + "message": "Type annotation for parameter \"sock\" is missing", + "range": { + "end": { + "character": 34, + "line": 44 + }, + "start": { + "character": 21, + "line": 44 + } + }, + "severity": "error" + }, + { + "file": "/home/h/Git/trio/typing_improvements/.tox/verifytypes/lib/python3.8/site-packages/trio/_core/__init__.py", + "message": "Return type annotation is missing", + "range": { + "end": { + "character": 34, + "line": 44 + }, + "start": { + "character": 21, + "line": 44 + } + }, + "severity": "error" + }, + { + "file": "/home/h/Git/trio/typing_improvements/.tox/verifytypes/lib/python3.8/site-packages/trio/_core/__init__.py", + "message": "No docstring found for function \"trio.lowlevel.wait_writable\"", + "range": { + "end": { + "character": 34, + "line": 44 + }, + "start": { + "character": 21, + "line": 44 + } + }, + "severity": "warning" + } + ], + "isExported": true, + "isTypeAmbiguous": false, + "isTypeKnown": false, + "name": "trio.lowlevel.wait_writable", + "referenceCount": 1 + }, + { + "category": "function", + "diagnostics": [ + { + "file": "/home/h/Git/trio/typing_improvements/.tox/verifytypes/lib/python3.8/site-packages/trio/_core/__init__.py", + "message": "Type annotation for parameter \"handle\" is missing", + "range": { + "end": { + "character": 44, + "line": 62 + }, + "start": { + "character": 28, + "line": 62 + } + }, + "severity": "error" + }, + { + "file": "/home/h/Git/trio/typing_improvements/.tox/verifytypes/lib/python3.8/site-packages/trio/_core/__init__.py", + "message": "Type annotation for parameter \"data\" is missing", + "range": { + "end": { + "character": 44, + "line": 62 + }, + "start": { + "character": 28, + "line": 62 + } + }, + "severity": "error" + }, + { + "file": "/home/h/Git/trio/typing_improvements/.tox/verifytypes/lib/python3.8/site-packages/trio/_core/__init__.py", + "message": "Type annotation for parameter \"file_offset\" is missing", + "range": { + "end": { + "character": 44, + "line": 62 + }, + "start": { + "character": 28, + "line": 62 + } + }, + "severity": "error" + }, + { + "file": "/home/h/Git/trio/typing_improvements/.tox/verifytypes/lib/python3.8/site-packages/trio/_core/__init__.py", + "message": "Return type annotation is missing", + "range": { + "end": { + "character": 44, + "line": 62 + }, + "start": { + "character": 28, + "line": 62 + } + }, + "severity": "error" + }, + { + "file": "/home/h/Git/trio/typing_improvements/.tox/verifytypes/lib/python3.8/site-packages/trio/_core/__init__.py", + "message": "No docstring found for function \"trio.lowlevel.write_overlapped\"", + "range": { + "end": { + "character": 44, + "line": 62 + }, + "start": { + "character": 28, + "line": 62 + } + }, + "severity": "warning" + } + ], + "isExported": true, + "isTypeAmbiguous": false, + "isTypeKnown": false, + "name": "trio.lowlevel.write_overlapped", + "referenceCount": 1 + }, + { + "category": "function", + "diagnostics": [ + { + "file": "/home/h/Git/trio/typing_improvements/.tox/verifytypes/lib/python3.8/site-packages/trio/_subprocess.py", + "message": "No docstring found for function \"trio.run_process\"", + "range": { + "end": { + "character": 71, + "line": 83 + }, + "start": { + "character": 60, + "line": 83 + } + }, + "severity": "warning" + } + ], + "isExported": true, + "isTypeAmbiguous": false, + "isTypeKnown": true, + "name": "trio.run_process", + "referenceCount": 1 + }, + { + "category": "class", + "diagnostics": [ + { + "file": "", + "message": "No docstring found for class \"trio.tests.TestsDeprecationWrapper\"", + "severity": "warning" + } + ], + "isExported": true, + "isTypeAmbiguous": false, + "isTypeKnown": true, + "name": "trio.tests.TestsDeprecationWrapper", + "referenceCount": 1 + } + ] + } +} From a580331739022c4f079f7aa9f3d59402e0870664 Mon Sep 17 00:00:00 2001 From: jakkdl Date: Mon, 21 Aug 2023 14:19:23 +0200 Subject: [PATCH 2/2] update .gitattributes and check.sh --- .gitattributes | 2 -- check.sh | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.gitattributes b/.gitattributes index 7fbcb4fe2d..991065e069 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2,5 +2,3 @@ trio/_core/_generated* linguist-generated=true # Treat generated files as binary in git diff trio/_core/_generated* -diff -# don't merge the generated json file, let the user (script) handle it -trio/_tests/verify_types.json merge=binary diff --git a/check.sh b/check.sh index ace193a62a..f9458d95c0 100755 --- a/check.sh +++ b/check.sh @@ -44,9 +44,9 @@ fi codespell || EXIT_STATUS=$? python trio/_tests/check_type_completeness.py --overwrite-file || EXIT_STATUS=$? -if git status --porcelain trio/_tests/verify_types.json | grep -q "M"; then +if git status --porcelain trio/_tests/verify_types*.json | grep -q "M"; then echo "Type completeness changed, please update!" - git --no-pager diff --color trio/_tests/verify_types.json + git --no-pager diff --color trio/_tests/verify_types*.json EXIT_STATUS=1 fi