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.1.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.1-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: HELML-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 44d5196d6338c8d3a3a4987912cf200375404c98726a840a50b9b10449dfccdf
MD5 2e9faf4ca3e0398db67c8f507c942c48
BLAKE2b-256 06b8f5207bc57eb213d5c808c0bee9be4d19ec43fa7cacd7e4e5fb592fe18e98

See more details on using hashes here.

File details

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

File metadata

  • Download URL: HELML-0.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a128421af942cf9f8f133da1b2cd79df9faed0b92ec723144b6d74abaee685de
MD5 2074993f2a9cae98d2b95a1110ee20ea
BLAKE2b-256 6ed9e6f1897c6eea068dd12c88b358c806038630a223b54351342467ffbcdc2e

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