Open l3ender opened 3 years ago
Hi! There isn't a friendly way to configure this at the moment, but you could edit q.py
to achieve this by altering the maxdict
and maxstring
attributes, which control the maximum number of dictionary items and maximum number of characters in a string that are shown. You can do this by setting the appropriate attribute just after line 95:
TEXT_REPR = pydoc.TextRepr() # this is line 95
TEXT_REPR.maxdict = 20
TEXT_REPR.maxstring = 500
It seems like any changes I make to q.py
don't get used when I next run my script. I'm using a virtual environment and editing the file in the virtual env, like:
./venv/lib/python3.9/site-packages/q.py
I've added the TEXT_REPR.maxdict = 20
line, but still don't see the change:
-> python
Python 3.9.1 (default, Dec 10 2020, 10:36:35)
[Clang 12.0.0 (clang-1200.0.32.27)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import q
>>> q.TEXT_REPR.maxdict
10
Is there anything else I need to do, or am I editing the wrong file?
I think all truncation needs to be disabled by default. This is a wonderful debugging tool, but cutting off debugging data is counterproductive
FYI, raised a PR (https://github.com/zestyping/q/pull/60) to address the truncation, assuming this repo is still maintained.
The default truncation levels are far too short for someone debugging.
If the default trunction is still desired, enter: "q.short" in your script.
Long trucation is set by default and can be explitly set by: "q.long"
The truncation can be manuall set by: "q.long = 2000000"
I've noticed the following when using
q
:...
in the middle....
.Example:
Is there a way to prevent it? I'm not very proficient in python so my apologies if this is a simple question. Thanks!!