Skip to main content

A stream format output dumper.

Project description

# jsformat

  The `jsformat` project is an open source Python program works as a stream formatted output dumper.

- [About](#about)
* `jsformat.Dumper`
* `jsformat.JSON`
* `jsformat.PLIST`
* `jsformat.Tree`
* `jsformat.XML`
* `jsformat.HTML`
- [Installation](#installation)
- [Usage](#usage)

---

### About

  Currently, it supports following formats --

- `jsformat.Dumper` -- abstract base class of all dumpers
- `jsformat.JSON` -- dump JavaScript object notation (`JSON`) format file
- `jsformat.PLIST` -- dump Apple property list (`PLIST`) format file
- `jsformat.Tree` -- dump tree-view text (`TXT`) format file
- `jsformat.XML` -- dump extensible Mmarkup language (`XML`) file (__base class__)
- `jsformat.HTML` -- dump JavaScript file under `Vue.js` framework (__DEPRECATED__)

![](./doc/jsformat.png)

 

### Installation:

> Note that `jsformat` only supports Python versions __since 3.0__

```
pip install jsformat
```

 

### Usage

  `jsformat` is quite easy to use. After installation, importation, and initialisation, you can simple call the instance to dump contents.

> Take `jsformat.Tree` for example

```python
import jsformat
dumper = jsformat.Tree('out.txt')
test_1 = dict(
foo = -1, # int
bar = 'Hello, world!', # string
boo = dict( # dict
foo_again = True, # bool
bar_again = b'bytes', # bytes (b'\x62\x79\x74\x65\x73')
boo_again = None, # NoneType
),
)
dumper(test_1, name='test_1')
```
```
$ cat out.txt
PCAP File Tree-View Format

test
|-- foo -> -1
|-- bar -> hello
|-- boo
|-- foo_again -> True
|-- bar_again -> 62 79 74 65 73
|-- boo_again -> N/A
```
```python
import datetime
test_2 = dict(
foo = [1, 2.0, 3], # list
bar = (1.0, 2, 3.0), # tuple
boo = dict( # dict
foo_again = 'a long long bytes',
# bytes
bar_again = datetime.datetime.today(),
# datetime
boo_again = -1.0, # float
),
)
dumper(test_2, name='test_2')
```
```
$ cat out.txt
PCAP File Tree-View Format

test_1
|-- foo -> -1
|-- bar -> Hello, world!
|-- boo
|-- foo_again -> True
|-- bar_again -> 62 79 74 65 73
|-- boo_again -> N/A

test_2
|-- foo
| |--> 1
| |--> 2.0
| |--> 3
|-- bar
| |--> 1.0
| |--> 2
| |--> 3.0
|-- boo
|-- foo_again -> a long long bytes
|-- bar_again -> 2018-03-08 17:47:35
|-- boo_again -> -1.0
```

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

dictdumper-0.0.1.dev1.tar.gz (62.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dictdumper-0.0.1.dev1-py2.py3-none-any.whl (12.8 kB view details)

Uploaded Python 2Python 3

File details

Details for the file dictdumper-0.0.1.dev1.tar.gz.

File metadata

File hashes

Hashes for dictdumper-0.0.1.dev1.tar.gz
Algorithm Hash digest
SHA256 20324ae2f982a91b88cd2cc0ff7663b2af44fac7d7284d06645f34b24c1e95af
MD5 62b7bba5b0855732ed55d889fe38e011
BLAKE2b-256 3d3c8968de33de6d9d0377a214976e5692204a51e8605ec1c93e65da75c4373a

See more details on using hashes here.

File details

Details for the file dictdumper-0.0.1.dev1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for dictdumper-0.0.1.dev1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 a02b85a260296fbe0b712f89ebfd56f2491374429edc541cb154f1c24e98ff89
MD5 849aeeaaecf2150622474ce346bb4274
BLAKE2b-256 2bf7075f9c5224cbc3913e44be478200a366304ba942042a84a9f27ac350fc38

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page