https://github.com/tmck-code/pp
terminal/cli/python helpers for colour and pretty-printing
https://github.com/tmck-code/pp
Last synced: 10 months ago
JSON representation
terminal/cli/python helpers for colour and pretty-printing
- Host: GitHub
- URL: https://github.com/tmck-code/pp
- Owner: tmck-code
- License: bsd-3-clause
- Created: 2024-11-10T03:10:12.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-12-25T14:24:17.000Z (about 1 year ago)
- Last Synced: 2025-01-09T16:35:09.124Z (12 months ago)
- Language: Python
- Size: 53.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# pp
terminal/cli/python helpers for colour and pretty-printing
- [pp](#pp)
- [`bench`](#bench)
- [`pp`](#pp-1)
---
## `bench`
```python
from pp import bench
bench.bench(
tests=[
(
(range(2),), # args
{}, # kwargs
[0,1], # expected
)
],
func_groups=[ [list] ],
n=100
)
```
## `pp`
```python
from pp import pp
# Pretty-print a dict
pp.ppd([[1,2,3], [4,5,6], [7,8,9]])
# [
# [1, 2, 3],
# [4, 5, 6],
# [7, 8, 9]
# ]
# Pretty-print a JSON string
pp.ppj('{"a": 1, "b": 2}')
# {
# "a": 1,
# "b": 2
# }
```