@@ -92,11 +92,6 @@ def __init__(self, style_guide, arguments, checker_plugins):
92
92
raise
93
93
self .using_multiprocessing = False
94
94
95
- @staticmethod
96
- def _cleanup_queue (q ):
97
- while not q .empty ():
98
- q .get_nowait ()
99
-
100
95
def _process_statistics (self ):
101
96
for checker in self .checkers :
102
97
for statistic in defaults .STATISTIC_NAMES :
@@ -279,10 +274,15 @@ def run_parallel(self):
279
274
"""Run the checkers in parallel."""
280
275
final_results = collections .defaultdict (list )
281
276
final_statistics = collections .defaultdict (dict )
282
- for ret in self .pool .imap_unordered (
283
- _run_checks , self .checkers ,
284
- chunksize = _pool_chunksize (len (self .checkers ), self .jobs ),
285
- ):
277
+ pool_map = self .pool .imap_unordered (
278
+ _run_checks ,
279
+ self .checkers ,
280
+ chunksize = calculate_pool_chunksize (
281
+ len (self .checkers ),
282
+ self .jobs ,
283
+ ),
284
+ )
285
+ for ret in pool_map :
286
286
filename , results , statistics = ret
287
287
final_results [filename ] = results
288
288
final_statistics [filename ] = statistics
@@ -620,7 +620,7 @@ def _pool_init():
620
620
signal .signal (signal .SIGINT , signal .SIG_IGN )
621
621
622
622
623
- def _pool_chunksize (num_checkers , num_jobs ):
623
+ def calculate_pool_chunksize (num_checkers , num_jobs ):
624
624
"""Determine the chunksize for the multiprocessing Pool.
625
625
626
626
- For chunksize, see: https://docs.python.org/3/library/multiprocessing.html#multiprocessing.pool.Pool.imap # noqa
0 commit comments