Job decoding logic
Project description
Informatics Matters Data Manager Job Decoder
A package that simplifies the decoding of encoded text strings. Given an encoded string the decode() method returns the decoded value or an error.
For example, given the following jinja2 encoded string '{{ foo }}, bar={{ bar }}, baz={{ baz }}' and variable map {'foo': 1, 'bar': 2, 'baz': 3} the decoder returns the string 'foo=1, bar=2, baz=3'.
The following encoding/decoding formats are supported: -
jinja2 (3.0)
The package also provides validate_job_schema() and validate_manifest_schema() functions, which can (should) be used to validate the Manifests and Job definitions against the built-in schemas.
Installation (Python)
The Job decoder is published on PyPI and can be installed from there:
pip install im-data-manager-job-decoder
Once installed you can validate the definition (expected to be a dictionary formed from the definition YAML file) with:
>>> from decoder import decoder >>> error = decoder.validate_manifest_schema(manifest) >>> error = decoder.validate_job_schema(job_definition)
And run the decoder with:
>>> decoded, success = decoder.decode(text, variables, 'command', decoder.TextEncoding.JINJA2_3_0)
Get in touch
Report bugs, suggest features or view the source code on GitHub.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Hashes for im_data_manager_job_decoder-1.6.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fc997540726236efb3ffdabcfc9116975968c0336d3ad5da7d3f169fde25a047 |
|
MD5 | 80707a6e005f2bc8bfa7a3bbf67521c6 |
|
BLAKE2b-256 | 04bbc243b3c78dd8832e720edbff22307ac3eb0d5735f6254886cd94348c0de6 |