MCPcopy Index your code
hub / github.com/python/mypy / _get_decorator_bool_argument

Function _get_decorator_bool_argument

mypy/plugins/common.py:55–63  ·  view source on GitHub ↗

Return the bool argument for the decorator. This handles both @decorator(...) and @decorator.

(ctx: ClassDefContext, name: str, default: bool)

Source from the content-addressed store, hash-verified

53
54
55def _get_decorator_bool_argument(ctx: ClassDefContext, name: str, default: bool) -> bool:
56 """Return the bool argument for the decorator.
57
58 This handles both @decorator(...) and @decorator.
59 """
60 if isinstance(ctx.reason, CallExpr):
61 return _get_bool_argument(ctx, ctx.reason, name, default)
62 else:
63 return default
64
65
66def _get_bool_argument(ctx: ClassDefContext, expr: CallExpr, name: str, default: bool) -> bool:

Callers 3

_get_bool_argMethod · 0.90
_get_frozenFunction · 0.90

Calls 2

isinstanceFunction · 0.85
_get_bool_argumentFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…