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

Method _get_bool_arg

mypy/plugins/dataclasses.py:864–877  ·  view source on GitHub ↗
(self, name: str, default: bool)

Source from the content-addressed store, hash-verified

862 return False, {}
863
864 def _get_bool_arg(self, name: str, default: bool) -> bool:
865 # Expressions are always CallExprs (either directly or via a wrapper like Decorator), so
866 # we can use the helpers from common
867 if isinstance(self._reason, Expression):
868 return _get_decorator_bool_argument(
869 ClassDefContext(self._cls, self._reason, self._api), name, default
870 )
871
872 # Subclass/metaclass use of `typing.dataclass_transform` reads the parameters from the
873 # class's keyword arguments (ie `class Subclass(Parent, kwarg1=..., kwarg2=...)`)
874 expression = self._cls.keywords.get(name)
875 if expression is not None:
876 return require_bool_literal_argument(self._api, expression, name, default)
877 return default
878
879 def _get_default_init_value_for_field_specifier(self, call: Expression) -> bool:
880 """

Callers 2

transformMethod · 0.95
collect_attributesMethod · 0.95

Calls 5

ClassDefContextClass · 0.90
isinstanceFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected