Skip to main content

traversy

Fast data traversal & manipulation tools for Python. Check out the documentation.

Actively Maintained MIT License PyPI pyversions

Quick-Start

from traversy import traverse
import json


jo = json.loads("""{
  "2019": {
    "uat": {
      "pkey": true,
      "user": "testval",
      "testkey": true,
      "mylist": [
      {
        "foo": "bar",
        "foo2": "bar2"
      },
      {
        "baz": "milk",
        "bar": "foo"
      }
      ]
    },
    "dev": {
      "pkey": true,
      "testval": "testval",
      "testval2": true
    },
    "test1": [1, 2, "testval"],
    "test2": [{"one": "foo", "two": "bar", "three": "testval"}]
  }
}""")

def is_eq(key, val, opath, query):  # Use of a filter func is optional.
    return val == query


for node in traverse(jo, is_eq, query="milk"):
    print("Found", node.key, ':', node.value)  # baz : milk
    print("Full path access:", jo[node.path_str])  # "2019.uat.mylist.1.baz"

For each iteration, traverse() returns a dict or data object of...

{'key', 'value', 'node_path', 'path_str', 'filter_func',
'filter_args': (data, kwargs), 'parent_node', 'output_formatter'}

For more information on these non-built-in data structure (Which are optional to use), check out mo-dots and dotty_dict.

Changelog

  • 11/15/2020 - 0.1.32 : Fix for pypi.

  • 11/15/2020 - 0.1.3 : Refactored & added more utility methods. Added docs.

  • 11/13/2020 - 0.1.2 : Doc correction.

  • 11/13/2020 - 0.1.1 : Deprecated set_output_format() and made package compatible with both Python 2 and Python 3.

Metadata

Release files for traversy 0.1.32

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for traversy 0.1.32
File Size Uploaded Provenance Actions
traversy-0.1.32.tar.gz 4.2 kB Without provenance Details for traversy-0.1.32.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for traversy 0.1.32
File Interpreter ABI Platform Actions
traversy-0.1.32-py3-none-any.whl Python 3 none any Details for traversy-0.1.32-py3-none-any.whl

Total release size: 8.2 kB

Release files / traversy-0.1.32.tar.gz

Download URL traversy-0.1.32.tar.gz
Size 4.2 kB
Tags Source
SHA-256 checksum
How to use checksums
4ad9c4ae8933a0ac86d40a7ac4b64012f2f7a26af199bafee588a1b79549c9a9
BLAKE2b-256 checksum
How to use checksums
b7bacc42efdeca278e3bc9f924157a47b50ee62d1aceb300afb90dc7da294fde
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.52.0 CPython/3.9.0

Release files / traversy-0.1.32-py3-none-any.whl

Download URL traversy-0.1.32-py3-none-any.whl
Size 4.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fbbfd5a04f744df8810753990d8bbe9e58f5ddd679b82b5e851de35fbec0b4b8
BLAKE2b-256 checksum
How to use checksums
8cacb7431f5217a472334f88a8c409b09a4547e9228da82820d4b7dc386f6158
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.52.0 CPython/3.9.0

Security for traversy 0.1.32

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page