20
20
except ImportError :
21
21
multiprocessing = None # type: ignore
22
22
23
+ Results = List [Tuple [str , int , int , str , Optional [str ]]]
24
+
23
25
LOG = logging .getLogger (__name__ )
24
26
25
27
SERIAL_RETRY_ERRNOS = {
@@ -346,7 +348,7 @@ def __init__(self, filename, checks, options):
346
348
self .options = options
347
349
self .filename = filename
348
350
self .checks = checks
349
- self .results : List [ Tuple [ str , int , int , str , Optional [ str ]]] = []
351
+ self .results : Results = []
350
352
self .statistics = {
351
353
"tokens" : 0 ,
352
354
"logical lines" : 0 ,
@@ -588,7 +590,7 @@ def process_tokens(self):
588
590
self .run_physical_checks (file_processor .lines [- 1 ])
589
591
self .run_logical_checks ()
590
592
591
- def run_checks (self ):
593
+ def run_checks (self ) -> Tuple [ str , Results , Dict [ str , int ]] :
592
594
"""Run checks against the file."""
593
595
assert self .processor is not None
594
596
try :
@@ -598,7 +600,7 @@ def run_checks(self):
598
600
code = "E902" if isinstance (e , tokenize .TokenError ) else "E999"
599
601
row , column = self ._extract_syntax_information (e )
600
602
self .report (code , row , column , f"{ type (e ).__name__ } : { e .args [0 ]} " )
601
- return
603
+ return self . filename , self . results , self . statistics
602
604
603
605
logical_lines = self .processor .statistics ["logical lines" ]
604
606
self .statistics ["logical lines" ] = logical_lines
0 commit comments