Replies: 5 comments 4 replies
-
What do you mean re "json object"? If it's a string, it will be truncated. If it's a dict / list then the number of elements will be truncated to I'm not convinced it would be a good idea to truncate other object's |
Beta Was this translation helpful? Give feedback.
-
yes - that isn't a real dict. It is a geojson.FeatureCollection object.
…On Thu, May 27, 2021 at 9:21 PM Will McGugan ***@***.***> wrote:
It might be res["WF"] that isn't a real dict.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1258 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AASGMYXQPTFTS4XP23VOBETTP2LT5ANCNFSM45UY2PPA>
.
|
Beta Was this translation helpful? Give feedback.
-
and I have the latest version installed.
…On Thu, May 27, 2021 at 10:53 PM Holger Hoefling ***@***.***> wrote:
yes - that isn't a real dict. It is a geojson.FeatureCollection object.
On Thu, May 27, 2021 at 9:21 PM Will McGugan ***@***.***>
wrote:
> It might be res["WF"] that isn't a real dict.
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> <#1258 (reply in thread)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AASGMYXQPTFTS4XP23VOBETTP2LT5ANCNFSM45UY2PPA>
> .
>
|
Beta Was this translation helpful? Give feedback.
-
Ok, thanks for looking into it. Alternatively could the pretty-printing
module allow for a function to be passed in that handle the printing for
certain objects? e.g., a function for printing all objects inheriting from
an arbitrary base class? Truncating long representations with an ellipsis
would then be a special case of this (where you pass a method that handles
printing for all objects inheriting from "Object" and just cut off the
result. Truncating strings at max_length would also be a special case.
But in any case - thanks so much for this library. It is super useful as it
is.
…On Fri, May 28, 2021 at 12:08 PM Will McGugan ***@***.***> wrote:
Ah, so in that case Rich will just call the __repr__ which is returning a
very long string.
It would be possible for Rich to truncate those with an ellipsis, but the
result would not be as readable as other containers.
There is a protocol in Rich where a special method can be added to allow
pretty printing of unknown object types, but it's not fully fleshed out
yet. Once that's ready you could perhaps convince the geo Django devs to
add it. It wouldn't even require Rich as a dependency.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1258 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AASGMYWQS72RXAUZZQFS4X3TP5TRPANCNFSM45UY2PPA>
.
|
Beta Was this translation helpful? Give feedback.
-
Just wanted to add to this, that similar problems occur for numpy arrays, for pytorch tensors, for pytorch models etc. Long 'repr' for objects are relatively common. I had to switch off the "locals" again, as it just was not practical. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I am getting very long tracebacks in "locals". This is despite max_string and max_length. Looking at the code, it looks like only strings are being truncated, no other objects. The representation of other objects is used as is (see pretty.traverse) and with some objects these can be very long (e.g. json objects).
Does anyone have a suggestion on how to deal with it, or should this be a feature request (e.g. to limit string-representations of objects also to the max_string length.
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions