rng-to-html-form
Requirements
python 3.4
lxml 3.4.4
Install
pip install rng-to-html-form
Usage
Takes an rng file and makes an html form :
from rng_to_form.rng import RNG
from rng_to_form.form_maker import make_form, make_tree, set_in_nested_dict, order_dicts
"""
List of rng tools
"""
# Creates an RNG object to use rng tools
rng = RNG(file="/path/to/my/rng/file.rng", target="ArchiveTransfer")
# 1 - Tools to make the form
# Builds an html form in a string
generated_form = make_form(rng)
# Returns elements order
order = rng.find_definitions()
# From the specified element, returns all nested orders
form_root = rng.get_form_root(root_name="ArchiveTransfer")
# 2 - Tools to get data from the form
# Generates a dict of dicts from dot separated keys. Result will be : {'a': {'c': {}, 'b': {}}, 'b': {'d': {}, 'e': {'b': {}, 'a': {}}}}
data = {'a.b': 1, 'a.c': 2, 'b.d' : 1, 'b.e.a': 1, 'b.e.b': 2}
tree = make_tree(data)
# Makes a nested python object from the form data. It modifies "tree"
set_in_nested_dict(tree, data)
# Builds the final python object with all ordered elements
order = rng.find_definitions()
all_data = {rng.get_form_root(root_name="ArchiveTransfer"): tree}
final = order_dicts(all_data, ordered=order)
# 3 - Tools to get data from the form
# Flattens nested dicts into a single level dict. Result will be : {'a.b': 1, 'a.c': 2, 'b.d' : 1, 'b.e.a': 1, 'b.e.b': 2}
dp = dict_path({'a': {'b': 1, 'c': 2}, 'b': {'d': 1, 'e': {'a': 1, 'b': 2}}})
Metadata
Release files for rng-to-html-form 1.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| rng_to_html_form-1.0.2-py3-none-any.whl | Python 3 | none | any | Details for rng_to_html_form-1.0.2-py3-none-any.whl |
Release files / rng_to_html_form-1.0.2-py3-none-any.whl
| Download URL | rng_to_html_form-1.0.2-py3-none-any.whl |
|---|---|
| Size | 12.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d1eca68f341d330295477c679eb104e811b652844cbcda6300f5533fde017826
|
|
BLAKE2b-256 checksum How to use checksums |
a3269291579a966f994a2020a3cf738fec9dc4027417735c7ad64633c6a2de3a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for rng-to-html-form 1.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.