-
Notifications
You must be signed in to change notification settings - Fork 58
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
Add Converter.to_info
to customize info
and search
#1884
base: main
Are you sure you want to change the base?
Conversation
Leave search usage as a hasattr(__asdf_traverse__) check since search doesn't have access to an extension manager Update info usage to allow use of an extension manager
Converter.to_info
to customize info
and search
The stdatamodels downstream failure is unrelated: spacetelescope/stdatamodels#371 |
This is a nice feature. I wonder if there should be a keyword option to suppress this option in the cases it will really blow up the output (tables with lots of columns, or a very complex GWCS). |
Thanks for giving it a look. At the moment the output is subject to the
and then to:
There is also an existing
That output doesn't look too helpful so one option might be to not use We could add a flag
At the moment I'm leaning towards relying on |
I worry that if the very lengthy item comes before items of interest, |
While working on this and #1875 I noticed that
In this case the
Because
I think the existing
As you noted the details about how |
Description
This PR adds support for a new
Converter
methodto_info
. This new method is for converting a custom object to an "info" container (list, tuple, dict) to provide additional information duringinfo
(and as a side effect duringsearch
since this uses common code in_node_info.py
).To provide an example where this is useful. Currently an
AsdfFile
with an astropyTable
renders with largely unhelpfulinfo
:With this PR the
Table
(andColumn
)Converter
s in asdf-astropy can be updated (only theTableConverter
update shown here).to improve the output:
This has the added benefit of allowing
search
to find column names for the above example:This PR uses the
Converter.to_info
feature to implement custom information ofndarray
/NDArrayType
. On main the following:produces:
with this PR the output is different:
During working on this feature several bugs were uncovered and a few were fixed:
info
search
andschema_info
do not use theAsdfFile.extension_manager
#1882info
output garbled when terminal does not support formatting #1889info
can loop infinitely leaking memory if passed a recursive list #1890Fixes #1882 #1889 #1890
Tasks
pre-commit
on your machinepytest
on your machineno-changelog-entry-needed
)changes/
:echo "changed something" > changes/<PR#>.<changetype>.rst
(see below for change types)docs/
pagenews fragment change types...
changes/<PR#>.feature.rst
: new featurechanges/<PR#>.bugfix.rst
: bug fixchanges/<PR#>.doc.rst
: documentation changechanges/<PR#>.removal.rst
: deprecation or removal of public APIchanges/<PR#>.general.rst
: infrastructure or miscellaneous change