Skip to content

Commit fdccaa5

Browse files
committed
Add docstrings to sphinx_cached_property.py
1 parent ec89dd2 commit fdccaa5

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/attrs/sphinx_cached_property.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,19 @@
1515
def get_cached_property_for_member_descriptor(
1616
cls: type, name: str, default=None
1717
):
18+
"""If the attribute is for a cached property, return the ``cached_property``
19+
20+
Otherwise, delegate to normal ``getattr``
21+
22+
"""
1823
props = getattr(cls, "__attrs_cached_properties__", None)
1924
if props is None or name not in props:
2025
return getattr(cls, name, default)
2126
return props[name]
2227

2328

2429
def setup(app: Sphinx):
30+
"""Install the special attribute getter for cached properties of slotted classes"""
2531
app.add_autodoc_attrgetter(
2632
object, get_cached_property_for_member_descriptor
2733
)

0 commit comments

Comments
 (0)