-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
[WIP] docs: use sphinx-autodoc-typehints, minor typing improvements #6665
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
Closed
Closed
Changes from all commits
Commits
Show all changes
3 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
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 |
|---|---|---|
|
|
@@ -2,3 +2,4 @@ pygments-pytest>=1.1.0 | |
| sphinx>=1.8.2,<2.1 | ||
| sphinxcontrib-trio | ||
| sphinx-removed-in>=0.2.0 | ||
| sphinx_autodoc_typehints | ||
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 |
|---|---|---|
|
|
@@ -2,7 +2,9 @@ | |
| import warnings | ||
| from collections import namedtuple | ||
| from collections.abc import MutableMapping | ||
| from typing import List | ||
| from typing import Set | ||
| from typing import Union | ||
|
|
||
| import attr | ||
|
|
||
|
|
@@ -147,8 +149,6 @@ class Mark: | |
| def combined_with(self, other): | ||
| """ | ||
| :param other: the mark to combine with | ||
| :type other: Mark | ||
blueyed marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| :rtype: Mark | ||
|
|
||
| combines by appending args and merging the mappings | ||
| """ | ||
|
|
@@ -249,13 +249,8 @@ def get_unpacked_marks(obj): | |
| return normalize_mark_list(mark_list) | ||
|
|
||
|
|
||
| def normalize_mark_list(mark_list): | ||
| """ | ||
| normalizes marker decorating helpers to mark objects | ||
|
|
||
| :type mark_list: List[Union[Mark, Markdecorator]] | ||
| :rtype: List[Mark] | ||
| """ | ||
| def normalize_mark_list(mark_list: List[Union[Mark, MarkDecorator]]) -> List[Mark]: | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| """normalizes marker decorating helpers to mark objects""" | ||
| extracted = [ | ||
| getattr(mark, "mark", mark) for mark in mark_list | ||
| ] # unpack MarkDecorator | ||
|
|
||
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bluetech
itemnot typed because ofcatch_log_handler{,s}being set/unset there.Ignoring any refactors I've wondered if a
ItemWithLoggingtype would make sense in general, which would have that attribute allowed then? (I do not think it is worth it, was just wondering)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might work, but because the attribute is added and deleted, it can't be entirely correct, and would require casts as well, so probably doesn't make sense.
As for refactor, seems like a good case for an "item-level storage" mechanism #3740. Such storage could be typed in some appropriate manner, probably.