RadonMetrics/CodeMetricsCalculator.py

changeset 13
22bc345844e7
parent 10
8b1920a22df3
child 37
7fd806094f0f
equal deleted inserted replaced
12:32a3c9d62e90 13:22bc345844e7
1 # -*- coding: utf-8 -*- 1 # -*- coding: utf-8 -*-
2 2
3 # Copyright (c) 2015 Detlev Offenbach <detlev@die-offenbachs.de> 3 # Copyright (c) 2015 Detlev Offenbach <detlev@die-offenbachs.de>
4 # 4 #
5 5
6 """
7 Module implementing the raw code metrics service.
8 """
9
6 from __future__ import unicode_literals 10 from __future__ import unicode_literals
7 11
8 try: 12 try:
9 str = unicode # __IGNORE_EXCEPTION __IGNORE_WARNING__ 13 str = unicode # __IGNORE_EXCEPTION__ __IGNORE_WARNING__
10 except NameError: 14 except NameError:
11 pass 15 pass
12 16
13 import multiprocessing 17 import multiprocessing
14 18
36 Private function to calculate the raw code metrics of one file. 40 Private function to calculate the raw code metrics of one file.
37 41
38 @param file source filename 42 @param file source filename
39 @type str 43 @type str
40 @param text source text 44 @param text source text
41 @param str 45 @type str
42 @return tuple containing the result dictionary 46 @return tuple containing the result dictionary
43 @rtype (tuple of dict) 47 @rtype (tuple of dict)
44 """ 48 """
45 return __rawCodeMetrics(file, text) 49 return __rawCodeMetrics(file, text)
46 50
47 51
48 def batchRawCodeMetrics(argumentsList, send, fx, cancelled): 52 def batchRawCodeMetrics(argumentsList, send, fx, cancelled):
49 """ 53 """
50 Module function to calculate the raw code metrics for a batch of files. 54 Module function to calculate the raw code metrics for a batch of files.
51 55
52 @param argumentsList list of arguments tuples as given for check 56 @param argumentsList list of arguments tuples as given for rawCodeMetrics
53 @type list 57 @type list
54 @param send reference to send function 58 @param send reference to send function
55 @type function 59 @type function
56 @param fx registered service name 60 @param fx registered service name
57 @type str 61 @type str
95 taskQueue.put('STOP') 99 taskQueue.put('STOP')
96 100
97 101
98 def worker(input, output): 102 def worker(input, output):
99 """ 103 """
100 Module function acting as the parallel worker for the style check. 104 Module function acting as the parallel worker for the raw code metrics
105 calculation.
101 106
102 @param input input queue 107 @param input input queue
103 @type multiprocessing.Queue 108 @type multiprocessing.Queue
104 @param output output queue 109 @param output output queue
105 @type multiprocessing.Queue 110 @type multiprocessing.Queue

eric ide

mercurial