3 F\f@sddlmZddlZddlZddlZddlmZddlmZddZ ddZ ej d d Z e j d d d de dde j ddddde j dde dde j dde dddZejddfd d!Zejejfd"d#ZdS)$)absolute_importN)namedAny) validator_forcCsd|krd|}t|S)N.z jsonschema.)r)namerj/private/var/folders/pf/wv4htv3x0qs2c2mp0dnn0kchsvlck3/T/pip-install-emcbgzcf/jsonschema/jsonschema/cli.py_namedAnyWithDefault sr c Cst| }tj|SQRXdS)N)openjsonload)pathfilerrr _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.)rrschemaz7the JSON Schema to validate with (i.e. filename.schema))rrcCs6ttj|pdgd}|ddkr2t|d|d<|S)Nz--help)args validatorr)varsparser parse_argsr)r argumentsrrrr;s rcCstjtt|dddS)N)r)r)sysexitrunr)rrrrmainBsr#cCsp|d}|d|dd}|j|dd}x>|dp8fD].}x(|j|D]}|j|j|dd}qJWq:W|S) N error_formatrr)rFr)errorT)Z check_schemaZ iter_errorswriteformat)rstdoutstderrr$rZerroredinstancer%rrrr"Fs r") __future__rargparser r Zjsonschema._reflectrZjsonschema.validatorsrr rArgumentParserr add_argumentrargvr#r(r)r"rrrrs<