o >] @sdZddlmZddlZddlZddlZddlmZddlm Z ddl m Z ddZ d d Z ejd d Zejd ddde ddejdddddejdde ddejddedejdd e d!d"d#Zejd$dfd%d&Zejejfd'd(ZdS))z" The ``jsonschema`` command line. )absolute_importN) __version__namedAny) validator_forcCsd|vrd|}t|S)N.z jsonschema.r)namer 0/usr/lib/python3/dist-packages/jsonschema/cli.py_namedAnyWithDefaultsr cCs6t| }t|WdS1swYdS)N)openjsonload)pathfiler r r _json_files $rzJSON Schema Validation CLI) descriptionz-iz --instanceappend instancesz\a path to a JSON instance (i.e. filename.json) to validate (may be specified multiple times))actiondesttypehelpz-Fz--error-formatz"{error.instance}: {error.message} zthe format to use for each error output message, specified in a form suitable for passing to str.format, which will be called with 'error' for each error)defaultrz-Vz --validatorzthe fully qualified object name of a validator to use, or, for validators that are registered with jsonschema, simply the name of the class.)rrz --versionversion)rrschemaz3the JSON Schema to validate with (i.e. schema.json))rrcCs6ttj|pdgd}|ddurt|d|d<|S)Nz--helpargs validatorr)varsparser parse_argsr)r argumentsr r r r!Ds r!cCsttt|dddS)Nr)r")sysexitrunr!rr r r mainKsr'cCsh|d}|d|dd}||dd}|dpdD]}||D] }||j|dd }q#q|S) N error_formatrr)rFrr )errorT) check_schema iter_errorswriteformat)r"stdoutstderrr(rerroredinstancer)r r r r&Osr&)__doc__ __future__rargparser r$ jsonschemarjsonschema._reflectrjsonschema.validatorsrr rArgumentParserr add_argumentr!argvr'r.r/r&r r r r sV