From 4c84c3b6e19281db1c4cff9029032ce74ee513c0 Mon Sep 17 00:00:00 2001 From: "Erlend E. Aasland" Date: Tue, 4 Jul 2023 11:24:55 +0200 Subject: [PATCH 1/6] Annotate parse_line() --- Tools/clinic/clinic.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tools/clinic/clinic.py b/Tools/clinic/clinic.py index 3d18d9560bc28b..502cc121b0309d 100755 --- a/Tools/clinic/clinic.py +++ b/Tools/clinic/clinic.py @@ -735,7 +735,7 @@ def __init__(self, filename): self.cpp = cpp.Monitor(filename) self.cpp.fail = fail - def parse_line(self, line): + def parse_line(self, line: str) -> None: self.cpp.writeline(line) def render(self, clinic, signatures): From f5b6f19a9d7e100e04133ed25b1441704085ea38 Mon Sep 17 00:00:00 2001 From: "Erlend E. Aasland" Date: Tue, 4 Jul 2023 11:27:34 +0200 Subject: [PATCH 2/6] Partially annotate render() --- Tools/clinic/clinic.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Tools/clinic/clinic.py b/Tools/clinic/clinic.py index 502cc121b0309d..25e24052f2c229 100755 --- a/Tools/clinic/clinic.py +++ b/Tools/clinic/clinic.py @@ -738,7 +738,11 @@ def __init__(self, filename): def parse_line(self, line: str) -> None: self.cpp.writeline(line) - def render(self, clinic, signatures): + def render( + self, + clinic: Clinic | None, + signatures + ) -> str: function = None for o in signatures: if isinstance(o, Function): From cd161646f1b8bd458bae1c2225ac37866a23444b Mon Sep 17 00:00:00 2001 From: "Erlend E. Aasland" Date: Tue, 4 Jul 2023 11:28:23 +0200 Subject: [PATCH 3/6] Annotate docstring_for_c_string() --- Tools/clinic/clinic.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Tools/clinic/clinic.py b/Tools/clinic/clinic.py index 25e24052f2c229..a89e97a50c3cfa 100755 --- a/Tools/clinic/clinic.py +++ b/Tools/clinic/clinic.py @@ -751,7 +751,10 @@ def render( function = o return self.render_function(clinic, function) - def docstring_for_c_string(self, f): + def docstring_for_c_string( + self, + f: Function + ) -> str: if re.search(r'[^\x00-\x7F]', f.docstring): warn("Non-ascii character appear in docstring.") From 3100fee11a3d7b2917834686c37b504ba0a437f4 Mon Sep 17 00:00:00 2001 From: "Erlend E. Aasland" Date: Tue, 4 Jul 2023 11:37:42 +0200 Subject: [PATCH 4/6] Annotate group_to_variable_name() --- Tools/clinic/clinic.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tools/clinic/clinic.py b/Tools/clinic/clinic.py index a89e97a50c3cfa..c45ff3fc9a770d 100755 --- a/Tools/clinic/clinic.py +++ b/Tools/clinic/clinic.py @@ -1335,7 +1335,7 @@ def parser_body(prototype, *fields, declarations=''): return d2 @staticmethod - def group_to_variable_name(group): + def group_to_variable_name(group: int) -> str: adjective = "left_" if group < 0 else "right_" return "group_" + adjective + str(abs(group)) From 69d2a60366ac8ce9c31e0796f95ad3435b1b54f9 Mon Sep 17 00:00:00 2001 From: "Erlend E. Aasland" Date: Tue, 4 Jul 2023 11:42:44 +0200 Subject: [PATCH 5/6] Annotate render_function() --- Tools/clinic/clinic.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Tools/clinic/clinic.py b/Tools/clinic/clinic.py index c45ff3fc9a770d..4563f460edeb62 100755 --- a/Tools/clinic/clinic.py +++ b/Tools/clinic/clinic.py @@ -1431,8 +1431,12 @@ def render_option_group_parsing(self, f, template_dict): add("}") template_dict['option_group_parsing'] = format_escape(output()) - def render_function(self, clinic, f): - if not f: + def render_function( + self, + clinic: Clinic | None, + f: Function | None + ) -> str: + if f is None or clinic is None: return "" add, output = text_accumulator() @@ -1494,10 +1498,12 @@ def render_function(self, clinic, f): template_dict = {} + assert isinstance(f.full_name, str) full_name = f.full_name template_dict['full_name'] = full_name if new_or_init: + assert isinstance(f.cls, Class) name = f.cls.name else: name = f.name From 68668b2b1ce3789014a54905fec1dfaabfbd634c Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Wed, 5 Jul 2023 00:41:20 +0200 Subject: [PATCH 6/6] Address review --- Tools/clinic/clinic.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tools/clinic/clinic.py b/Tools/clinic/clinic.py index 9e0688c6221dee..5f5d024b5aa6f8 100755 --- a/Tools/clinic/clinic.py +++ b/Tools/clinic/clinic.py @@ -758,7 +758,7 @@ def parse_line(self, line: str) -> None: def render( self, clinic: Clinic | None, - signatures + signatures: Iterable[Function] ) -> str: function = None for o in signatures: pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy