Skip to main content

Search attributes easily within structures of type dictionary, list and embedded substructures with simple format "dict.users.0.name".

Project description

Deep finder

GitHub Pypi GA

Search attributes easily within structures of type dictionary, list and embedded substructures with simple format 'dict.users.0.name'.

Getting Started

Installation

  pip install deepfinder

Usage

Basic sample

from deepfinder import deep_find
user: dict = {
    'name': 'ash',
    'links': {
        'pokehub': '@ash',
    },
}
print(deep_find(user, 'links.pokehub'))
# output: '@ash'

List sample

from deepfinder import deep_find
user: dict = {
    'name': 'ash',
    'pokemons': [{
        'name': 'pikachu',
    }, {
        'name': 'charmander',
    }]
}
print(deep_find(user, 'pokemons.0.name'))
# output: 'pikachu'

List all result sample

from deepfinder import deep_find
user: dict = {
    'name': 'ash',
    'pokemons': [{
        'name': 'pikachu',
    }, {
        'name': 'charmander',
    }]
}
print(deep_find(user, 'pokemons.*.name'))
# output: ['pikachu', 'charmander']

List and not null result sample

from deepfinder import deep_find
user: dict = {
    'name': 'ash',
    'pokemons': [{
        'name': 'pikachu',
    }, {
        'name': 'charmander',
        'ball': 'superball',
    }]
}
print(deep_find(user, 'pokemons.?.ball'))
# output: ['superball']

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

deepfinder-0.0.5.tar.gz (3.1 kB view hashes)

Uploaded Source

Built Distribution

deepfinder-0.0.5-py3-none-any.whl (3.3 kB view hashes)

Uploaded Python 3

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