$52 GRAYBYTE WORDPRESS FILE MANAGER $21

SERVER : premium201.web-hosting.com #1 SMP Wed Mar 26 12:08:09 UTC 2025
SERVER IP : 172.67.217.254 | ADMIN IP 216.73.216.180
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : mail

/opt/imunify360/venv/lib/python3.11/site-packages/jsonschema/

HOME
Current File : /opt/imunify360/venv/lib/python3.11/site-packages/jsonschema//cli.py
"""
The ``jsonschema`` command line.
"""
from __future__ import absolute_import
import argparse
import json
import sys

from jsonschema import __version__
from jsonschema._reflect import namedAny
from jsonschema.validators import validator_for


def _namedAnyWithDefault(name):
    if "." not in name:
        name = "jsonschema." + name
    return namedAny(name)


def _json_file(path):
    with open(path) as file:
        return json.load(file)


parser = argparse.ArgumentParser(
    description="JSON Schema Validation CLI",
)
parser.add_argument(
    "-i", "--instance",
    action="append",
    dest="instances",
    type=_json_file,
    help=(
        "a path to a JSON instance (i.e. filename.json) "
        "to validate (may be specified multiple times)"
    ),
)
parser.add_argument(
    "-F", "--error-format",
    default="{error.instance}: {error.message}\n",
    help=(
        "the 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"
    ),
)
parser.add_argument(
    "-V", "--validator",
    type=_namedAnyWithDefault,
    help=(
        "the fully qualified object name of a validator to use, or, for "
        "validators that are registered with jsonschema, simply the name "
        "of the class."
    ),
)
parser.add_argument(
    "--version",
    action="version",
    version=__version__,
)
parser.add_argument(
    "schema",
    help="the JSON Schema to validate with (i.e. schema.json)",
    type=_json_file,
)


def parse_args(args):
    arguments = vars(parser.parse_args(args=args or ["--help"]))
    if arguments["validator"] is None:
        arguments["validator"] = validator_for(arguments["schema"])
    return arguments


def main(args=sys.argv[1:]):
    sys.exit(run(arguments=parse_args(args=args)))


def run(arguments, stdout=sys.stdout, stderr=sys.stderr):
    error_format = arguments["error_format"]
    validator = arguments["validator"](schema=arguments["schema"])

    validator.check_schema(arguments["schema"])

    errored = False
    for instance in arguments["instances"] or ():
        for error in validator.iter_errors(instance):
            stderr.write(error_format.format(error=error))
            errored = True
    return errored


Current_dir [ NOT WRITEABLE ] Document_root [ WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
3 Mar 2026 8.59 AM
root / root
0755
__pycache__
--
3 Mar 2026 8.59 AM
root / root
0755
benchmarks
--
3 Mar 2026 8.59 AM
root / root
0755
schemas
--
3 Mar 2026 8.59 AM
root / root
0755
tests
--
3 Mar 2026 8.59 AM
root / root
0755
__init__.py
0.912 KB
13 Feb 2026 12.40 PM
root / root
0644
__main__.py
0.038 KB
13 Feb 2026 12.40 PM
root / root
0644
_format.py
11.417 KB
13 Feb 2026 12.40 PM
root / root
0644
_legacy_validators.py
4.477 KB
13 Feb 2026 12.40 PM
root / root
0644
_reflect.py
4.905 KB
13 Feb 2026 12.40 PM
root / root
0644
_types.py
4.385 KB
13 Feb 2026 12.40 PM
root / root
0644
_utils.py
5.047 KB
13 Feb 2026 12.40 PM
root / root
0644
_validators.py
11.429 KB
13 Feb 2026 12.40 PM
root / root
0644
cli.py
2.256 KB
13 Feb 2026 12.40 PM
root / root
0644
compat.py
1.321 KB
13 Feb 2026 12.40 PM
root / root
0644
exceptions.py
10.205 KB
13 Feb 2026 12.40 PM
root / root
0644
validators.py
28.711 KB
13 Feb 2026 12.40 PM
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025 CONTACT ME
Static GIF