__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
"""
An unused schema registry should not cause slower validation.
"Unused" here means one where no reference resolution is occurring anyhow.
See https://github.com/python-jsonschema/jsonschema/issues/1088.
"""
from pyperf import Runner
from referencing import Registry
from referencing.jsonschema import DRAFT201909
from jsonschema import Draft201909Validator
registry = Registry().with_resource(
"urn:example:foo",
DRAFT201909.create_resource({})
)
schema = {"$ref": "https://json-schema.org/draft/2019-09/schema"}
instance = {"maxLength": 4}
no_registry = Draft201909Validator(schema)
with_useless_registry = Draft201909Validator(schema, registry=registry)
if __name__ == "__main__":
runner = Runner()
runner.bench_func(
"no registry",
lambda: no_registry.is_valid(instance),
)
runner.bench_func(
"useless registry",
lambda: with_useless_registry.is_valid(instance),
)
| 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 |
|