Repository navigation
Document a submodule that shares its name with a member - #487
Open
Cherith1222 wants to merge 1 commit into
Open
Cherith1222 wants to merge 1 commit into
Cherith1222 wants to merge 1 commit into
Conversation
A function, class, or variable already stored in Module.doc used the same key as a child module, so that submodule was skipped. Keep the member and record the submodule beside it. Fixes pdoc3#452
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
Module.docis keyed by short name. When a function, class, or variable already used that name,iter_modulestreatedroot in self.docas already documented and skipped the submodule.A submodule is now skipped only when that submodule is already present. The member keeps the short-name key. The submodule is stored as
name:module.submodules()selects by type, so both appear. The existing member keeps the refname, so short-name links still resolve to the member. When there is no name clash, the submodule stays atdoc[short name].Fixes #452
Tests
Python 3.12.3:
python -m unittest -v pdoc.test— 84 tests, OK. 2 skipped (parseris gone on 3.10+, andPDOC_TEST_PANDOCwas unset). 1 expected failure.flake8 pdoc setup.pypassed.mypy -p pdocsucceeded (61 source files).doc/build.shwas not run.Before the change, the new test only kept
pdoc_issue_452.plainand dropped the same-namedwidgetandgadgetsubmodules.These tests ran in the environment that prepared the branch. They were not re-run on the machine that opened this pull request.
AI usage
This change was drafted with AI assistance (Cursor Grok).