Skip to main content

Easy navigation within nested data of mappings (dict, ...) and sequences (list, ...). Easy access of values via single keys within these nested data structures. Enables different (human readable) representation of nested data structures.

Project description

augmentedtree

augmentedtree icon

augmentedtree enhances mappings and sequences (targeted for python dictionaries and lists) preserving their native behavior and access. The enhancement comes with getting values by single keys, human readable viewing, selecting and setting multiple values/items within the nested data at once, or-conditional selection of values/items. Also this package intends to prepare the nested data for pyQt. The augmentation provides methods and properties to be used for a QAbstractItemModel showing the nested data within a QTreeView.

Installation

Installing the latest release using pip is recommended.

    $ pip install augmentedtree

The latest development state can be obtained from gitlab using pip.

    $ pip install git+https://gitlab.com/david.scheliga/augmentedtree.git@dev

Basic Usage

The major purpose of augmentedtree is to retrieve quickly specific value(s) from a deep nested data featuring:

  • unix filename pattern
  • regular expressions
  • or-conditional selection

The targeted usage is to be able to write the following kind of code

# code where the nested data comes from
...

# gathering parameters
with AugmentedTree(nested_data) as tree:
    # simple selection
    first_value = tree.select("something", "here")[0]
    last_value = tree.select("something", "there")[-1]
    a_slice_of_values = tree.select("a", "l?t", "of")[3:6]

    # selection with refinement
    selection_of_values = tree.select("also/a", "lot", "of")
    narrowed_down = selection_of_values.where("this", "or", "that")[ALL_ITEMS]
    ...


if not tree.all_selections_succeeded:
    # break, exit or reacting to some value are not there
    ...

# code which is working with requested parameters       
...

Read-the-docs for a detailed explanation on how to use augmented tree.

Contribution

Any contribution by reporting a bug or desired changes are welcomed. The preferred way is to create an issue on the gitlab's project page, to keep track of everything regarding this project.

Contribution of Source Code

Code style

This project follows the recommendations of PEP8. The project is using black as the code formatter.

Workflow

  1. Fork the project on Gitlab.
  2. Commit changes to your own branch.
  3. Submit a pull request from your fork's branch to our branch 'dev'.

Authors

License

This project is licensed under the GNU GENERAL PUBLIC LICENSE - see the LICENSE file for details

Acknowledge

Code style: black

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

augmentedtree-0.2a0.tar.gz (30.2 kB view details)

Uploaded Source

Built Distribution

augmentedtree-0.2a0-py3-none-any.whl (45.9 kB view details)

Uploaded Python 3

File details

Details for the file augmentedtree-0.2a0.tar.gz.

File metadata

  • Download URL: augmentedtree-0.2a0.tar.gz
  • Upload date:
  • Size: 30.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3.post20200330 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.6.10

File hashes

Hashes for augmentedtree-0.2a0.tar.gz
Algorithm Hash digest
SHA256 d97a31cc8fad84a11400c677b83bd98f1fc148cec841680a785e7dd290e900c6
MD5 8ab44f07ce5932d433d793b56583f96a
BLAKE2b-256 37822eee428bf0751418d33507ec4d7cfe6d590f1b295de0b038efb25dee8306

See more details on using hashes here.

File details

Details for the file augmentedtree-0.2a0-py3-none-any.whl.

File metadata

  • Download URL: augmentedtree-0.2a0-py3-none-any.whl
  • Upload date:
  • Size: 45.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3.post20200330 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.6.10

File hashes

Hashes for augmentedtree-0.2a0-py3-none-any.whl
Algorithm Hash digest
SHA256 08a4449dbfef4dead58343ce3f404089eb00ae7c7f358c1541269747399a6c16
MD5 8b0341942178257d979454ce8809c7c0
BLAKE2b-256 ea91ca30a010cd495cb540f807597fe7674e087ef4e0f62cc387f7607d9814f0

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