Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

deepfinder

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

deepfinder

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

  • 1.4.2
  • PyPI
  • Socket score

Maintainers
1

🔍 Deepfinder

GitHub Pypi Downloads GA

Search attributes easily using dot paths. 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',
            'type': 'electric'
        },
        {
            'name': 'charmander',
            'type': 'fire'
        }
    ]
}
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',
            'type': 'electric'
        }, 
        {
            'name': 'charmander',
            'type': 'fire'
        }
    ]
}
print(deep_find(user, 'pokemons.*.name'))
# output: ['pikachu', 'charmander']
Find the first non-null result
from deepfinder import deep_find
user: dict = {
    'name': 'ash',
    'pokemons': [
        {
            'name': 'pikachu',
        },
        {
            'name': 'charmander',
            'ball': 'superball'
        }
    ]
}
print(deep_find(user, 'pokemons.?.ball'))
# output: 'superball'
Find all non-null results
from deepfinder import deep_find
user: dict = {
    'name': 'ash',
    'pokemons': [
        {
            'name': 'pikachu',
        },
        {
            'name': 'charmander',
            'ball': 'superball'
        },
        {
            'name': 'lucario',
            'ball': 'ultraball'
        }
    ]
}
print(deep_find(user, 'pokemons.*?.ball'))
# output: ['superball', 'ultraball']

Use custom dict and list

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

Keywords

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc