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