RadonMetrics/MaintainabilityIndexCalculator.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 maintainability index 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 import sys 18 import sys
37 Private function to calculate the maintainability index of one file. 41 Private function to calculate the maintainability index of one file.
38 42
39 @param file source filename 43 @param file source filename
40 @type str 44 @type str
41 @param text source text 45 @param text source text
42 @param str 46 @type str
43 @return tuple containing the result dictionary 47 @return tuple containing the result dictionary
44 @rtype (tuple of dict) 48 @rtype (tuple of dict)
45 """ 49 """
46 return __maintainabilityIndex(file, text) 50 return __maintainabilityIndex(file, text)
47 51
49 def batchMaintainabilityIndex(argumentsList, send, fx, cancelled): 53 def batchMaintainabilityIndex(argumentsList, send, fx, cancelled):
50 """ 54 """
51 Module function to calculate the maintainability index for a batch of 55 Module function to calculate the maintainability index for a batch of
52 files. 56 files.
53 57
54 @param argumentsList list of arguments tuples as given for check 58 @param argumentsList list of arguments tuples as given for
59 maintainabilityIndex
55 @type list 60 @type list
56 @param send reference to send function 61 @param send reference to send function
57 @type function 62 @type function
58 @param fx registered service name 63 @param fx registered service name
59 @type str 64 @type str
97 taskQueue.put('STOP') 102 taskQueue.put('STOP')
98 103
99 104
100 def worker(input, output): 105 def worker(input, output):
101 """ 106 """
102 Module function acting as the parallel worker for the style check. 107 Module function acting as the parallel worker for the maintainability
108 index calculation.
103 109
104 @param input input queue 110 @param input input queue
105 @type multiprocessing.Queue 111 @type multiprocessing.Queue
106 @param output output queue 112 @param output output queue
107 @type multiprocessing.Queue 113 @type multiprocessing.Queue

eric ide

mercurial