peek-python 1.4.1__tar.gz → 1.4.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {peek_python-1.4.1 → peek_python-1.4.3}/PKG-INFO +208 -204
- {peek_python-1.4.1 → peek_python-1.4.3}/README.md +207 -203
- {peek_python-1.4.1 → peek_python-1.4.3}/peek/peek.py +10 -653
- {peek_python-1.4.1 → peek_python-1.4.3}/peek_python.egg-info/PKG-INFO +208 -204
- {peek_python-1.4.1 → peek_python-1.4.3}/pyproject.toml +1 -1
- {peek_python-1.4.1 → peek_python-1.4.3}/tests/test_peek.py +255 -249
- {peek_python-1.4.1 → peek_python-1.4.3}/license.txt +0 -0
- {peek_python-1.4.1 → peek_python-1.4.3}/peek/__init__.py +0 -0
- {peek_python-1.4.1 → peek_python-1.4.3}/peek_python.egg-info/SOURCES.txt +0 -0
- {peek_python-1.4.1 → peek_python-1.4.3}/peek_python.egg-info/dependency_links.txt +0 -0
- {peek_python-1.4.1 → peek_python-1.4.3}/peek_python.egg-info/top_level.txt +0 -0
- {peek_python-1.4.1 → peek_python-1.4.3}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: peek-python
|
|
3
|
-
Version: 1.4.
|
|
3
|
+
Version: 1.4.3
|
|
4
4
|
Summary: peek - debugging and benchmarking made easy
|
|
5
5
|
Author-email: Ruud van der Ham <rt.van.der.ham@gmail.com>
|
|
6
6
|
Project-URL: Homepage, https://github.com/salabim/ycecream
|
|
@@ -12,17 +12,20 @@ Requires-Python: >=3.6
|
|
|
12
12
|
Description-Content-Type: text/markdown
|
|
13
13
|
License-File: license.txt
|
|
14
14
|
|
|
15
|
-
<img src="https://salabim.org/peek/
|
|
15
|
+
<img src="https://www.salabim.org/peek/peek_logo1.png">
|
|
16
16
|
|
|
17
17
|
# Introduction
|
|
18
18
|
|
|
19
|
-
Do you
|
|
19
|
+
Do you use `print()` or `log()` to debug your code?
|
|
20
|
+
If so, peek will make printing debug information really easy.
|
|
20
21
|
And on top of that, you get some basic benchmarking functionality.
|
|
21
22
|
|
|
22
23
|
# Table of contents
|
|
23
24
|
|
|
24
25
|
* [Installation](#installation)
|
|
25
26
|
|
|
27
|
+
* [Importing peek](#importing-peek)
|
|
28
|
+
|
|
26
29
|
* [Inspect variables and expressions](#inspect-variables-and-expressions)
|
|
27
30
|
|
|
28
31
|
* [Inspect execution](#inspect-execution)
|
|
@@ -83,6 +86,22 @@ Alternatively, peek.py can be juist copied into you current work directory from
|
|
|
83
86
|
|
|
84
87
|
No dependencies!
|
|
85
88
|
|
|
89
|
+
# Importing peek
|
|
90
|
+
|
|
91
|
+
All you need is
|
|
92
|
+
|
|
93
|
+
```
|
|
94
|
+
import peek
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
to use the module.
|
|
98
|
+
|
|
99
|
+
Alternatively, it is possible to use the more verbose, more standard way of importing:
|
|
100
|
+
|
|
101
|
+
```
|
|
102
|
+
from peek import peek
|
|
103
|
+
```
|
|
104
|
+
|
|
86
105
|
|
|
87
106
|
# Inspect variables and expressions
|
|
88
107
|
|
|
@@ -98,17 +117,15 @@ or the more thorough
|
|
|
98
117
|
```
|
|
99
118
|
print("add2(1000)", add2(1000)))
|
|
100
119
|
```
|
|
101
|
-
or
|
|
120
|
+
or:
|
|
102
121
|
```
|
|
103
|
-
print(f"{add2(1000)
|
|
122
|
+
print(f"{add2(1000)=}")
|
|
104
123
|
```
|
|
105
124
|
|
|
106
125
|
then `peek()` is here to help. With arguments, `peek()` inspects itself and prints
|
|
107
126
|
both its own arguments and the values of those arguments.
|
|
108
127
|
|
|
109
128
|
```
|
|
110
|
-
import peek
|
|
111
|
-
|
|
112
129
|
def add2(i):
|
|
113
130
|
return i + 2
|
|
114
131
|
|
|
@@ -117,13 +134,12 @@ peek(add2(1000))
|
|
|
117
134
|
|
|
118
135
|
prints
|
|
119
136
|
```
|
|
120
|
-
|
|
137
|
+
add2(1000)=1002
|
|
121
138
|
```
|
|
122
139
|
|
|
123
140
|
Similarly,
|
|
124
141
|
|
|
125
142
|
```
|
|
126
|
-
import peek
|
|
127
143
|
class X:
|
|
128
144
|
a = 3
|
|
129
145
|
world = {"EN": "world", "NL": "wereld", "FR": "monde", "DE": "Welt"}
|
|
@@ -133,7 +149,7 @@ peek(world, X.a)
|
|
|
133
149
|
|
|
134
150
|
prints
|
|
135
151
|
```
|
|
136
|
-
|
|
152
|
+
world={"EN": "world ", "NL": "wereld", "FR": "monde", "DE": "Welt"}, X.a: 3
|
|
137
153
|
```
|
|
138
154
|
Just give `peek()` a variable or expression and you're done. Sweet, isn't it?
|
|
139
155
|
|
|
@@ -155,7 +171,6 @@ then `peek()` helps here, too. Without arguments, `peek()` inspects itself and
|
|
|
155
171
|
prints the calling line number and -if applicable- the file name and parent function.
|
|
156
172
|
|
|
157
173
|
```
|
|
158
|
-
import peek
|
|
159
174
|
def add2(i):
|
|
160
175
|
peek()
|
|
161
176
|
result = i + 2
|
|
@@ -166,9 +181,9 @@ peek(add2(1000))
|
|
|
166
181
|
|
|
167
182
|
prints something like
|
|
168
183
|
```
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
184
|
+
#3 in add2()
|
|
185
|
+
#5 in add2()
|
|
186
|
+
add2(1000)=1002
|
|
172
187
|
```
|
|
173
188
|
Just call `peek()` and you're done. Isn't that sweet?
|
|
174
189
|
|
|
@@ -179,7 +194,6 @@ Just call `peek()` and you're done. Isn't that sweet?
|
|
|
179
194
|
pre-existing code.
|
|
180
195
|
|
|
181
196
|
```
|
|
182
|
-
import peek
|
|
183
197
|
def add2(i):
|
|
184
198
|
return i + 2
|
|
185
199
|
b = peek(add2(1000))
|
|
@@ -187,8 +201,8 @@ peek(b)
|
|
|
187
201
|
```
|
|
188
202
|
prints
|
|
189
203
|
```
|
|
190
|
-
|
|
191
|
-
|
|
204
|
+
add2(1000): 1002
|
|
205
|
+
b: 1002
|
|
192
206
|
```
|
|
193
207
|
# Debug entry and exit of function calls
|
|
194
208
|
|
|
@@ -196,7 +210,6 @@ When you apply `peek()` as a decorator to a function or method, both the entry a
|
|
|
196
210
|
The (keyword) arguments passed will be shown and upon return, the return value.
|
|
197
211
|
|
|
198
212
|
```
|
|
199
|
-
import peek
|
|
200
213
|
@peek()
|
|
201
214
|
def mul(x, peek):
|
|
202
215
|
return x * peek
|
|
@@ -205,15 +218,14 @@ print(mul(5, 7))
|
|
|
205
218
|
```
|
|
206
219
|
prints
|
|
207
220
|
```
|
|
208
|
-
|
|
209
|
-
|
|
221
|
+
called mul(5, 7)
|
|
222
|
+
returned 35 from mul(5, 7) in 0.000006 seconds
|
|
210
223
|
35
|
|
211
224
|
```
|
|
212
225
|
It is possible to suppress the print-out of either the enter or the exit information with
|
|
213
226
|
the show_enter and show_exit parameters, like:
|
|
214
227
|
|
|
215
228
|
```
|
|
216
|
-
import peek
|
|
217
229
|
@peek(show_exit=False)
|
|
218
230
|
def mul(x, peek):
|
|
219
231
|
return x * peek
|
|
@@ -222,7 +234,7 @@ print(mul(5, 7))
|
|
|
222
234
|
```
|
|
223
235
|
prints
|
|
224
236
|
```
|
|
225
|
-
|
|
237
|
+
called mul(5, 7)
|
|
226
238
|
35
|
|
227
239
|
```
|
|
228
240
|
Note that it is possible to use `peek` as a decorator without the parentheses, like
|
|
@@ -240,7 +252,6 @@ If you decorate a function or method with peek, you will be offered the duration
|
|
|
240
252
|
|
|
241
253
|
That opens the door to simple benchmarking, like:
|
|
242
254
|
```
|
|
243
|
-
import peek
|
|
244
255
|
import time
|
|
245
256
|
|
|
246
257
|
@peek(show_enter=False,show_line_number=True)
|
|
@@ -254,14 +265,14 @@ for i in range(8):
|
|
|
254
265
|
```
|
|
255
266
|
the ouput will show the effects of the population size on the sort speed:
|
|
256
267
|
```
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
268
|
+
#5 ==> returned ' 1' from do_sort(0) in 0.000027 seconds
|
|
269
|
+
#5 ==> returned ' 10' from do_sort(1) in 0.000060 seconds
|
|
270
|
+
#5 ==> returned ' 100' from do_sort(2) in 0.000748 seconds
|
|
271
|
+
#5 ==> returned ' 1000' from do_sort(3) in 0.001897 seconds
|
|
272
|
+
#5 ==> returned ' 10000' from do_sort(4) in 0.002231 seconds
|
|
273
|
+
#5 ==> returned ' 100000' from do_sort(5) in 0.024014 seconds
|
|
274
|
+
#5 ==> returned ' 1000000' from do_sort(6) in 0.257504 seconds
|
|
275
|
+
#5 ==> returned ' 10000000' from do_sort(7) in 1.553495 seconds
|
|
265
276
|
```
|
|
266
277
|
|
|
267
278
|
It is also possible to time any code by using peek as a context manager, e.g.
|
|
@@ -271,8 +282,8 @@ with peek():
|
|
|
271
282
|
```
|
|
272
283
|
wil print something like
|
|
273
284
|
```
|
|
274
|
-
|
|
275
|
-
|
|
285
|
+
enter
|
|
286
|
+
exit in 1.000900 seconds
|
|
276
287
|
```
|
|
277
288
|
You can include parameters here as well:
|
|
278
289
|
```
|
|
@@ -281,8 +292,8 @@ with peek(show_context=True, show_time=True):
|
|
|
281
292
|
```
|
|
282
293
|
will print somethink like:
|
|
283
294
|
```
|
|
284
|
-
|
|
285
|
-
|
|
295
|
+
#8 @ 13:20:32.605903 ==> enter
|
|
296
|
+
#8 @ 13:20:33.609519 ==> exit in 1.003358 seconds
|
|
286
297
|
```
|
|
287
298
|
|
|
288
299
|
Finally, to help with timing code, you can request the current delta with
|
|
@@ -302,7 +313,7 @@ peek(duration)
|
|
|
302
313
|
```
|
|
303
314
|
might print:
|
|
304
315
|
```
|
|
305
|
-
|
|
316
|
+
duration=1.0001721999999997
|
|
306
317
|
```
|
|
307
318
|
|
|
308
319
|
# Configuration
|
|
@@ -314,8 +325,8 @@ a number of configuration attributes:
|
|
|
314
325
|
------------------------------------------------------
|
|
315
326
|
attribute alternative default
|
|
316
327
|
------------------------------------------------------
|
|
317
|
-
prefix pr "
|
|
318
|
-
output o "
|
|
328
|
+
prefix pr ""
|
|
329
|
+
output o "stdout"
|
|
319
330
|
serialize pprint.pformat
|
|
320
331
|
show_line_number sln False
|
|
321
332
|
show_time st False
|
|
@@ -333,7 +344,7 @@ depth de 1000000
|
|
|
333
344
|
wrap_indent wi " "
|
|
334
345
|
separator sep ", "
|
|
335
346
|
context_separator cs " ==> "
|
|
336
|
-
equals_separator es "
|
|
347
|
+
equals_separator es "="
|
|
337
348
|
values_only vo False
|
|
338
349
|
value_only_for_fstrings voff False
|
|
339
350
|
return_none rn False
|
|
@@ -352,7 +363,6 @@ print(peek.prefix)
|
|
|
352
363
|
But, it is also possible to apply configuration directly in the call to `peek`:
|
|
353
364
|
So, it is possible to say
|
|
354
365
|
```
|
|
355
|
-
import peek
|
|
356
366
|
peek(12, prefix="==> ")
|
|
357
367
|
```
|
|
358
368
|
, which will print
|
|
@@ -402,7 +412,6 @@ After this `peek1` and `peek2` will behave similarly (but they are not the same!
|
|
|
402
412
|
|
|
403
413
|
## prefix / pr
|
|
404
414
|
```
|
|
405
|
-
import peek
|
|
406
415
|
peek('world', prefix='hello -> ')
|
|
407
416
|
```
|
|
408
417
|
prints
|
|
@@ -414,7 +423,6 @@ hello -> 'world'
|
|
|
414
423
|
|
|
415
424
|
```
|
|
416
425
|
import time
|
|
417
|
-
import peek
|
|
418
426
|
def unix_timestamp():
|
|
419
427
|
return f"{int(time.time())} "
|
|
420
428
|
hello = "world"
|
|
@@ -423,11 +431,11 @@ peek(hello)
|
|
|
423
431
|
```
|
|
424
432
|
prints
|
|
425
433
|
```
|
|
426
|
-
1613635601 hello
|
|
434
|
+
1613635601 hello='world'
|
|
427
435
|
```
|
|
428
436
|
|
|
429
437
|
## output / o
|
|
430
|
-
This will allow the output to be handled by something else than the default (output being written to
|
|
438
|
+
This will allow the output to be handled by something else than the default (output being written to stdout).
|
|
431
439
|
|
|
432
440
|
The `output` attribute can be
|
|
433
441
|
|
|
@@ -437,7 +445,6 @@ The `output` attribute can be
|
|
|
437
445
|
|
|
438
446
|
In the example below,
|
|
439
447
|
```
|
|
440
|
-
import peek
|
|
441
448
|
import sys
|
|
442
449
|
peek(1, output=print)
|
|
443
450
|
peek(2, output=sys.stdout
|
|
@@ -445,14 +452,13 @@ with open("test", "a+") as f:
|
|
|
445
452
|
peek(3, output=f)
|
|
446
453
|
peek(4, output="")
|
|
447
454
|
```
|
|
448
|
-
* `
|
|
449
|
-
* `
|
|
450
|
-
* `
|
|
451
|
-
* `
|
|
455
|
+
* `1` will be printed to stdout
|
|
456
|
+
* `2` will be printed to stdout
|
|
457
|
+
* `3` will be appended to the file test
|
|
458
|
+
* `4` will *disappear*
|
|
452
459
|
|
|
453
460
|
As `output` may be any callable, you can even use this to automatically log any `peek` output:
|
|
454
461
|
```
|
|
455
|
-
import peek
|
|
456
462
|
import logging
|
|
457
463
|
logging.basicConfig(level="INFO")
|
|
458
464
|
log = logging.getLogger("demo")
|
|
@@ -462,10 +468,10 @@ peek(a)
|
|
|
462
468
|
a.remove(4)
|
|
463
469
|
peek(a)
|
|
464
470
|
```
|
|
465
|
-
will print to
|
|
471
|
+
will print to stdout:
|
|
466
472
|
```
|
|
467
|
-
INFO:demo:
|
|
468
|
-
INFO:demo:
|
|
473
|
+
INFO:demo:a={1, 2, 3, 4, 5}
|
|
474
|
+
INFO:demo:a={1, 2, 3, 5}
|
|
469
475
|
```
|
|
470
476
|
Finally, you can specify the following strings:
|
|
471
477
|
```
|
|
@@ -480,7 +486,6 @@ Finally, you can specify the following strings:
|
|
|
480
486
|
```
|
|
481
487
|
E.g.
|
|
482
488
|
```
|
|
483
|
-
import peek
|
|
484
489
|
import sys
|
|
485
490
|
peek.configure(output="stdout")
|
|
486
491
|
```
|
|
@@ -492,8 +497,8 @@ serialized to displayable strings. The default is pformat (from pprint), but thi
|
|
|
492
497
|
for example, to handle non-standard datatypes in a custom fashion.
|
|
493
498
|
The serialize function should accept at least one parameter.
|
|
494
499
|
The function can optionally accept the keyword arguments `width` and `sort_dicts`, `compact`, `indent`, `underscore_numbers` and `depth`.
|
|
500
|
+
|
|
495
501
|
```
|
|
496
|
-
import peek
|
|
497
502
|
def add_len(obj):
|
|
498
503
|
if hasattr(obj, "__len__"):
|
|
499
504
|
add = f" [len={len(obj)}]"
|
|
@@ -501,20 +506,19 @@ def add_len(obj):
|
|
|
501
506
|
add = ""
|
|
502
507
|
return f"{repr(obj)}{add}"
|
|
503
508
|
|
|
504
|
-
|
|
509
|
+
l7 = list(range(7))
|
|
505
510
|
hello = "world"
|
|
506
|
-
peek(7, hello,
|
|
511
|
+
peek(7, hello, l7, serialize=add_len)
|
|
507
512
|
```
|
|
508
513
|
prints
|
|
509
514
|
```
|
|
510
|
-
|
|
515
|
+
7, hello='world' [len=5], l7=[0, 1, 2, 3, 4, 5, 6] [len=7]
|
|
511
516
|
```
|
|
512
517
|
|
|
513
518
|
## show_line_number / sln
|
|
514
519
|
If True, adds the `peek()` call's line number and possible the filename and parent function to `peek()`'s output.
|
|
515
520
|
|
|
516
521
|
```
|
|
517
|
-
import peek
|
|
518
522
|
peek.configure(show_line_number=True)
|
|
519
523
|
def shout():
|
|
520
524
|
hello="world"
|
|
@@ -523,12 +527,11 @@ shout()
|
|
|
523
527
|
```
|
|
524
528
|
prints something like
|
|
525
529
|
```
|
|
526
|
-
|
|
530
|
+
#5 in shout() ==> hello='world'
|
|
527
531
|
```
|
|
528
532
|
|
|
529
533
|
If "no parent" or "n", the parent function will not be shown.
|
|
530
534
|
```
|
|
531
|
-
import peek
|
|
532
535
|
peek.configure(show_line_number="n")
|
|
533
536
|
def shout():
|
|
534
537
|
hello="world"
|
|
@@ -537,7 +540,7 @@ shout()
|
|
|
537
540
|
```
|
|
538
541
|
prints something like
|
|
539
542
|
```
|
|
540
|
-
|
|
543
|
+
#5 ==> hello='world'
|
|
541
544
|
```
|
|
542
545
|
Note that if you call `peek` without any arguments, the line number is always shown, regardless of the status `show_line_number`.
|
|
543
546
|
|
|
@@ -547,20 +550,18 @@ See below for an explanation of the information provided.
|
|
|
547
550
|
If True, adds the current time to `peek()`'s output.
|
|
548
551
|
|
|
549
552
|
```
|
|
550
|
-
import peek
|
|
551
553
|
peek.configure(show_time=True)
|
|
552
554
|
hello="world"
|
|
553
555
|
peek(hello)
|
|
554
556
|
```
|
|
555
557
|
prints something like
|
|
556
558
|
```
|
|
557
|
-
|
|
559
|
+
@ 13:01:47.588125 ==> hello='world'
|
|
558
560
|
```
|
|
559
561
|
|
|
560
562
|
## show_delta / sd
|
|
561
563
|
If True, adds the number of seconds since the start of the program to `peek()`'s output.
|
|
562
564
|
```
|
|
563
|
-
import peek
|
|
564
565
|
import time
|
|
565
566
|
peek.configure(show_delta=True)
|
|
566
567
|
french = "bonjour le monde"
|
|
@@ -571,8 +572,8 @@ peek(french)
|
|
|
571
572
|
```
|
|
572
573
|
prints something like
|
|
573
574
|
```
|
|
574
|
-
|
|
575
|
-
|
|
575
|
+
delta=0.088 ==> english='hallo world'
|
|
576
|
+
delta=1.091 ==> french='bonjour le monde'
|
|
576
577
|
```
|
|
577
578
|
|
|
578
579
|
## show_enter / se
|
|
@@ -591,8 +592,8 @@ With `show_exit=False` this line can be suppressed.
|
|
|
591
592
|
## show_traceback / stb
|
|
592
593
|
When show_traceback is True, the ordinary output of peek() will be followed by a printout of the
|
|
593
594
|
traceback, similar to an error traceback.
|
|
595
|
+
|
|
594
596
|
```
|
|
595
|
-
import peek
|
|
596
597
|
peek.show_traceback=True
|
|
597
598
|
def x():
|
|
598
599
|
peek()
|
|
@@ -602,13 +603,13 @@ x()
|
|
|
602
603
|
```
|
|
603
604
|
prints
|
|
604
605
|
```
|
|
605
|
-
|
|
606
|
+
#4 in x()
|
|
606
607
|
Traceback (most recent call last)
|
|
607
608
|
File "c:\Users\Ruud\Dropbox (Personal)\Apps\Python Ruud\peek\x.py", line 6, in <module>
|
|
608
609
|
x()
|
|
609
610
|
File "c:\Users\Ruud\Dropbox (Personal)\Apps\Python Ruud\peek\x.py", line 4, in x
|
|
610
611
|
peek()
|
|
611
|
-
|
|
612
|
+
#4 in x()
|
|
612
613
|
Traceback (most recent call last)
|
|
613
614
|
File "c:\Users\Ruud\Dropbox (Personal)\Apps\Python Ruud\peek\x.py", line 7, in <module>
|
|
614
615
|
x()
|
|
@@ -620,6 +621,7 @@ The `show_traceback` functionality is also available when peek is used as a deco
|
|
|
620
621
|
## line_length / ll
|
|
621
622
|
This attribute is used to specify the line length (for wrapping). The default is 80.
|
|
622
623
|
Peek always tries to keep all output on one line, but if it can't it will wrap:
|
|
624
|
+
|
|
623
625
|
```
|
|
624
626
|
d = dict(a1=1,a2=dict(a=1,b=1,c=3),a3=list(range(10)))
|
|
625
627
|
peek(d)
|
|
@@ -632,12 +634,13 @@ peek|
|
|
|
632
634
|
{'a1': 1,
|
|
633
635
|
'a2': {'a': 1, 'b': 1, 'c': 3},
|
|
634
636
|
'a3': [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]}
|
|
635
|
-
|
|
637
|
+
d: {'a1': 1, 'a2': {'a': 1, 'b': 1, 'c': 3}, 'a3': [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]}
|
|
636
638
|
```
|
|
637
639
|
|
|
638
640
|
## compact / c
|
|
639
641
|
This attribute is used to specify the compact parameter for `pformat` (see the pprint documentation
|
|
640
642
|
for details). `compact` is False by default.
|
|
643
|
+
|
|
641
644
|
```
|
|
642
645
|
a = 9 * ["0123456789"]
|
|
643
646
|
peek(a)
|
|
@@ -645,26 +648,25 @@ peek(a, compact=True)
|
|
|
645
648
|
```
|
|
646
649
|
prints
|
|
647
650
|
```
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
['0123456789', '0123456789', '0123456789', '0123456789', '0123456789',
|
|
662
|
-
'0123456789', '0123456789', '0123456789', '0123456789']
|
|
651
|
+
a=
|
|
652
|
+
['0123456789',
|
|
653
|
+
'0123456789',
|
|
654
|
+
'0123456789',
|
|
655
|
+
'0123456789',
|
|
656
|
+
'0123456789',
|
|
657
|
+
'0123456789',
|
|
658
|
+
'0123456789',
|
|
659
|
+
'0123456789',
|
|
660
|
+
'0123456789']
|
|
661
|
+
a=
|
|
662
|
+
['0123456789', '0123456789', '0123456789', '0123456789', '0123456789',
|
|
663
|
+
'0123456789', '0123456789', '0123456789', '0123456789']
|
|
663
664
|
```
|
|
664
665
|
|
|
665
666
|
## indent / i
|
|
666
667
|
This attribute is used to specify the indent parameter for `pformat` (see the pprint documentation
|
|
667
668
|
for details). `indent` is 1 by default.
|
|
669
|
+
|
|
668
670
|
```
|
|
669
671
|
s = "01234567890012345678900123456789001234567890"
|
|
670
672
|
peek( [s, [s]])
|
|
@@ -672,19 +674,18 @@ peek( [s, [s]], indent=4)
|
|
|
672
674
|
```
|
|
673
675
|
prints
|
|
674
676
|
```
|
|
675
|
-
|
|
676
|
-
[
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
[ '01234567890012345678900123456789001234567890',
|
|
682
|
-
['01234567890012345678900123456789001234567890']]
|
|
677
|
+
[s, [s]]=
|
|
678
|
+
['01234567890012345678900123456789001234567890',
|
|
679
|
+
['01234567890012345678900123456789001234567890']]
|
|
680
|
+
[s, [s]]=
|
|
681
|
+
[ '01234567890012345678900123456789001234567890',
|
|
682
|
+
['01234567890012345678900123456789001234567890']]
|
|
683
683
|
```
|
|
684
684
|
|
|
685
685
|
## depth / de
|
|
686
686
|
This attribute is used to specify the depth parameter for `pformat` (see the pprint documentation
|
|
687
687
|
for details). `depth` is `1000000` by default.
|
|
688
|
+
|
|
688
689
|
```
|
|
689
690
|
s = "01234567890012345678900123456789001234567890"
|
|
690
691
|
peek([s,[s,[s,[s,s]]]])
|
|
@@ -692,18 +693,16 @@ peek([s,[s,[s,[s,s]]]], depth=3)
|
|
|
692
693
|
```
|
|
693
694
|
prints
|
|
694
695
|
```
|
|
695
|
-
|
|
696
|
-
[
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
['01234567890012345678900123456789001234567890',
|
|
706
|
-
['01234567890012345678900123456789001234567890', [...]]]]
|
|
696
|
+
[s,[s,[s,[s,s]]]]=
|
|
697
|
+
['01234567890012345678900123456789001234567890',
|
|
698
|
+
['01234567890012345678900123456789001234567890',
|
|
699
|
+
['01234567890012345678900123456789001234567890',
|
|
700
|
+
['01234567890012345678900123456789001234567890',
|
|
701
|
+
'01234567890012345678900123456789001234567890']]]]
|
|
702
|
+
[s,[s,[s,[s,s]]]]=
|
|
703
|
+
['01234567890012345678900123456789001234567890',
|
|
704
|
+
['01234567890012345678900123456789001234567890',
|
|
705
|
+
['01234567890012345678900123456789001234567890', [...]]]]
|
|
707
706
|
```
|
|
708
707
|
|
|
709
708
|
## wrap_indent / wi
|
|
@@ -720,28 +719,23 @@ peek(d, wrap_indent=2)
|
|
|
720
719
|
```
|
|
721
720
|
prints
|
|
722
721
|
```
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
....
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
{'a1': 1,
|
|
736
|
-
'a2': {'a': 1, 'b': 1, 'c': 3},
|
|
737
|
-
'a3': [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]}
|
|
722
|
+
d=
|
|
723
|
+
{'a1': 1,
|
|
724
|
+
'a2': {'a': 1, 'b': 1, 'c': 3},
|
|
725
|
+
'a3': [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]}
|
|
726
|
+
d=
|
|
727
|
+
....{'a1': 1,
|
|
728
|
+
.... 'a2': {'a': 1, 'b': 1, 'c': 3},
|
|
729
|
+
.... 'a3': [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]}
|
|
730
|
+
d=
|
|
731
|
+
{'a1': 1,
|
|
732
|
+
'a2': {'a': 1, 'b': 1, 'c': 3},
|
|
733
|
+
'a3': [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]}
|
|
738
734
|
```
|
|
739
735
|
|
|
740
736
|
## enabled / e
|
|
741
737
|
Can be used to disable the output:
|
|
742
738
|
```
|
|
743
|
-
import peek
|
|
744
|
-
|
|
745
739
|
peek.configure(enabled=False)
|
|
746
740
|
s = 'the world is '
|
|
747
741
|
peek(s + 'perfect.')
|
|
@@ -750,7 +744,7 @@ peek(s + 'on fire.')
|
|
|
750
744
|
```
|
|
751
745
|
prints
|
|
752
746
|
```
|
|
753
|
-
|
|
747
|
+
s + 'on fire.'='the world is on fire.'
|
|
754
748
|
```
|
|
755
749
|
and nothing about a perfect world.
|
|
756
750
|
|
|
@@ -766,13 +760,16 @@ peek(world, sort_dicts=True)
|
|
|
766
760
|
```
|
|
767
761
|
prints
|
|
768
762
|
```
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
763
|
+
world={'EN': 'world', 'NL': 'wereld', 'FR': 'monde', 'DE': 'Welt'}
|
|
764
|
+
world={'EN': 'world', 'NL': 'wereld', 'FR': 'monde', 'DE': 'Welt'}
|
|
765
|
+
world={'DE': 'Welt', 'EN': 'world', 'FR': 'monde', 'NL': 'wereld'}
|
|
772
766
|
```
|
|
773
767
|
|
|
768
|
+
Note that under Python <=3.7, dicts are always printed sorted.
|
|
769
|
+
|
|
774
770
|
## underscore_numbers / un
|
|
775
|
-
|
|
771
|
+
|
|
772
|
+
By default, peek does not add underscores in big numbers (printed by pprint). However, it is possible to get the
|
|
776
773
|
default pprint behaviour with the underscore_numbers attribute:
|
|
777
774
|
|
|
778
775
|
```
|
|
@@ -783,14 +780,16 @@ peek(numbers, un=False)
|
|
|
783
780
|
```
|
|
784
781
|
prints
|
|
785
782
|
```
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
783
|
+
numbers={'one': 1, 'thousand': 1000, 'million': 1000000, 'x1234567890': 1234567890}
|
|
784
|
+
numbers={'one': 1, 'thousand': 1_000, 'million': 1_000_000, 'x1234567890': 1_234_567_890}
|
|
785
|
+
numbers={'one': 1, 'thousand': 1000, 'million': 1000000, 'x1234567890': 1234567890}
|
|
789
786
|
```
|
|
790
787
|
|
|
791
|
-
##
|
|
788
|
+
## seperator / sep
|
|
789
|
+
|
|
792
790
|
By default, pairs (on one line) are separated by `, `.
|
|
793
791
|
It is possible to change this with the attribute ` separator`:
|
|
792
|
+
|
|
794
793
|
```
|
|
795
794
|
a="abcd"
|
|
796
795
|
b=1
|
|
@@ -801,10 +800,13 @@ peek(a,(b,c),d, separator=" | ")
|
|
|
801
800
|
```
|
|
802
801
|
prints
|
|
803
802
|
```
|
|
804
|
-
|
|
805
|
-
|
|
803
|
+
a='abcd', (b,c)=(1, 1000), d=['peek', 'c', 'e', 'c', 'r', 'e', 'a', 'm']
|
|
804
|
+
a='abcd' | (b,c)=(1, 1000) | d=['peek', 'c', 'e', 'c', 'r', 'e', 'a', 'm']
|
|
806
805
|
```
|
|
806
|
+
Note that under Python <=3.7, numbers are never printed with underscores.
|
|
807
|
+
|
|
807
808
|
## context_separator / cs
|
|
809
|
+
|
|
808
810
|
By default the line_number, time and/or delta are followed by ` ==> `.
|
|
809
811
|
It is possible to change this with the attribute `context_separator`:
|
|
810
812
|
```
|
|
@@ -814,12 +816,13 @@ peek(a, show_time=True, context_separator = ' \u279c ')
|
|
|
814
816
|
```
|
|
815
817
|
prints:
|
|
816
818
|
```
|
|
817
|
-
|
|
818
|
-
|
|
819
|
+
@ 12:56:11.341650 ==> a='abcd'
|
|
820
|
+
@ 12:56:11.485567 ➜ a='abcd'
|
|
819
821
|
```
|
|
820
822
|
## equals_separator / es
|
|
821
823
|
By default name of a variable and its value are separated by `: `.
|
|
822
824
|
It is possible to change this with the attribute `equals_separator`:
|
|
825
|
+
|
|
823
826
|
```
|
|
824
827
|
a="abcd"
|
|
825
828
|
peek(a)
|
|
@@ -827,8 +830,8 @@ peek(a, equals_separator = ' == ")
|
|
|
827
830
|
```
|
|
828
831
|
prints:
|
|
829
832
|
```
|
|
830
|
-
|
|
831
|
-
|
|
833
|
+
a='abcd'
|
|
834
|
+
a == 'abcd'
|
|
832
835
|
```
|
|
833
836
|
|
|
834
837
|
## values_only / vo
|
|
@@ -841,8 +844,8 @@ peek(hello, 2 * hello, values_only=True)
|
|
|
841
844
|
```
|
|
842
845
|
prints
|
|
843
846
|
```
|
|
844
|
-
|
|
845
|
-
|
|
847
|
+
hello='world', 2 * hello='worldworld'
|
|
848
|
+
'world', 'worldworld'
|
|
846
849
|
```
|
|
847
850
|
The values=True version of peek can be seen as a supercharged print/pprint.
|
|
848
851
|
|
|
@@ -851,6 +854,7 @@ The values=True version of peek can be seen as a supercharged print/pprint.
|
|
|
851
854
|
If False (the default), both the original f-string and the
|
|
852
855
|
value will be printed for f-strings.
|
|
853
856
|
If True, the left_hand side will be suppressed in case of an f-string:
|
|
857
|
+
|
|
854
858
|
```
|
|
855
859
|
x = 12.3
|
|
856
860
|
peek(f"{x:0.3e}")
|
|
@@ -859,8 +863,8 @@ peek(f"{x:0.3e}")
|
|
|
859
863
|
```
|
|
860
864
|
prints
|
|
861
865
|
```
|
|
862
|
-
|
|
863
|
-
|
|
866
|
+
f"{x:0.3e}"='1.230e+01'
|
|
867
|
+
'1.230e+01'
|
|
864
868
|
```
|
|
865
869
|
Note that if `values_only` is True, f-string will be suppressed, regardless of `values_only_for_fstrings`.
|
|
866
870
|
|
|
@@ -876,15 +880,14 @@ print(peek(a, a + 1))
|
|
|
876
880
|
```
|
|
877
881
|
prints
|
|
878
882
|
```
|
|
879
|
-
peek| (3, 4)
|
|
880
883
|
(3, 4)
|
|
881
|
-
|
|
884
|
+
(3, 4)
|
|
885
|
+
(3, 4)
|
|
882
886
|
None
|
|
883
887
|
```
|
|
884
888
|
|
|
885
889
|
## enforce_line_length / ell
|
|
886
|
-
If enforce_line_length is True, all output lines are
|
|
887
|
-
line_length, even those that are not truncated by pformat.
|
|
890
|
+
If enforce_line_length is True, all output lines are explicitly truncated to the given line_length, even those that are not truncated by pformat.
|
|
888
891
|
|
|
889
892
|
## delta / dl
|
|
890
893
|
The delta attribute can be used to (re)set the current delta, e.g.
|
|
@@ -906,8 +909,8 @@ specify `decorator=True`. E.g.
|
|
|
906
909
|
>>>def add2(x):
|
|
907
910
|
>>> return x + 2
|
|
908
911
|
>>>print(add2(10))
|
|
909
|
-
|
|
910
|
-
|
|
912
|
+
called add2(10)
|
|
913
|
+
returned 12 from add2(10) in 0.000548 seconds
|
|
911
914
|
12
|
|
912
915
|
```
|
|
913
916
|
|
|
@@ -938,8 +941,8 @@ specify `context_manager=True`. E.g.
|
|
|
938
941
|
```
|
|
939
942
|
>>>with peek(context_manager=True)
|
|
940
943
|
>>> pass
|
|
941
|
-
|
|
942
|
-
|
|
944
|
+
enter
|
|
945
|
+
exit in 0.008644 seconds
|
|
943
946
|
```
|
|
944
947
|
|
|
945
948
|
The `context_manager` attribute is also required when using `peek():` as a context manager
|
|
@@ -977,14 +980,13 @@ should print
|
|
|
977
980
|
of written to output.
|
|
978
981
|
|
|
979
982
|
```
|
|
980
|
-
import peek
|
|
981
983
|
hello = "world"
|
|
982
984
|
s = peek(hello, as_str=True)
|
|
983
985
|
print(s, end="")
|
|
984
986
|
```
|
|
985
987
|
prints
|
|
986
988
|
```
|
|
987
|
-
|
|
989
|
+
hello='world'
|
|
988
990
|
```
|
|
989
991
|
|
|
990
992
|
Note that if enabled=False, the call will return the null string (`""`).
|
|
@@ -992,7 +994,6 @@ Note that if enabled=False, the call will return the null string (`""`).
|
|
|
992
994
|
# Disabling peek's output
|
|
993
995
|
|
|
994
996
|
```
|
|
995
|
-
import peek
|
|
996
997
|
peek1 = peek.fork(show_delta=True)
|
|
997
998
|
peek(1)
|
|
998
999
|
peek1(2)
|
|
@@ -1006,10 +1007,10 @@ print(peek1.enabled)
|
|
|
1006
1007
|
```
|
|
1007
1008
|
prints
|
|
1008
1009
|
```
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1010
|
+
1
|
|
1011
|
+
delta=0.011826 ==> 2
|
|
1012
|
+
5
|
|
1013
|
+
delta=0.044893 ==> 6
|
|
1013
1014
|
True
|
|
1014
1015
|
```
|
|
1015
1016
|
Of course `peek()` continues to return its arguments when disabled, of course.
|
|
@@ -1082,15 +1083,15 @@ Note that with the attribute propagation method, you can in effect have a layere
|
|
|
1082
1083
|
|
|
1083
1084
|
When `show_line_number` is True or peek() is used without any parameters, the output will contain the line number like:
|
|
1084
1085
|
```
|
|
1085
|
-
|
|
1086
|
+
#3 ==> a='abcd'
|
|
1086
1087
|
```
|
|
1087
1088
|
If the line resides in another file than the main file, the filename (without the path) will be shown as well:
|
|
1088
1089
|
```
|
|
1089
|
-
|
|
1090
|
+
#30[foo.py] ==> foo='Foo'
|
|
1090
1091
|
```
|
|
1091
1092
|
And finally when used in a function or method, that function/method will be shown as well:
|
|
1092
1093
|
```
|
|
1093
|
-
|
|
1094
|
+
#456[foo.py] in square_root ==> x=123
|
|
1094
1095
|
```
|
|
1095
1096
|
The parent function can be suppressed by setting `show_line_number` or `sln` to `"n"` or `"no parent"`.
|
|
1096
1097
|
|
|
@@ -1099,9 +1100,10 @@ The parent function can be suppressed by setting `show_line_number` or `sln` to
|
|
|
1099
1100
|
It can be useful to configure peek at import time. This can be done by providing a `peek.json` file which
|
|
1100
1101
|
can contain any attribute configuration overriding the standard settings.
|
|
1101
1102
|
E.g. if there is an `peek.json` file with the following contents
|
|
1103
|
+
|
|
1102
1104
|
```
|
|
1103
1105
|
{
|
|
1104
|
-
"o": "
|
|
1106
|
+
"o": "stderr",
|
|
1105
1107
|
"show_time": true,
|
|
1106
1108
|
"line_length": 120`
|
|
1107
1109
|
'compact' : true
|
|
@@ -1109,13 +1111,12 @@ E.g. if there is an `peek.json` file with the following contents
|
|
|
1109
1111
|
```
|
|
1110
1112
|
in the same folder as the application, this program:
|
|
1111
1113
|
```
|
|
1112
|
-
import peek
|
|
1113
1114
|
hello = "world"
|
|
1114
1115
|
peek(hello)
|
|
1115
1116
|
```
|
|
1116
|
-
will print to
|
|
1117
|
+
will print to stderr (rather than stdout):
|
|
1117
1118
|
```
|
|
1118
|
-
|
|
1119
|
+
@ 14:53:41.392190 ==> hello='world'
|
|
1119
1120
|
```
|
|
1120
1121
|
At import time the sys.path will be searched for, in that order, to find an `peek.json` file and use that. This mean that
|
|
1121
1122
|
you can place an `peek.json` file in the site-packages folder where `peek` is installed to always use
|
|
@@ -1165,7 +1166,6 @@ In either case, attributes can be added to override the default ones.
|
|
|
1165
1166
|
|
|
1166
1167
|
### Example
|
|
1167
1168
|
```
|
|
1168
|
-
import peek
|
|
1169
1169
|
peek_with_line_number = peek.fork(show_line_number=True)
|
|
1170
1170
|
peek_with_new_prefix = peek.new(prefix="==> ")
|
|
1171
1171
|
peek_with_new_prefix_and_time = peek_with_new_prefix.clone(show_time=True)
|
|
@@ -1183,16 +1183,16 @@ with peek(prefix="peek_cm ") as peek_cm:
|
|
|
1183
1183
|
```
|
|
1184
1184
|
prints something like
|
|
1185
1185
|
```
|
|
1186
|
-
|
|
1187
|
-
==> hello
|
|
1188
|
-
==> @
|
|
1189
|
-
|
|
1190
|
-
==> hello
|
|
1191
|
-
==> @
|
|
1186
|
+
#28 ==> hello='world'
|
|
1187
|
+
==> hello='world'
|
|
1188
|
+
==> @ 09:55:52.122818 ==> hello='world'
|
|
1189
|
+
#32 ==> hello == 'world'
|
|
1190
|
+
==> hello='world'
|
|
1191
|
+
==> @ 09:55:52.125928 ==> hello='world'
|
|
1192
1192
|
peek_cm enter
|
|
1193
|
-
peek_cm hello
|
|
1194
|
-
|
|
1195
|
-
peek_cm exit in 0.
|
|
1193
|
+
peek_cm hello == 'world'
|
|
1194
|
+
hello == 'world'
|
|
1195
|
+
peek_cm exit in 0.001843 seconds
|
|
1196
1196
|
```
|
|
1197
1197
|
|
|
1198
1198
|
## ignore_json
|
|
@@ -1214,9 +1214,9 @@ peek_ignore_json(hello)
|
|
|
1214
1214
|
```
|
|
1215
1215
|
prints
|
|
1216
1216
|
```
|
|
1217
|
-
==>hello
|
|
1218
|
-
==>hello
|
|
1219
|
-
|
|
1217
|
+
==>hello='world'
|
|
1218
|
+
==>hello='world'
|
|
1219
|
+
hello='world'
|
|
1220
1220
|
```
|
|
1221
1221
|
|
|
1222
1222
|
# Test script
|
|
@@ -1233,7 +1233,7 @@ Peek may be used in a REPL, but with limited functionality:
|
|
|
1233
1233
|
```
|
|
1234
1234
|
>> hello = "world"
|
|
1235
1235
|
>>> peek(hello, hello * 2)
|
|
1236
|
-
|
|
1236
|
+
'hello', 'hellohello'
|
|
1237
1237
|
('hello', 'hellohello')
|
|
1238
1238
|
```
|
|
1239
1239
|
* line numbers are never shown
|
|
@@ -1248,7 +1248,7 @@ In that case, it is possible to use p instead
|
|
|
1248
1248
|
```
|
|
1249
1249
|
from peek import p
|
|
1250
1250
|
```
|
|
1251
|
-
The `p` object is a *fork* of peek
|
|
1251
|
+
The `p` object is a *fork* of peek. That means that attributes of `peek` are propagated to `p`, unless overridden.
|
|
1252
1252
|
|
|
1253
1253
|
# Alternative installation
|
|
1254
1254
|
|
|
@@ -1268,7 +1268,7 @@ It is not possible to use peek:
|
|
|
1268
1268
|
# Implementation details
|
|
1269
1269
|
|
|
1270
1270
|
Although not important for using the package, here are some implementation details:
|
|
1271
|
-
* peek.py contains the complete source of the asttokens and
|
|
1271
|
+
* peek.py contains the complete source of the asttokens, executing and six packages, in
|
|
1272
1272
|
order to offer the required source lookups, without any dependencies
|
|
1273
1273
|
* peek.py contains the complete source of pprint as of Python 3.13 in order to support the sort_dicts and underscore_numbers parameter
|
|
1274
1274
|
* in order to support using peek() as a decorator and a context manager, peek caches the complete source of
|
|
@@ -1296,32 +1296,36 @@ The peek package is a rebrand of the **ycecream** package, with enhancements.
|
|
|
1296
1296
|
The peek module was originally a fork of **IceCream**, but has many differences:
|
|
1297
1297
|
|
|
1298
1298
|
```
|
|
1299
|
-
|
|
1300
|
-
characteristic peek
|
|
1301
|
-
|
|
1302
|
-
default name peek
|
|
1303
|
-
import method import peek
|
|
1304
|
-
dependencies none
|
|
1305
|
-
number of files 1
|
|
1306
|
-
usable without installation yes
|
|
1307
|
-
can be used as a decorator yes
|
|
1308
|
-
can be used as a context manager yes
|
|
1309
|
-
can show traceback yes
|
|
1310
|
-
PEP8 (Pythonic) API yes
|
|
1311
|
-
sorts dicts no by default, optional yes
|
|
1299
|
+
-------------------------------------------------------------------------------------------
|
|
1300
|
+
characteristic peek IceCream
|
|
1301
|
+
-------------------------------------------------------------------------------------------
|
|
1302
|
+
default name peek ic
|
|
1303
|
+
import method import peek from icecream import ic
|
|
1304
|
+
dependencies none many
|
|
1305
|
+
number of files 1 several
|
|
1306
|
+
usable without installation yes no
|
|
1307
|
+
can be used as a decorator yes no
|
|
1308
|
+
can be used as a context manager yes no
|
|
1309
|
+
can show traceback yes no
|
|
1310
|
+
PEP8 (Pythonic) API yes no
|
|
1311
|
+
sorts dicts no by default, optional *) yes
|
|
1312
1312
|
supports compact, indent,
|
|
1313
1313
|
and underscore_numbers
|
|
1314
|
-
parameters of pprint yes
|
|
1315
|
-
use from a REPL limited functionality
|
|
1316
|
-
external configuration via json file
|
|
1317
|
-
observes line_length correctly yes
|
|
1318
|
-
benchmarking functionality yes
|
|
1319
|
-
suppress f-strings at left hand optional
|
|
1320
|
-
indentation 4 blanks (overridable)
|
|
1321
|
-
forking and cloning yes
|
|
1322
|
-
test script pytest
|
|
1323
|
-
colourize no
|
|
1324
|
-
|
|
1314
|
+
parameters of pprint yes **) no
|
|
1315
|
+
use from a REPL limited functionality no
|
|
1316
|
+
external configuration via json file no
|
|
1317
|
+
observes line_length correctly yes no
|
|
1318
|
+
benchmarking functionality yes no
|
|
1319
|
+
suppress f-strings at left hand optional no
|
|
1320
|
+
indentation 4 blanks (overridable) dependent on length of prefix
|
|
1321
|
+
forking and cloning yes no
|
|
1322
|
+
test script pytest unittest
|
|
1323
|
+
colourize no yes (can be disabled)
|
|
1324
|
+
-------------------------------------------------------------------------------------------
|
|
1325
|
+
*) under Python <= 3.7, dicts are always sorted (regardless of the sort_dicts attribute
|
|
1326
|
+
**) under Python <= 3.7, numbers are never underscored (regardless of the underscore_numnbers attribute
|
|
1327
|
+
|
|
1328
|
+
|
|
1325
1329
|
```
|
|
1326
1330
|
  
|
|
1327
1331
|
|