Skip to main content

A new file format

Project description

HER, a new Text Format Build Status

Search informations about the Syntax and Types using the Wiki section.

Content table

What’s HER?

HER is text format, like XML/Json. The difference is that HER is easier than others. Just see:

- Category -
    >> Array[]
    * Array[] = "Umh, that's pretty good!"

Why shall I use HER?

As I said before, HER is simple and easy to use. You can pass informations, or better, store informations* and document them.

Feel the difference:

XML:

<christmas>
    <greetings>Merry christmas!</greetings>
    <greetings>Spam, Python, Eggs</greetings>
</christmas>

HER:

- Christmas -
    >> Greetings[]
    * Greetings[] = "Merry christmas!"
    * Greetings[] = "Spam, Python, Eggs"

Python Module

Installation

You can easily install that module using pip:

pip install her

Or, if you want to upgrade the module:

pip install --upgrade her

Import Module

You must use import her to import all the HER module.

import her
...

Encode a Dictionary

Just use the encode function.

from her import encode
her = encode({'Category':{'hello world':True}})
print(her)

Output:

- Category -
    * hello world = True

Decode a String

Just use the decode function.

from her import decode
dictionary = decode("- Category -\n    * hello world = True")
print(dictionary)

Output:

{'Category':{'hello world':True}}

HER class

You can use the HER class to call less encode & decode functions and optimize your codebase. It updates all its attributes automatically.

x = her.HER()
x.value = {"foo": {"lol": 1}}
print(repr(x.representation)) # Output: '- foo -\n    * lol = 1'

You can also pass a parameter (dict or str):

x = her.HER('- foo -\n    * lol = 1')
print(x.value) # Output: {"foo": {"lol": 1}}

y = her.HER({"foo": {"lol": 1}})
print(repr(x.representation)) # Output: '- foo -\n    * lol = 1'

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

her-1.5.0.tar.gz (4.8 kB view details)

Uploaded Source

File details

Details for the file her-1.5.0.tar.gz.

File metadata

  • Download URL: her-1.5.0.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/3.6.7

File hashes

Hashes for her-1.5.0.tar.gz
Algorithm Hash digest
SHA256 d2b50160f405a5d291ae3d9f1103c057df0467751524554653deff46c4438057
MD5 ef867ea74a4b37a1b72afa7d908b5aa9
BLAKE2b-256 abf14522bd18e19c0ce170f1b0e332bc7b08b5dc50eb42aeb443a3879d9d7d94

See more details on using hashes here.

Supported by

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