Refactor inspect info reply logic #13863
Merged
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.
This refactors the logic of the inspector
_get_info
function to make it easier to override and extend its behavior. This PR should not affect the overall function of_get_info
.We factor out the logic to append an info field to the inspect_reply mimebundle and the logic for what information is in the mimebundle into separate functions that can easily be overridden by an inspector subclass. This allows a subclass to easily:
without having to copy the default implementation.
We also refactor and simplify the logic around formatting text/plain and text/html mimetypes in the inspect reply.
We also fix an escaping bug with the default html formatter so that the default docstrings
<no docstring>
appears instead of being interpreted as an HTML tag.