@@ -2669,15 +2669,15 @@ class CConverter(metaclass=CConverterAutoRegister):
2669
2669
# keep in sync with self_converter.__init__!
2670
2670
def __init__ (self ,
2671
2671
# Positional args:
2672
- name ,
2673
- py_name ,
2672
+ name : str ,
2673
+ py_name : str ,
2674
2674
function ,
2675
2675
default = unspecified ,
2676
2676
* , # Keyword only args:
2677
- c_default = None ,
2678
- py_default = None ,
2679
- annotation = unspecified ,
2680
- unused = False ,
2677
+ c_default : str | None = None ,
2678
+ py_default : str | None = None ,
2679
+ annotation : str | Unspecified = unspecified ,
2680
+ unused : bool = False ,
2681
2681
** kwargs
2682
2682
):
2683
2683
self .name = ensure_legal_c_identifier (name )
@@ -2713,10 +2713,10 @@ def __init__(self,
2713
2713
def converter_init (self ):
2714
2714
pass
2715
2715
2716
- def is_optional (self ):
2716
+ def is_optional (self ) -> bool :
2717
2717
return (self .default is not unspecified )
2718
2718
2719
- def _render_self (self , parameter , data ) :
2719
+ def _render_self (self , parameter : str , data : CRenderData ) -> None :
2720
2720
self .parameter = parameter
2721
2721
name = self .parser_name
2722
2722
@@ -2776,7 +2776,7 @@ def _render_non_self(self, parameter, data):
2776
2776
if cleanup :
2777
2777
data .cleanup .append ('/* Cleanup for ' + name + ' */\n ' + cleanup .rstrip () + "\n " )
2778
2778
2779
- def render (self , parameter , data ) :
2779
+ def render (self , parameter : str , data : CRenderData ) -> None :
2780
2780
"""
2781
2781
parameter is a clinic.Parameter instance.
2782
2782
data is a CRenderData instance.
@@ -2852,31 +2852,31 @@ def declaration(self, *, in_parser=False):
2852
2852
declaration .append (';' )
2853
2853
return "" .join (declaration )
2854
2854
2855
- def initialize (self ):
2855
+ def initialize (self ) -> str :
2856
2856
"""
2857
2857
The C statements required to set up this variable before parsing.
2858
2858
Returns a string containing this code indented at column 0.
2859
2859
If no initialization is necessary, returns an empty string.
2860
2860
"""
2861
2861
return ""
2862
2862
2863
- def modify (self ):
2863
+ def modify (self ) -> str :
2864
2864
"""
2865
2865
The C statements required to modify this variable after parsing.
2866
2866
Returns a string containing this code indented at column 0.
2867
2867
If no modification is necessary, returns an empty string.
2868
2868
"""
2869
2869
return ""
2870
2870
2871
- def post_parsing (self ):
2871
+ def post_parsing (self ) -> str :
2872
2872
"""
2873
2873
The C statements required to do some operations after the end of parsing but before cleaning up.
2874
2874
Return a string containing this code indented at column 0.
2875
2875
If no operation is necessary, return an empty string.
2876
2876
"""
2877
2877
return ""
2878
2878
2879
- def cleanup (self ):
2879
+ def cleanup (self ) -> str :
2880
2880
"""
2881
2881
The C statements required to clean up after this variable.
2882
2882
Returns a string containing this code indented at column 0.
@@ -2929,7 +2929,7 @@ def parse_arg(self, argname, displayname):
2929
2929
""" .format (argname = argname , paramname = self .parser_name , cast = cast )
2930
2930
return None
2931
2931
2932
- def set_template_dict (self , template_dict ):
2932
+ def set_template_dict (self , template_dict : dict [ str , str ] ):
2933
2933
pass
2934
2934
2935
2935
@property
0 commit comments