Skip to content

Commit

Permalink
Explain method
Browse files Browse the repository at this point in the history
  • Loading branch information
hynek committed Mar 21, 2024
1 parent bc47488 commit 1b07d97
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/attr/_make.py
Original file line number Diff line number Diff line change
Expand Up @@ -3036,6 +3036,11 @@ def _get_global_name(attr_name: str) -> str:
return f"__attr_converter_{attr_name}"

def _fmt_converter_call(self, attr_name: str, value_var: str) -> str:
"""
Return a string that calls the converter for an attribute name
*attr_name* and the value in variable named *value_var* according to
`self.takes_self` and `self.takes_field`.
"""
if not (self.takes_self or self.takes_field):
return f"{self._get_global_name(attr_name)}({value_var})"

Expand Down

0 comments on commit 1b07d97

Please sign in to comment.