Path 1: 188 calls (1.0)

('not-an-iterable',) (7) ('non-ascii-name',) (5) ('boolean-datetime',) (4) ('implicit-str-concat',) (4) ('disallowed-name', 'invalid-name') (4) ('wron...

only_required_for_messages..store_messages def (188)

1def only_required_for_messages(
2    *messages: str,
3) -> Callable[
4    [AstCallbackMethod[_CheckerT, _NodeT]], AstCallbackMethod[_CheckerT, _NodeT]
5]:
6    """Decorator to store messages that are handled by a checker method as an
7    attribute of the function object.
8
9    This information is used by ``ASTWalker`` to decide whether to call the decorated
10    method or not. If none of the messages is enabled, the method will be skipped.
11    Therefore, the list of messages must be well maintained at all times!
12    This decorator only has an effect on ``visit_*`` and ``leave_*`` methods
13    of a class inheriting from ``BaseChecker``.
14    """
15
16    def store_messages(
17        func: AstCallbackMethod[_CheckerT, _NodeT]
18    ) -> AstCallbackMethod[_CheckerT, _NodeT]:
19        func.checks_msgs = messages  # type: ignore[attr-defined]
20        return func
21
22    return store_messages