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

Add parsing of nested classes #176

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

angeloskath
Copy link

Nested classes are incorrectly parsed as class variables. This commit fixes that and adds a method all_classes in Module that returns even the nested classes.

Thanks,
Angelos

* Parse nested classes and present them in the class list
* Changes _pep224_docstrings to use Doc.source instead of inspect to keep it
  DRY
Copy link
Member

@kernc kernc left a comment

Choose a reason for hiding this comment

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

I'm thinking maybe we should actually make this the default (i.e. change Module.classes() directly). Classes are classes, not variables, and if they are exposed and meant to be used (they should probably not be nested), they better be documented thoroughly.

This also needs a unit test in pdoc.test.__init__.

try:
tree = ast.parse(inspect.getsource(doc_obj.obj))
tree = ast.parse(source)
Copy link
Member

@kernc kernc Apr 11, 2020

Choose a reason for hiding this comment

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

This makes sense, but could you merge the two into the same error. ast.parse() surely throws something on an empty string or a None derived from empty_string or None?

@kernc kernc added enhancement New feature or request help wanted Extra attention is needed labels Apr 16, 2020
@angeloskath
Copy link
Author

Hi, thanks for considering this.

I can make the requested changes and add the test maybe from Monday. I am just sending so that you know I haven't just dropped this here and left :-).

Cheers,
Angelos

@kernc
Copy link
Member

kernc commented Jun 1, 2020

No hurry, but this would sure make a nice addition! 😃

@frank101010
Copy link
Contributor

frank101010 commented Mar 30, 2022

Pull request #390 contains most of angeloskath's changes, but based on pdoc3, commit 2cce30a (March 2022).

(deleted section about unit test problems, which were resolved after running tests on an os supporting symbolic links)

@kernc kernc force-pushed the master branch 3 times, most recently from 456869b to 94d26e8 Compare June 25, 2024 20:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Development

Successfully merging this pull request may close these issues.

3 participants