Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #8534: autoattribute failed to document a commented attribute in alias class #8540

Merged
merged 2 commits into from
Dec 16, 2020

Conversation

tk0miya
Copy link
Member

@tk0miya tk0miya commented Dec 15, 2020

sphinx/ext/autodoc/__init__.py Show resolved Hide resolved
sphinx/ext/autodoc/__init__.py Show resolved Hide resolved
sphinx/ext/autodoc/__init__.py Outdated Show resolved Hide resolved
self._datadescriptor = True
else:
# if it's not a data descriptor
self._datadescriptor = False
except ImportError as exc:
if self.isinstanceattribute():
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll refactor this implementation at the next step.

…ribute in alias class

So far, autoattribute uses "given class name" to fetch comments of
uninitialized instance attributes.  But pycode expects to use "real"
class name on searching attribute comments.

This adds UninitializedInstanceAttributeMixin to handle it simply.
@@ -29,3 +29,6 @@ def __init__(self):

class Derived(Class):
attr7: int


Alias = Class
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would not work when this is an alias of Derived.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to work more to support it. So I'll do it on another PR.

@tk0miya tk0miya merged commit bec552c into sphinx-doc:3.x Dec 16, 2020
@tk0miya tk0miya deleted the 8534_autoattribute_alias branch December 16, 2020 14:47
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant