pacifica/pacifica-notifications

View on GitHub
pacifica/notifications/jsonpath.py

Summary

Maintainability
A
0 mins
Test Coverage
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""The jsonpath interface module."""
from jsonpath2.path import Path


def parse(jsonpath_str):
    """Parse the json path."""
    return Path.parse_str(jsonpath_str)


def find(expr, data):
    """Match the expression in the data and return truthy value."""
    return bool(list(expr.match(data)))