forked from sphinx-doc/sphinx
-
Notifications
You must be signed in to change notification settings - Fork 0
fix: keep autodoc type alias docstrings #77
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
Open
casey-brooks
wants to merge
2
commits into
sphinx-doc__sphinx-9229
Choose a base branch
from
fix/type-alias-docstrings-ast-constant
base: sphinx-doc__sphinx-9229
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| import os | ||
| import sys | ||
|
|
||
| sys.path.insert(0, os.path.abspath('.')) | ||
|
|
||
| extensions = ['sphinx.ext.autodoc'] |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| Type Alias Docstring Fixtures | ||
| ============================= | ||
|
|
||
| .. automodule:: type_alias_docstrings |
36 changes: 36 additions & 0 deletions
36
tests/roots/test-ext-autodoc-typealias/type_alias_docstrings.py
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| """Fixtures for type alias docstring handling tests.""" | ||
|
|
||
| from pathlib import Path | ||
| from typing import Any, Callable, Dict, Optional | ||
|
|
||
|
|
||
| ScaffoldOpts = Dict[str, Any] | ||
| """Dictionary with PyScaffold's options, see ``pyscaffold.api.create_project``. | ||
| Should be treated as immutable (copy before mutating). | ||
|
|
||
| Please notice some behaviours given by the options **SHOULD** be observed. For | ||
| example, files should be overwritten when the **force** option is ``True``. | ||
| Similarly when **pretend** is ``True``, no operation should be really | ||
| performed, but any action should be logged as if realized. | ||
| """ | ||
|
|
||
|
|
||
| FileContents = Optional[str] | ||
| """When the file content is ``None``, the file should not be written to disk. | ||
| Empty files are represented by an empty string ``""`` as content. | ||
| """ | ||
|
|
||
|
|
||
| FileOp = Callable[[Path, FileContents, ScaffoldOpts], Optional[Path]] | ||
| """Signature of functions considered file operations:: | ||
|
|
||
| Callable[[Path, FileContents, ScaffoldOpts], Optional[Path]] | ||
|
|
||
| - **path** (:class:`pathlib.Path`): file path potentially written to disk. | ||
| - **contents** (:obj:`FileContents`): usual text content. :obj:`None` skips | ||
| writing the file. | ||
| - **opts** (:obj:`ScaffoldOpts`): a dict with PyScaffold's options. | ||
|
|
||
| If a file is written (or permissions are changed) the implementation should | ||
| return the :class:`pathlib.Path`. Otherwise :obj:`None` should be returned. | ||
| """ | ||
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
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.
Uh oh!
There was an error while loading. Please reload this page.