Skip to main content

Encoding-decoding HELML format

Project description

HELML

This code represents a Python implementation of the HELML class

The class provides functions for encoding and decoding data in the HELML format.

HELML (Header-Like Markup Language) is a markup language similar to the HTTP header format. (HTTP headers are a specific case of the HELML format, a simple single-level array case).

HELML allows encoding arrays of any complexity and then decoding them while preserving data types for true, false, null, integer. The format is ideologically close to YAML, JSON, and other array serialization formats, intended for use as an alternative in cases where it is convenient. The main advantage of the HELML format is its simplicity, clarity, and minimalism. The format works with any data and does not stumble on binary blocks or special characters. At the same time, the format is intuitively understandable, can be created and edited manually as text. In most cases, data in HELML will be more compact than in other markup languages.

This class implements two varieties of HELML: multiline format and URL format.

The URL variety of HELML is intended for data transmission in the URL string, for example, to implement APIs in GET requests. In this case, the format packs data into a single line and minimizes the number of "inconvenient" characters for the URL.

Main methods of the class: encode: takes an array of data and converts it into a string using the HELML format. the second parameter of the method determines whether to use the URL mode.

decode: performs the reverse transformation of encode. takes a HELML formatted string and converts it back into an array. automatically determines whether the input data is in URL format or multiline format.

All methods are static and can be used without creating an instance of the class.

Example:

from HELML import HELML

arr = {'One': 1, 'Two': 2, 'Three': [1,2,3], 'Four': (4,5,6)}

enc = HELML.encode(arr)
print(enc)

dec = HELML.decode(enc)
print(dec)

Result of encode:

One:  1
Two:  2
Three
:0:  1
:1:  2
:2:  3
Four
:0:  4
:1:  5
:2:  6

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

HELML-0.1.2.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

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

HELML-0.1.2-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file HELML-0.1.2.tar.gz.

File metadata

  • Download URL: HELML-0.1.2.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.10

File hashes

Hashes for HELML-0.1.2.tar.gz
Algorithm Hash digest
SHA256 44165eb34eb565f3ac8c2ae7b6f1afdc7a3f88aa756eef5ed5b96325a4366376
MD5 60e75ec9aacf64608d548e668f93dc9d
BLAKE2b-256 cd005afeb08a991bd13f5c0a7e0ba14f42820840c94bf4601ff4348f11794905

See more details on using hashes here.

File details

Details for the file HELML-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: HELML-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 6.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.10

File hashes

Hashes for HELML-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 452890bce8408c966303aa229b7cffd33eb97c0ad6ade35be8dfb2840a2dd306
MD5 cacd651b06e303adfef5be507f968298
BLAKE2b-256 d122cbc5ff46cbc72f5a4ec51c8d14dcbe24db8744b493154369646b78cb5205

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