27 @return the entry point for the background client (function) |
27 @return the entry point for the background client (function) |
28 """ |
28 """ |
29 return batchRawCodeMetrics |
29 return batchRawCodeMetrics |
30 |
30 |
31 |
31 |
32 def rawCodeMetrics(file, text=""): # noqa: U100 |
32 def rawCodeMetrics( |
|
33 file, # noqa: U100 |
|
34 text="", |
|
35 ): |
33 """ |
36 """ |
34 Private function to calculate the raw code metrics of one file. |
37 Private function to calculate the raw code metrics of one file. |
35 |
38 |
36 @param file source filename |
39 @param file source filename |
37 @type str |
40 @type str |
142 @param text source text |
145 @param text source text |
143 @type str |
146 @type str |
144 @return tuple containing the result dictionary |
147 @return tuple containing the result dictionary |
145 @rtype (tuple of dict) |
148 @rtype (tuple of dict) |
146 """ |
149 """ |
147 from radon.raw import analyze |
150 from radon.raw import analyze # noqa: I102 |
148 |
151 |
149 try: |
152 try: |
150 res = __raw2Dict(analyze(text)) |
153 res = __raw2Dict(analyze(text)) |
151 except Exception as err: |
154 except Exception as err: |
152 res = {"error": str(err)} |
155 res = {"error": str(err)} |