Splitting the verbose JSON dump for results from earthaccess.search_datasets
from the __repr__
method?
#827
scottstanie
started this conversation in
Ideas
Replies: 1 comment 8 replies
-
@scottstanie I think this is a good idea and there's a bit we can improve here. We'll have to figure out exactly what we mean by:
and I think in general we could go a bit farther; we return just plain lists of objects, but a results class could then summarize the results better and allow you to combine multiple search results, etc. |
Beta Was this translation helpful? Give feedback.
8 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
While searching and playing with some of the results from
search_datasets
on the command line/jupyter, I noticed that the default for seeing theearthaccess.results.DataCollection
is to see the entirejson.dumps
of the object:I usually expect the
repr
to be just the information you might use to recreate it (ideally in the format where you can just copy/paste it back in).So just to put out the idea: it would be nice to have the
__repr__
be console/developer friendly, and to have the json dumps come either from__str__
, or from a separate method so that you don't accidentally dump > 500 lines to the console.Examples of what I mean:
which you can copy/paste to recreate that object.
To make it prettier, the
str
method is the one that applies formatting:Another good example is from
pydantic
:to pretty-format (or dump to json), they have a
model_dump
method:Beta Was this translation helpful? Give feedback.
All reactions