B e]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)namer6/tmp/pip-install-b8evvk6i/jsonschema/jsonschema/cli.py_namedAnyWithDefault sr c Cst| }t|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 rcCsttt|dddS)N)r)r)sysexitrunr)rrrrmainBsr#cCsp|d}|d|dd}||dd}x>|dp8dD].}x(||D]}||j|dd }qJWq:W|S) N error_formatrr)rFrr)errorT)Z check_schemaZ iter_errorswriteformat)rstdoutstderrr$rZerroredinstancer%rrrr"Fs r") __future__rargparser r Zjsonschema._reflectrZjsonschema.validatorsrr rArgumentParserr add_argumentrargvr#r(r)r"rrrrs<