-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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 incorrect fields in docstrings #1453
Conversation
The link in the return type was invalid, since `IO[bytes]` is not a single entity. As these tags will be redundant with the next major pydoctor release, I removed them rather than fixing the `@rtype`.
ILegacyLogObserver is the local name under which this interface is imported, but is not the actual class name.
The asterixes are not part of the parameter name itself, so they shouldn't be used in the docstring, unlike the `def` line. Future versions of pydoctor will warn about these asterixes.
Also correct the actual documented return type where a Python 2 `str` was still used instead of `bytes`.
In some cases a superfluous colon was preventing the name from being recognised as such, but in other cases the name was actually missing.
The docstring claimed that the method would both return -1 and raise an unspecified exception if the descriptor no longer has a valid file descriptor number associated with it. Some implementations within Twisted can return -1, while none of them raise an exception.
The code can no longer raise that exception, ever since commit e14cc81 ("Remove deprecated code that allowed passing non-bytes values.").
The mentioned functions from the `os` module don't document any particular exception types they might raise, but anything other than `OSError` seems unlikely.
The syntax of the `@raise` field requires an exception type and if we don't know the exception type because we're not the original raiser, `Exception` is the most specific we can be.
While the epytext parser can handle these cases gracefully, they are still syntactically incorrect.
These do not end up in the output. Future pydoctor versions will warn about them.
3c7d92e
to
9ca5eab
Compare
Epytext has a dedicated `@keyword` field for these. In the past, using `@param` worked just as well, but in the near future pydoctor will start warning about `@param` for parameters that aren't included in the function signature.
The signature of this method was changed in commit d55d2a0 ("Support encoding to new OpenSSH private key format"), but the docstring wasn't updated to match.
The parameters were made more explicit in commit 8f9ba2c ("Add type hints for twisted.internet.interfaces and twisted.internet.base"), but the docstring wasn't updated to match.
This method takes multiple domains, but was documented as taking only a single domain.
The documented `reactor` parameter does not exist, while the unrelated `threadFactory` parameter was undocumented.
9ca5eab
to
e975cf3
Compare
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.
This looks good. I didn't run pydoctor, but all these changes are clearly improvements. I did note one typo.
The only other thought I had is that there are several places documented as Exception
that might technically produce BaseException
. However that's always true so 🤷♂️ .
Thank you!
@@ -1588,9 +1588,6 @@ class IFileDescriptor(ILoggingContext): | |||
|
|||
def fileno() -> object: | |||
""" | |||
@raise: If the descriptor no longer has a valid file descriptor | |||
number associated with it. |
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.
It seems like a deficiency in the interface that there is no exception type defined for this. Oh well.
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.
None of the implementations within Twisted raise an exception though. Some return -1 if the descriptor is no longer valid.
I think the purpose of |
Co-authored-by: Tom Most <twm@freecog.net>
Contributor Checklist:
tox -e black-reformat
to format my patch to meet the Twisted Coding StandardI have updated the automated tests.review
to the keywords field in Trac, and putting a link to this PR in the comment; it shows up in https://twisted.reviews/ now.