Skip to main content

jQuery-QueryBuilder-Python-Evaluator

Python Rule evaluator for jQuery-QueryBuilder. It evaluates rules agains provided objects.

Website • autobotAI Cloud Governance

Inspired from SixiS/jquery_query_builder-rails

Usage

Install the package.

pip install jqqb-evaluator

Usage Example:

from jqqb_evaluator.evaluator import Evaluator
rule_json = {
    "condition": "AND",
    "rules": [{
        "id": "tagname",
        "field": "tags.name",
        "type": "string",
        "input": "text",
        "operator": "not_contains",
        "value": "production"
    }, {
        "id": "tagname",
        "field": "tags.name",
        "type": "string",
        "input": "text",
        "operator": "begins_with",
        "value": "development"
    }, {
        "condition": "OR",
        "rules": [{
            "id": "type",
            "field": "type",
            "type": "string",
            "input": "text",
            "operator": "equal",
            "value": "ec2"
        },{
            "id": "type",
            "field": "type",
            "type": "string",
            "input": "text",
            "operator": "equal",
            "value": "ami"
        }]
    }]
}


evaluator = Evaluator(rule_json)
object_1 = {'type': "ec2", "tags": [{"name": "hello"}, {"name": "asdfasfproduction_instance"}]}
object_2 = {'type': "ami", "tags": [{"name": "development"}, {"name": "asfdafdroduction_instance"}, {"name": "proction"}]}
objects = [object_1, object_2]

print(evaluator.get_matching_objects(objects))

Result:

[{'type': 'ami', 'tags': [{'name': 'development'}, {'name': 'asfdafdroduction_instance'}, {'name': 'proction'}]}]

Release files for jqqb-evaluator 0.0.1

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

Source distribution (sdist)

Source distribution for jqqb-evaluator 0.0.1
File Size Uploaded
jqqb_evaluator-0.0.1.tar.gz 3.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for jqqb-evaluator 0.0.1
File Interpreter ABI Platform
jqqb_evaluator-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 9.1 kB

Release files / jqqb_evaluator-0.0.1.tar.gz

Download URL jqqb_evaluator-0.0.1.tar.gz
Size 3.3 kB
Tags Source
SHA-256 checksum
How to use checksums
8b5b00718cced03fb6552de596a65e8d741bf4a2b4b0a5815d4d0acef7773ecc
BLAKE2b-256 checksum
How to use checksums
416409a942f8e967cb470073defb8acde7972e7dbbb0b8437b291d65aabd40f7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.41.0 CPython/3.7.4

Release files / jqqb_evaluator-0.0.1-py3-none-any.whl

Download URL jqqb_evaluator-0.0.1-py3-none-any.whl
Size 5.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f04ddfc9829f2847145f7229b0b9fb51c6ad4792455638d499f14d2a98a1bac9
BLAKE2b-256 checksum
How to use checksums
0ceca168c67852e7f81a694b06d4edaceff265f6f2bc2aefc81061210aa31e1e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.41.0 CPython/3.7.4

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

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