Skip to content

Commit fd8d16c

Browse files
Fixed inheriting properties. 'Inherited' attribute is never displayed.
1 parent ff6da6a commit fd8d16c

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

pytkdocs_tweaks/__init__.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import pytkdocs.serializer
1515

1616

17-
__version__ = "0.0.5"
17+
__version__ = "0.0.6"
1818

1919

2020
_cachefile = pathlib.Path(".all_objects.cache")
@@ -145,17 +145,20 @@ def _postprocess(data, cache, bases):
145145
#
146146
new_docstring = ""
147147
if "inherited" in data["properties"]:
148+
data["properties"].remove("inherited")
148149
for base in bases:
149150
if data["name"] in _str_to_obj(base).__dict__:
150151
new_docstring = f"Inherited from [`{cache[base]}.{data['name']}`][]."
151152
break
152153
else:
153154
_base_obj = _str_to_obj(data["path"])
155+
if isinstance(_base_obj, property):
156+
# Property objects don't inherit module or qualname
157+
_base_obj = _base_obj.fget
154158
_base_path = _base_obj.__module__ + "." + _base_obj.__qualname__
155159
_base_config = {"objects": [{"path": _base_path}]}
156160
_base_result = pytkdocs.cli.process_config(_base_config)
157161
new_docstring = _base_result["objects"][0]["docstring"]
158-
data["properties"].remove("inherited")
159162
if bases is not None:
160163
for base in bases:
161164
_base_obj = _str_to_obj(base)

0 commit comments

Comments
 (0)