Method: pylint.checkers.classes.class_checker.ClassChecker._check_first_arg_config
Calls: 143, Exceptions: 0, Paths: 2Back
Path 1: 135 calls (0.94)
'cls' (130) 'mcs' (5)
('cls',) (130) ('mcs',) (5)
FunctionDef (134) AsyncFunctionDef (1)
'bad-classmethod-argument' (96) 'bad-mcs-method-argument' (34) 'bad-mcs-classmethod-argument' (5)
'__new__' (19) '__init_subclass__' (5) '__class_getitem__' (4) 'func' (3) '__getitem__' (3) '__iter__' (3) 'from_string' (3) '_' (3) 'method' (3) 'cla...
1def _check_first_arg_config(
2 self,
3 first: str | None,
4 config: Sequence[str],
5 node: nodes.FunctionDef,
6 message: str,
7 method_name: str,
8 ) -> None:
9 if first not in config:
10 if len(config) == 1:
11 valid = repr(config[0])
12 else:
13 valid = ", ".join(repr(v) for v in config[:-1])
14 valid = f"{valid} or {config[-1]!r}"
15 self.add_message(message, args=(method_name, valid), node=node)
Path 2: 8 calls (0.06)
'other' (4) 'self' (2) 'something' (1) 'mcls' (1)
('cls',) (5) ('mcs',) (3)
FunctionDef (8)
'bad-classmethod-argument' (3) 'bad-mcs-classmethod-argument' (3) 'bad-mcs-method-argument' (2)
'__new__' (3) 'class2' (2) 'c' (1) 'method2' (1) '__iter__' (1)
1def _check_first_arg_config(
2 self,
3 first: str | None,
4 config: Sequence[str],
5 node: nodes.FunctionDef,
6 message: str,
7 method_name: str,
8 ) -> None:
9 if first not in config:
10 if len(config) == 1:
11 valid = repr(config[0])
12 else:
13 valid = ", ".join(repr(v) for v in config[:-1])
14 valid = f"{valid} or {config[-1]!r}"
15 self.add_message(message, args=(method_name, valid), node=node)