File tree 3 files changed +20
-6
lines changed
3 files changed +20
-6
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,11 @@ exclude_lines =
7
7
# Don't complain if non-runnable code isn't run:
8
8
if 0:
9
9
if __name__ == .__main__.:
10
+ raise AssertionError\(
11
+
12
+ # Empty bodies in protocols or abstract methods
13
+ ^\s*def [a-zA-Z0-9_]+\(.*\)(\s*->.*)?:\s*\.\.\.(\s*# .*)?$
14
+ ^\s*\.\.\.(\s*# .*)?$
10
15
11
16
.*# pragma: no cover
12
17
.*# pragma: no branch
Original file line number Diff line number Diff line change @@ -469,18 +469,18 @@ class Language(metaclass=abc.ABCMeta):
469
469
checksum_line = ""
470
470
471
471
def __init__ (self , filename : str ) -> None :
472
- pass
472
+ ...
473
473
474
474
@abc .abstractmethod
475
475
def render (
476
476
self ,
477
477
clinic : Clinic | None ,
478
478
signatures : Iterable [Module | Class | Function ]
479
479
) -> str :
480
- pass
480
+ ...
481
481
482
482
def parse_line (self , line : str ) -> None :
483
- pass
483
+ ...
484
484
485
485
def validate (self ) -> None :
486
486
def assert_only_one (
@@ -2862,6 +2862,9 @@ def __getattr__(self, attr):
2862
2862
f"Note: accessing self.function inside converter_init is disallowed!"
2863
2863
)
2864
2864
return super ().__getattr__ (attr )
2865
+ # this branch is just here for coverage reporting
2866
+ else : # pragma: no cover
2867
+ pass
2865
2868
2866
2869
def converter_init (self ) -> None :
2867
2870
pass
@@ -3990,7 +3993,7 @@ def correct_name_for_self(
3990
3993
return "void *" , "null"
3991
3994
if f .kind in (CLASS_METHOD , METHOD_NEW ):
3992
3995
return "PyTypeObject *" , "type"
3993
- raise RuntimeError ( "Unhandled type of function f: " + repr ( f .kind ) )
3996
+ raise AssertionError ( f "Unhandled type of function f: { f .kind !r } " )
3994
3997
3995
3998
def required_type_for_self_for_parser (
3996
3999
f : Function
Original file line number Diff line number Diff line change @@ -178,11 +178,17 @@ def pop_stack() -> TokenAndCondition:
178
178
if self .verbose :
179
179
print (self .status ())
180
180
181
- if __name__ == '__main__' :
182
- for filename in sys .argv [1 :]:
181
+
182
+ def _main (filenames : list [str ] | None = None ) -> None :
183
+ filenames = filenames or sys .argv [1 :]
184
+ for filename in filenames :
183
185
with open (filename ) as f :
184
186
cpp = Monitor (filename , verbose = True )
185
187
print ()
186
188
print (filename )
187
189
for line_number , line in enumerate (f .read ().split ('\n ' ), 1 ):
188
190
cpp .writeline (line )
191
+
192
+
193
+ if __name__ == '__main__' :
194
+ _main ()
You can’t perform that action at this time.
0 commit comments