File tree 3 files changed +18
-4
lines changed
3 files changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ public void delTrailingSpaces() {
27
27
private Stack <Obj > _visited ;
28
28
// In safe mode, do not try to call __repr__ on objects
29
29
private boolean _safe_mode ;
30
+ private boolean _full_strings ; // If long strings will be printed completely or with "abc ... xyz"
30
31
31
32
public ReprStream () {
32
33
_lines = new ArrayList <ReprStream .Line >();
@@ -35,6 +36,7 @@ public ReprStream() {
35
36
_visited = new Stack <Obj >();
36
37
_current_line = new Line (_current_indent );
37
38
_safe_mode = false ;
39
+ _full_strings = false ;
38
40
}
39
41
40
42
@@ -195,4 +197,13 @@ public void setSafeMode(boolean safe_mode) {
195
197
public boolean isSafeMode () {
196
198
return _safe_mode ;
197
199
}
200
+
201
+
202
+ public void setFullStrings (boolean b ) {
203
+ _full_strings = true ;
204
+ }
205
+
206
+ public boolean isFullStrings () {
207
+ return _full_strings ;
208
+ }
198
209
}
Original file line number Diff line number Diff line change @@ -313,7 +313,10 @@ public boolean hasMetaTable() {
313
313
314
314
/** Return a string representation of the dict */
315
315
private String dictStr () {
316
- return dictRepr (new ReprStream ()).toStringOneline ();
316
+ final boolean fullStr = true ;
317
+ ReprStream stream = new ReprStream ();
318
+ stream .setFullStrings (true );
319
+ return dictRepr (stream ).toString ();//.toStringOneline();
317
320
}
318
321
319
322
/** Return a string representation of the dict
Original file line number Diff line number Diff line change @@ -429,10 +429,10 @@ public boolean bool() {
429
429
430
430
@ Override
431
431
public ReprStream repr (ReprStream stream ) {
432
- if (_str .length () > 100 ) {
433
- stream .print (StringUtils .quote (_str .substring (0 , 30 ) + " ... " + _str .substring (_str .length ()-30 )));
434
- } else {
432
+ if (stream .isFullStrings () || _str .length () <= 100 ) {
435
433
stream .print (StringUtils .quote (_str ));
434
+ } else {
435
+ stream .print (StringUtils .quote (_str .substring (0 , 30 ) + " ... " + _str .substring (_str .length ()-30 )));
436
436
}
437
437
return stream ;
438
438
}
You can’t perform that action at this time.
0 commit comments