Plugins/CheckerPlugins/Tabnanny/Tabnanny.py

changeset 6188
5a6ae3be31e6
parent 6048
82ad8ec9548c
child 6645
ad476851d7e0
equal deleted inserted replaced
6187:2cc7e3629784 6188:5a6ae3be31e6
169 initialTasks = 2 * NumberOfProcesses 169 initialTasks = 2 * NumberOfProcesses
170 for task in argumentsList[:initialTasks]: 170 for task in argumentsList[:initialTasks]:
171 taskQueue.put(task) 171 taskQueue.put(task)
172 172
173 # Start worker processes 173 # Start worker processes
174 for i in range(NumberOfProcesses): 174 for _ in range(NumberOfProcesses):
175 multiprocessing.Process(target=worker, args=(taskQueue, doneQueue))\ 175 multiprocessing.Process(target=worker, args=(taskQueue, doneQueue))\
176 .start() 176 .start()
177 177
178 # Get and send results 178 # Get and send results
179 endIndex = len(argumentsList) - initialTasks 179 endIndex = len(argumentsList) - initialTasks
199 199
200 if i < endIndex: 200 if i < endIndex:
201 taskQueue.put(argumentsList[i + initialTasks]) 201 taskQueue.put(argumentsList[i + initialTasks])
202 202
203 # Tell child processes to stop 203 # Tell child processes to stop
204 for i in range(NumberOfProcesses): 204 for _ in range(NumberOfProcesses):
205 taskQueue.put('STOP') 205 taskQueue.put('STOP')
206 206
207 207
208 def worker(inputQueue, outputQueue): 208 def worker(inputQueue, outputQueue):
209 """ 209 """
473 NEWLINE = tokenize.NEWLINE 473 NEWLINE = tokenize.NEWLINE
474 JUNK = tokenize.COMMENT, tokenize.NL 474 JUNK = tokenize.COMMENT, tokenize.NL
475 indents = [Whitespace("")] 475 indents = [Whitespace("")]
476 check_equal = 0 476 check_equal = 0
477 477
478 for (tokenType, token, start, end, line) in tokens: 478 for (tokenType, token, start, _end, line) in tokens:
479 if tokenType == NEWLINE: 479 if tokenType == NEWLINE:
480 # a program statement, or ENDMARKER, will eventually follow, 480 # a program statement, or ENDMARKER, will eventually follow,
481 # after some (possibly empty) run of tokens of the form 481 # after some (possibly empty) run of tokens of the form
482 # (NL | COMMENT)* (INDENT | DEDENT+)? 482 # (NL | COMMENT)* (INDENT | DEDENT+)?
483 # If an INDENT appears, setting check_equal is wrong, and will 483 # If an INDENT appears, setting check_equal is wrong, and will

eric ide

mercurial