Prints an object all spread out and indented.
Project description
repr_soso
Prints an object all spread out and indented.
Takes an object like this:
{'format': 2, 'versions': ['ARIA', 'Cakewalk', 'LinuxSampler', 'SFZ v1', 'SFZ v2', 'sfizz'], 'headers': [{'name': 'region', 'short_description': 'The basic component of an instrument. An instrument is defined by one or more regions.', 'version': 'SFZ v1'}, {'name': 'group', 'short_description': 'Multiple regions can be arranged...
... and formats it like this:
{
"format" : 2,
"versions" : [
'ARIA',
'Cakewalk',
'LinuxSampler',
'SFZ v1',
'SFZ v2',
'sfizz'
],
"headers" : [
{
"name" : 'region',
"short_description" : 'The basic component of an instrument. An instrument is defined by one or more regions.',
"version" : 'SFZ v1'
},
{
"name" : 'group',
"short_description" : 'Multiple regions can be arranged in a group. Groups allow entering common parameters for multiple regions.',
"version" : 'SFZ v1'
},
...
Goal
My purpose in creating this was to use it to produce good-looking code which can be placed in the source file of another project (sfzen). I had an expensive operation, building up a large dictionary which never changes. Instead of performing it on every invocation, it made sense to just include the definition in the source. Using repr_soso, I wrote the dictionary directly to a file with a .py extension.
Usage:
from repr_soso import Repr
repr = Repr(big_dictionary)
repr.print()
... or ...
repr(big_dictionary).print()
Speed
This package differs from "rich", which already does this, by doing only one thing, and doing it fast. Testing with a large dictionary produced the following:
rich: 2.1802 seconds
repr_soso: 0.1395 seconds
YMMV.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file repr_soso-1.0.0.tar.gz.
File metadata
- Download URL: repr_soso-1.0.0.tar.gz
- Upload date:
- Size: 14.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
49f86cd7abc2189e89bc5168ba34f886a41edcc76a0bfe220ae5932f0396ebe5
|
|
| MD5 |
5eb5c838ef139ce0900db922b4ff3602
|
|
| BLAKE2b-256 |
da4d65fa10d33dfe7c722139272eb50c3450a03fab578dae193b1263dee5f5ad
|
File details
Details for the file repr_soso-1.0.0-py2.py3-none-any.whl.
File metadata
- Download URL: repr_soso-1.0.0-py2.py3-none-any.whl
- Upload date:
- Size: 14.8 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
05d633d2f1133fc1f169317763c6429f0d6256e40fae90dce57eb6d0b7f2cf6a
|
|
| MD5 |
9191f2528a4e28d740338d7b33cdd865
|
|
| BLAKE2b-256 |
b5d8eaac6186c20a048d05046d8502aae6e1163ce99af631fba8c45e6269ff08
|