B pSe @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|krd|}t|S)N.z jsonschema.)r)namer?/opt/alt/python37/lib/python3.7/site-packages/jsonschema/cli.py_namedAnyWithDefaultsr 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.)rrz --versionversion)rrschemaz3the JSON Schema to validate with (i.e. schema.json))rrcCs6ttj|pdgd}|ddkr2t|d|d<|S)Nz--help)args validatorr)varsparser parse_argsr)r argumentsrrr rDs rcCsttt|dddS)N)r)r )sysexitrunr)rrrr mainKsr%cCsp|d}|d|dd}||dd}x>|dp8dD].}x(||D]}||j|dd }qJWq:W|S) N error_formatrr)rFrr)errorT)Z check_schemaZ iter_errorswriteformat)r stdoutstderrr&rZerroredinstancer'rrr r$Os r$)__doc__ __future__rargparser r"Z jsonschemarZjsonschema._reflectrZjsonschema.validatorsrr rArgumentParserr add_argumentrargvr%r*r+r$rrrr sH