--- a/src/eric7/DataViews/CodeMetrics.py Tue Dec 19 11:04:03 2023 +0100 +++ b/src/eric7/DataViews/CodeMetrics.py Tue Dec 19 19:57:08 2023 +0100 @@ -55,7 +55,8 @@ """ Public method used to parse the source code. - @param text the source code as read from a Python source file + @param text source code as read from a Python source file + @type str """ self.tokenlist = [] @@ -93,11 +94,16 @@ """ Private method used to add a token to our list of tokens. - @param toktype the type of the token (int) - @param toktext the text of the token (string) - @param srow starting row of the token (int) - @param scol starting column of the token (int) - @param line logical line the token was found (string) + @param toktype the type of the token + @type int + @param toktext the text of the token + @type str + @param srow starting row of the token + @type int + @param scol starting column of the token + @type int + @param line logical line the token was found + @type str """ self.tokenlist.append( Token(type=toktype, text=toktext, row=srow, col=scol, line=line) @@ -131,7 +137,8 @@ """ Public method used to decrement the indentation level. - @param tok the token to be processed (Token) + @param tok the token to be processed + @type Token @exception ValueError raised to indicate an invalid indentation level """ self.indent_level -= 1 @@ -150,8 +157,10 @@ """ Public method used to store an identifier. - @param identifier the identifier to be remembered (string) - @param row the row, the identifier is defined in (int) + @param identifier the identifier to be remembered + @type str + @param row row, the identifier is defined in + @type int """ qualified = ( self.active[-1][0] + "." + identifier @@ -165,8 +174,10 @@ """ Public method used to increment the value of a key. - @param key the key to be incremented - @param value the increment (int) + @param key key to be incremented + @type str + @param value the increment + @type int """ for counterId, _level, _row in self.active: counters = self.counters.setdefault(counterId, {}) @@ -176,9 +187,12 @@ """ Public method used to get a specific counter value. - @param counterId id of the counter (string) - @param key key of the value to be retrieved (string) - @return the value of the requested counter (int) + @param counterId id of the counter + @type str + @param key key of the value to be retrieved + @type str + @return the value of the requested counter + @rtype int """ return self.counters.get(counterId, {}).get(key, 0) @@ -187,10 +201,14 @@ """ Module function used to collect overall statistics. - @param total the dictionary for the overall statistics - @param key the key to be summarize - @param value the value to be added to the overall statistics + @param total dictionary of overall statistics + @type dict + @param key key to be summarized + @type str + @param value value to be added to the overall statistics + @type int @return the value added to the overall statistics + @rtype int """ total[key] = total.setdefault(key, 0) + value return value @@ -200,9 +218,12 @@ """ Module function used analyze the source of a Python file. - @param filename name of the Python file to be analyzed (string) + @param filename name of the Python file to be analyzed + @type str @param total dictionary receiving the overall code statistics - @return a statistics object with the collected code statistics (SourceStat) + @type dict + @return a statistics object with the collected code statistics + @rtype SourceStat """ try: text = Utilities.readEncodedFile(filename)[0]