U
    kufd                  
   @   s   d Z ddlmZ ddlmZ ddddddddddddd	d
Zdd ZeeeZedkrddl	m
Z
 e
 ZeddZeddd  edddD ](ZeedZede efdd qdS )z
Validating highly nested schemas shouldn't cause exponential time blowups.

See https://github.com/python-jsonschema/jsonschema/issues/1097.
    )cycle)validator_forz/https://example.com/draft/2020-12/schema/strictz,https://json-schema.org/draft/2020-12/schemaT)z0https://json-schema.org/draft/2020-12/vocab/corez6https://json-schema.org/draft/2020-12/vocab/applicatorz7https://json-schema.org/draft/2020-12/vocab/unevaluatedz6https://json-schema.org/draft/2020-12/vocab/validationz5https://json-schema.org/draft/2020-12/vocab/meta-dataz=https://json-schema.org/draft/2020-12/vocab/format-annotationz3https://json-schema.org/draft/2020-12/vocab/contentmetaF)z$idz$schemaz$vocabularyz$dynamicAnchorz$refZunevaluatedPropertiesc                 C   sT   t ddddddg}ddd	d
iid}tt| d |D ]\}}d||id}q8|S )zL
    Produce a schema which validates deeply nested objects and arrays.
    ZfoobarZbazZquuxZspameggsobjectZhamtypestring)r   Z
properties   )r   ziprange)levelsnamesschema_name r   H/tmp/pip-unpacked-wheel-k94ccfep/jsonschema/benchmarks/nested_schemas.pynested_schema   s
    r   __main__)Runnerr
   )r   z
not nestedc                   C   s
   t tS N)	validatoris_valid
not_nestedr   r   r   r   <lambda>1       r         z	nested * c                 C   s
   t | S r   )r   r   )r   r   r   r   r   7   r   N)__doc__	itertoolsr   Zjsonschema.validatorsr   Zmetaschemaishr   r   __name__Zpyperfr   runnerr   Z
bench_funcr   r   r   r   r   r   r   <module>   s:   	


