97 # Tell child processes to stop |
97 # Tell child processes to stop |
98 for i in range(NumberOfProcesses): |
98 for i in range(NumberOfProcesses): |
99 taskQueue.put('STOP') |
99 taskQueue.put('STOP') |
100 |
100 |
101 |
101 |
102 def worker(input, output): |
102 def worker(inputQueue, outputQueue): |
103 """ |
103 """ |
104 Module function acting as the parallel worker for the raw code metrics |
104 Module function acting as the parallel worker for the raw code metrics |
105 calculation. |
105 calculation. |
106 |
106 |
107 @param input input queue |
107 @param inputQueue input queue |
108 @type multiprocessing.Queue |
108 @type multiprocessing.Queue |
109 @param output output queue |
109 @param outputQueue output queue |
110 @type multiprocessing.Queue |
110 @type multiprocessing.Queue |
111 """ |
111 """ |
112 for filename, source in iter(input.get, 'STOP'): |
112 for filename, source in iter(inputQueue.get, 'STOP'): |
113 result = __rawCodeMetrics(filename, source) |
113 result = __rawCodeMetrics(filename, source) |
114 output.put((filename, result)) |
114 outputQueue.put((filename, result)) |
115 |
115 |
116 |
116 |
117 def __rawCodeMetrics(file, text=""): |
117 def __rawCodeMetrics(file, text=""): |
118 """ |
118 """ |
119 Private function to calculate the raw code metrics for one Python file. |
119 Private function to calculate the raw code metrics for one Python file. |