Method: pylint.extensions._check_docs_utils.get_setters_property_name
Calls: 4, Exceptions: 0, Paths: 2Back
Path 1: 3 calls (0.75)
FunctionDef (3)
'foo' (2) 'foo_method' (1)
1def get_setters_property_name(node: nodes.FunctionDef) -> str | None:
2 """Get the name of the property that the given node is a setter for.
3
4 :param node: The node to get the property name for.
5 :type node: str
6
7 :rtype: str or None
8 :returns: The name of the property that the node is a setter for,
9 or None if one could not be found.
10 """
11 decorators = node.decorators.nodes if node.decorators else []
12 for decorator in decorators:
13 if (
14 isinstance(decorator, nodes.Attribute)
15 and decorator.attrname == "setter"
16 and isinstance(decorator.expr, nodes.Name)
17 ):
18 return decorator.expr.name # type: ignore[no-any-return]
19 return None
Path 2: 1 calls (0.25)
FunctionDef (1)
None (1)
1def get_setters_property_name(node: nodes.FunctionDef) -> str | None:
2 """Get the name of the property that the given node is a setter for.
3
4 :param node: The node to get the property name for.
5 :type node: str
6
7 :rtype: str or None
8 :returns: The name of the property that the node is a setter for,
9 or None if one could not be found.
10 """
11 decorators = node.decorators.nodes if node.decorators else []
12 for decorator in decorators:
13 if (
14 isinstance(decorator, nodes.Attribute)
15 and decorator.attrname == "setter"
16 and isinstance(decorator.expr, nodes.Name)
17 ):
18 return decorator.expr.name # type: ignore[no-any-return]
19 return None