-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpdbrc
49 lines (35 loc) · 1017 Bytes
/
pdbrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#/usr/bin/env python3
import pdb
import inspect as __inspect
from pprint import pprint as __pprint
from contextlib import suppress as __suppress
import rich
from functools import partial
from rich import pretty
from rich.console import Console
from rich import inspect as ins
from rich.progress import track
from rich import print
from rich import traceback
_ = pretty.install()
_ = traceback.install(show_locals=True)
console = Console()
inspect = partial(ins, methods=True)
pdb.pprint = print
alias p import pdb; pdb.pprint(%*)
alias pp import pdb; pdb.pprint(%*)
alias ins ins(%*)
# Print a dictionary sorted by key.
alias pd pp {k: v for k, v in sorted(dict(%*).items(), key=lambda i: i[0])}
# Print the member variables of a thing.
alias pi pd %*.__dict__
alias pii pd dict(__inspect.getmembers(%1))
# Print the member variables of self.
alias ps pi self
# Print the locals.
alias pl pd locals()
alias pg pd globals()
# Next and list, and step and list.
alias nll n;;ll
alias nl n;;l
alias sl s;;l