Skip to main content

qsck

Python library for serializing and deserializing a wonky format referred to as ".qs" files. For full format specification, please read through tests.test_serialize and tests.test_deserialize test suites and extrapolate.

Quick Start

Use Python ≥ 3.6 only. To install it, simply:

pip3 install qsck

Serializing Data

Via Python:

python3 -c "import qsck; print(qsck.serialize('LOG', '1553302923', [
    ('first_key', 'some value'),
    ('2nd_key', [('attr1', 'foo'), ('attr2', 'bar')]),
    ('3rd_key', {'subKey1': '-3', 'subKey2': None}),
    ('4th_key', None)
]))"

Out comes a ".qs" record, like so:

LOG,1553302923,first_key=some value,2nd_key={attr1=foo, attr2=bar},3rd_key={"subKey1":"-3","subKey2":null},4th_key=(null)

The library also supports serializing data by passing in a JSON file via the command-line tool qs-format, one record per line:

qs-format my-records.json > my-records.qs

Deserializing Data

Via Python:

python3 -c "import pprint, qsck; pprint.pprint(qsck.deserialize(
    'LOG,1553302923,first_key=some value,2nd_key={attr1=foo, \
    attr2=bar},3rd_key={\"subKey1\":\"-3\",\"subKey2\":null},4th_key=(null)'))"

Out comes a friendly Python collection:

('LOG',
 '1553302923',
 [('first_key', 'some value'),
  ('2nd_key', [('attr1', 'foo'), ('attr2', 'bar')]),
  ('3rd_key', {'subKey1': '-3', 'subKey2': None}),
  ('4th_key', None)])

The library-provided qs-parse command-line tool supports deserializing a whole ".qs" log file, emitting one JSON record per input line to stdout:

qs-parse my-records.qs > my-records.json 

Contributing

Really? Very welcome. Do the usual fork-and-submit-PR thingy.

Running the tests:

python setup.py test

Distributing:

pip3 install --upgrade twine wheel setuptools
python setup.py sdist bdist_wheel
twine upload dist/*

Changelog

0.3 - Better Deserialization

  • Adds support for funky "nested-nested lists" in .qs records
  • Squashing complex comma (,) values

0.2 – Deserialize Added

Adds support for de-serializing ".qs" records.

0.1 – Initial Release

Supports serializing ".qs" records.

Metadata

Release files for qsck 0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for qsck 0.3
File Size Uploaded
qsck-0.3.tar.gz 6.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for qsck 0.3
File Interpreter ABI Platform
qsck-0.3-py3-none-any.whl Python 3 none any Details

Total release size: 14.5 kB

Release files / qsck-0.3.tar.gz

Download URL qsck-0.3.tar.gz
Size 6.3 kB
Tags Source
SHA-256 checksum
How to use checksums
79c37a151155833a4a59687758bd005cb667fb3ef084e2cd1eab4f10b0fe8df2
BLAKE2b-256 checksum
How to use checksums
b56e59dd93d9f7deb8ed93927d0fcf7e0c83f60dafd6998fed0da3f3566b48b3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

Release files / qsck-0.3-py3-none-any.whl

Download URL qsck-0.3-py3-none-any.whl
Size 8.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5af31d9cee01e0090eb140b9fc893588e53f8a777f7069cd25e10595b7b04532
BLAKE2b-256 checksum
How to use checksums
5205b143f38b5bdcee8cc5b40971a44ef99b905865ca43f2892a8086f3f32097
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

Release history Release notifications | RSS feed

This release

0.3 This release

2 release files

0.2

2 release files

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page