**data_printer** - data printer and dumper
Project description
NAME
data_printer - data printer and dumper
VERSION
0.0.2
SYNOPSIS
from data_printer import p, np
import sys
from colored import fore, back, style
class A:
def __init__(self, **kw):
for k, v in kw.items():
setattr(self, k, v)
data = A(abc="acc", a=A(x=dict(p=10, r=[20, (2, 0.01)])), s='Строка\n', b=b'binary\n', r=r'\n')
# add ref to themselwes:
data.a.x['r'].append(data)
# print colored structure to sys.stdout
p(data)
# print colored structure to file stream
p(data, file=sys.stderr)
# print uncolored structure to file stream
p(data, file=sys.stderr, color=False)
# serialize structure to string
s = np(data)
# serialize structure to colored string (colors as escape sequences)
s = np(data, color=True)
# default color scheme
p(data, color=dict(
bool = fore.LIGHT_BLUE,
none = fore.LIGHT_BLUE,
int = fore.LIGHT_YELLOW,
float = fore.LIGHT_YELLOW,
str = fore.LIGHT_GREEN,
bytes = fore.LIGHT_MAGENTA,
object = fore.LIGHT_RED,
key = fore.LIGHT_CYAN,
ref = fore.RED,
punct = fore.WHITE,
))
# replace two colors
s = np(data, color=dict(
bool = fore.LIGHT_RED,
none = fore.LIGHT_YELLOW,
))
DESCRIPTION
Data recursive printer. Serialize any python3 data to string or print in console or file.
Is colorised output.
Data printer check many references to one structure.
INSTALL
$ pip install data-printer
REQUIREMENTS
- colored
AUTHOR
Kosmina O. Yaroslav dart@cpan.org
LICENSE
MIT License
Copyright (c) 2020 Kosmina O. Yaroslav
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
data-printer-0.0.2.tar.gz
(4.0 kB
view hashes)
Built Distribution
Close
Hashes for data_printer-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 489ded12f23bc4931375b5ea2f584df80745a3d1add27f4bd46355ff810a36d5 |
|
MD5 | 9b5a8d12715b742fd834305276b5cf67 |
|
BLAKE2b-256 | 94a6fc995c20d4b99c6af943dcbc92c3713cce76c49d6057c44392c392d74c9f |