NAME
data_printer - data printer and dumper
VERSION
0.0.4
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 string without indexes: [6] -> [0] 6
s = np(data, indexes=False)
# 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,
))
# print in perl-style (python - default) and without "[0] 7" in list "[7]".
p(data, sep="perl", indexes=False)
# print in node-style
p(data, sep="node")
# self-style
p(data, sep=dict(
kword=True,
oword=True,
kw=" => ",
kv=" => ",
object_open="bless {",
object_close="}, %n",
dict_open="{",
dict_close="}",
list_open="[",
list_close="]",
tuple_open="[",
tuple_close="]",
str='"%s"',
bytes='do { use bytes; "%s" }',
none="undef",
true="1",
false="0"
))
# self-style with two and lambda on bytes
p(data, sep=dict(
str='"%s"',
bytes=lambda s: "".join(['Buffer.from(", ', ", ".join(["0x%X" % ch for ch in s]) ,')']),
))
# print without newline on the end
p(data, end="")
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
Metadata
Release files for data-printer 0.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| data-printer-0.0.4.tar.gz | 5.1 kB | Without provenance | Details for data-printer-0.0.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| data_printer-0.0.4-py3-none-any.whl | Python 3 | none | any | Details for data_printer-0.0.4-py3-none-any.whl |
Total release size: 10.7 kB
Release files / data-printer-0.0.4.tar.gz
| Download URL | data-printer-0.0.4.tar.gz |
|---|---|
| Size | 5.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bc692773ab24a5aa7b0b92645e1c70185d8f5cb1711569d2a58b84f830c70d1f
|
|
BLAKE2b-256 checksum How to use checksums |
2871c59d5e3308c934a9d4684ecf103ef57cb214d24f1260cd2662fc87bda023
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.6.9
|
Release files / data_printer-0.0.4-py3-none-any.whl
| Download URL | data_printer-0.0.4-py3-none-any.whl |
|---|---|
| Size | 5.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
025484a982be040d62030c90569c8d931de81b31dc1b1f14c62be5d3ddbae498
|
|
BLAKE2b-256 checksum How to use checksums |
def588fa7dbd816de97cc988954b8fb279b91c868b02dc130798343d7c713c5d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.6.9
|
Security for data-printer 0.0.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.