Method: pylint.checkers.logging._count_supplied_tokens
Calls: 59, Exceptions: 0, Paths: 1Back
Path 1: 59 calls (1.0)
list (46) [] (13)
1 (27) 2 (16) 0 (13) 3 (3)
1def _count_supplied_tokens(args: list[nodes.NodeNG]) -> int:
2 """Counts the number of tokens in an args list.
3
4 The Python log functions allow for special keyword arguments: func,
5 exc_info and extra. To handle these cases correctly, we only count
6 arguments that aren't keywords.
7
8 Args:
9 args: AST nodes that are arguments for a log format string.
10
11 Returns:
12 Number of AST nodes that aren't keywords.
13 """
14 return sum(1 for arg in args if not isinstance(arg, nodes.Keyword))