MCPcopy
hub / github.com/python-attrs/attrs / fmt_setter_with_converter

Function fmt_setter_with_converter

src/attr/_make.py:2131–2142  ·  view source on GitHub ↗
(
            attr_name: str,
            value_var: str,
            has_on_setattr: bool,
            converter: Converter,
        )

Source from the content-addressed store, hash-verified

2129 return f"_inst_dict['{attr_name}'] = {value_var}"
2130
2131 def fmt_setter_with_converter(
2132 attr_name: str,
2133 value_var: str,
2134 has_on_setattr: bool,
2135 converter: Converter,
2136 ) -> str:
2137 if has_on_setattr or _is_slot_attr(attr_name, base_attr_map):
2138 return _setattr_with_converter(
2139 attr_name, value_var, has_on_setattr, converter
2140 )
2141
2142 return f"_inst_dict['{attr_name}'] = {converter._fmt_converter_call(attr_name, value_var)}"
2143
2144 return (
2145 ("_inst_dict = self.__dict__",),

Callers 1

_attrs_to_init_scriptFunction · 0.85

Calls 3

_is_slot_attrFunction · 0.85
_setattr_with_converterFunction · 0.85
_fmt_converter_callMethod · 0.80

Tested by

no test coverage detected