http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/6a81d1e7/env2/lib/python2.7/site-packages/jsonschema-2.5.1.dist-info/METADATA ---------------------------------------------------------------------- diff --git a/env2/lib/python2.7/site-packages/jsonschema-2.5.1.dist-info/METADATA b/env2/lib/python2.7/site-packages/jsonschema-2.5.1.dist-info/METADATA deleted file mode 100644 index a5b1325..0000000 --- a/env2/lib/python2.7/site-packages/jsonschema-2.5.1.dist-info/METADATA +++ /dev/null @@ -1,135 +0,0 @@ -Metadata-Version: 2.0 -Name: jsonschema -Version: 2.5.1 -Summary: An implementation of JSON Schema validation for Python -Home-page: http://github.com/Julian/jsonschema -Author: Julian Berman -Author-email: jul...@grayvines.com -License: MIT -Platform: UNKNOWN -Classifier: Development Status :: 5 - Production/Stable -Classifier: Intended Audience :: Developers -Classifier: License :: OSI Approved :: MIT License -Classifier: Operating System :: OS Independent -Classifier: Programming Language :: Python -Classifier: Programming Language :: Python :: 2 -Classifier: Programming Language :: Python :: 2.6 -Classifier: Programming Language :: Python :: 2.7 -Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.4 -Classifier: Programming Language :: Python :: Implementation :: CPython -Classifier: Programming Language :: Python :: Implementation :: PyPy -Requires-Dist: argparse; python_version=='2.6' -Requires-Dist: repoze.lru; python_version=='2.6' -Requires-Dist: functools32; python_version=='2.7' -Provides-Extra: format -Requires-Dist: rfc3987; extra == 'format' -Requires-Dist: strict-rfc3339; extra == 'format' -Requires-Dist: webcolors; extra == 'format' - -.. image:: https://img.shields.io/pypi/v/jsonschema.svg - :target: https://pypi.python.org/pypi/jsonschema -.. image:: https://travis-ci.org/Julian/jsonschema.svg?branch=master - :target: https://travis-ci.org/Julian/jsonschema -.. image:: https://img.shields.io/pypi/l/jsonschema.svg - :target: https://pypi.python.org/pypi/jsonschema - -========== -jsonschema -========== - -``jsonschema`` is an implementation of `JSON Schema <http://json-schema.org>`_ -for Python (supporting 2.6+ including Python 3). - -.. code-block:: python - - >>> from jsonschema import validate - - >>> # A sample schema, like what we'd get from json.load() - >>> schema = { - ... "type" : "object", - ... "properties" : { - ... "price" : {"type" : "number"}, - ... "name" : {"type" : "string"}, - ... }, - ... } - - >>> # If no exception is raised by validate(), the instance is valid. - >>> validate({"name" : "Eggs", "price" : 34.99}, schema) - - >>> validate( - ... {"name" : "Eggs", "price" : "Invalid"}, schema - ... ) # doctest: +IGNORE_EXCEPTION_DETAIL - Traceback (most recent call last): - ... - ValidationError: 'Invalid' is not of type 'number' - - -Features --------- - -* Full support for - `Draft 3 <https://python-jsonschema.readthedocs.org/en/latest/validate/#jsonschema.Draft3Validator>`_ - **and** `Draft 4 <https://python-jsonschema.readthedocs.org/en/latest/validate/#jsonschema.Draft4Validator>`_ - of the schema. - -* `Lazy validation <https://python-jsonschema.readthedocs.org/en/latest/validate/#jsonschema.IValidator.iter_errors>`_ - that can iteratively report *all* validation errors. - -* Small and extensible - -* `Programmatic querying <https://python-jsonschema.readthedocs.org/en/latest/errors/#module-jsonschema>`_ - of which properties or items failed validation. - - -Release Notes -------------- - -Version 2.5.0 is mainly a performance release. The interface for `RefResolver` -was extended to add methods that improve performance on CPython. - -Support for custom `RefResolver` objects with the legacy interface should *not* -be affected. If you notice something amiss please file an issue ticket. - - -Running the Test Suite ----------------------- - -If you have ``tox`` installed (perhaps via ``pip install tox`` or your -package manager), running``tox`` in the directory of your source checkout will -run ``jsonschema``'s test suite on all of the versions of Python ``jsonschema`` -supports. Note that you'll need to have all of those versions installed in -order to run the tests on each of them, otherwise ``tox`` will skip (and fail) -the tests on that version. - -Of course you're also free to just run the tests on a single version with your -favorite test runner. The tests live in the ``jsonschema.tests`` package. - - -Community ---------- - -There's a `mailing list <https://groups.google.com/forum/#!forum/jsonschema>`_ -for this implementation on Google Groups. - -Please join, and feel free to send questions there. - - -Contributing ------------- - -I'm Julian Berman. - -``jsonschema`` is on `GitHub <http://github.com/Julian/jsonschema>`_. - -Get in touch, via GitHub or otherwise, if you've got something to contribute, -it'd be most welcome! - -You can also generally find me on Freenode (nick: ``tos9``) in various -channels, including ``#python``. - -If you feel overwhelmingly grateful, you can woo me with beer money on -`Gittip <https://www.gittip.com/Julian/>`_ or via Google Wallet with the email -in my GitHub profile. - -
http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/6a81d1e7/env2/lib/python2.7/site-packages/jsonschema-2.5.1.dist-info/RECORD ---------------------------------------------------------------------- diff --git a/env2/lib/python2.7/site-packages/jsonschema-2.5.1.dist-info/RECORD b/env2/lib/python2.7/site-packages/jsonschema-2.5.1.dist-info/RECORD deleted file mode 100644 index 6f3a098..0000000 --- a/env2/lib/python2.7/site-packages/jsonschema-2.5.1.dist-info/RECORD +++ /dev/null @@ -1,48 +0,0 @@ -jsonschema/__init__.py,sha256=i_VuxyzDbWzZ7L-RKt0Gmkei7Xv-LAs4UCh-noUYswY,679 -jsonschema/__main__.py,sha256=in4bbzfixCAyGe3RhBwhQVZnGkruszNedcbmwxGyJgc,39 -jsonschema/_format.py,sha256=ac8tTiJaXvzQ5hQ9VRIvN-1VOO4w8Jd1LCS3u1ZqTp0,6881 -jsonschema/_reflect.py,sha256=gggQrcrf5FRoyhgdE6ggJ4n2FQHEzWS4CS-cm9bYcqI,5023 -jsonschema/_utils.py,sha256=mPVPVM5rt0XvZ2wuRx5j7oFGZJ45OXskUEUSoOXpx7o,4981 -jsonschema/_validators.py,sha256=DgoRcRTG6pjEj_Z6IkAk88hTD3b9KXpEwuT7cu4Dn0s,11790 -jsonschema/_version.py,sha256=h-Fdj3FONf-4lP3k14WBAd_qtD69U9TcbWcnGVN6dX0,122 -jsonschema/cli.py,sha256=idAf1KB1LRaoXIwzsVDnSPPoZfT7l7KQkPwpHkxcoV8,2014 -jsonschema/compat.py,sha256=Cm5UywlxzZkOp4gUFWW4ltF-E1I6WJJvfujRmr77Rk8,1553 -jsonschema/exceptions.py,sha256=D1c7iWtViYP9nTkNFMnX5m32Z4D54klHzGdc93zLfWQ,6973 -jsonschema/validators.py,sha256=lt8uSaCpJUwQOxuxHGA-Fv3fGoBvcT6E97Pp_9ED49M,15921 -jsonschema/schemas/draft3.json,sha256=Ay_5TPqTeHYue76cgrx12ekiykzF53Q4idGiFwOVtFw,4624 -jsonschema/schemas/draft4.json,sha256=yMIOK7e5fC_3WKlxGpUsbwfPCPFk8HT8Hlg4kJLpICU,5459 -jsonschema/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -jsonschema/tests/compat.py,sha256=ByulkmjQUUJT7uWJc9I7oaiEJalevvXT4HT778Y3SpQ,215 -jsonschema/tests/test_cli.py,sha256=0U2bKH-D_afQZ7bYwKXdfu1vIa_xDTa1edfkCUpnUZI,3575 -jsonschema/tests/test_exceptions.py,sha256=65ulkhro1ZgEYkiSiJw0rjSH-ox-o6jlIfpJubGBGsg,13392 -jsonschema/tests/test_format.py,sha256=P5oJFShmPArQq0hUILBnhCeL7CufQU9IFOiHndB6EEw,2150 -jsonschema/tests/test_jsonschema_test_suite.py,sha256=JoVVQ4VIyAYNpelQd2aQiDX8kt3sQVcvdtRMqxAdbbY,9644 -jsonschema/tests/test_validators.py,sha256=5qt1ztW3Yw0QgqfTrNxKMPnkkrM90W2YOUYNZGGjSro,33210 -jsonschema-2.5.1.dist-info/DESCRIPTION.rst,sha256=bxjll1BZoHq9yty7Kz9vWThJBQHrOZyJWQg8DBCwfuE,3498 -jsonschema-2.5.1.dist-info/entry_points.txt,sha256=KaVUBBSLyzi5naUkVg-r3q6T_igdLgaHY6Mm3oLX73s,52 -jsonschema-2.5.1.dist-info/METADATA,sha256=5EPI6REkuzEX1JxzZ3eq-hSXrSeijTOiCGCT28q-I3s,4684 -jsonschema-2.5.1.dist-info/metadata.json,sha256=5264OAGkXfbw-wfnTJ4yoXLN9rAeekSzMteqkEXQS2M,1401 -jsonschema-2.5.1.dist-info/pbr.json,sha256=5ioH29fQsqgieIG0j6NOp_cvGDsQOmj-etwNZepS91E,46 -jsonschema-2.5.1.dist-info/RECORD,, -jsonschema-2.5.1.dist-info/top_level.txt,sha256=jGoNS61vDONU8U7p0Taf-y_8JVG1Z2CJ5Eif6zMN_cw,11 -jsonschema-2.5.1.dist-info/WHEEL,sha256=AvR0WeTpDaxT645bl5FQxUK6NPsTls2ttpcGJg3j1Xg,110 -../../../bin/jsonschema,sha256=p9bdEl69YWedfeJbLpHc-8Fd2LOSWzhd8oykwKS2zgU,285 -jsonschema-2.5.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 -jsonschema/cli.pyc,, -jsonschema/tests/test_exceptions.pyc,, -jsonschema/exceptions.pyc,, -jsonschema/tests/test_format.pyc,, -jsonschema/_version.pyc,, -jsonschema/tests/compat.pyc,, -jsonschema/_validators.pyc,, -jsonschema/tests/__init__.pyc,, -jsonschema/_format.pyc,, -jsonschema/validators.pyc,, -jsonschema/tests/test_validators.pyc,, -jsonschema/_reflect.pyc,, -jsonschema/__init__.pyc,, -jsonschema/__main__.pyc,, -jsonschema/_utils.pyc,, -jsonschema/tests/test_jsonschema_test_suite.pyc,, -jsonschema/tests/test_cli.pyc,, -jsonschema/compat.pyc,, http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/6a81d1e7/env2/lib/python2.7/site-packages/jsonschema-2.5.1.dist-info/WHEEL ---------------------------------------------------------------------- diff --git a/env2/lib/python2.7/site-packages/jsonschema-2.5.1.dist-info/WHEEL b/env2/lib/python2.7/site-packages/jsonschema-2.5.1.dist-info/WHEEL deleted file mode 100644 index 9dff69d..0000000 --- a/env2/lib/python2.7/site-packages/jsonschema-2.5.1.dist-info/WHEEL +++ /dev/null @@ -1,6 +0,0 @@ -Wheel-Version: 1.0 -Generator: bdist_wheel (0.24.0) -Root-Is-Purelib: true -Tag: py2-none-any -Tag: py3-none-any - http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/6a81d1e7/env2/lib/python2.7/site-packages/jsonschema-2.5.1.dist-info/entry_points.txt ---------------------------------------------------------------------- diff --git a/env2/lib/python2.7/site-packages/jsonschema-2.5.1.dist-info/entry_points.txt b/env2/lib/python2.7/site-packages/jsonschema-2.5.1.dist-info/entry_points.txt deleted file mode 100644 index c627b31..0000000 --- a/env2/lib/python2.7/site-packages/jsonschema-2.5.1.dist-info/entry_points.txt +++ /dev/null @@ -1,3 +0,0 @@ -[console_scripts] -jsonschema = jsonschema.cli:main - http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/6a81d1e7/env2/lib/python2.7/site-packages/jsonschema-2.5.1.dist-info/metadata.json ---------------------------------------------------------------------- diff --git a/env2/lib/python2.7/site-packages/jsonschema-2.5.1.dist-info/metadata.json b/env2/lib/python2.7/site-packages/jsonschema-2.5.1.dist-info/metadata.json deleted file mode 100644 index 2afcb8a..0000000 --- a/env2/lib/python2.7/site-packages/jsonschema-2.5.1.dist-info/metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"license": "MIT", "name": "jsonschema", "metadata_version": "2.0", "generator": "bdist_wheel (0.24.0)", "summary": "An implementation of JSON Schema validation for Python", "run_requires": [{"environment": "python_version=='2.7'", "requires": ["functools32"]}, {"environment": "python_version=='2.6'", "requires": ["argparse", "repoze.lru"]}, {"requires": ["rfc3987", "strict-rfc3339", "webcolors"], "extra": "format"}], "version": "2.5.1", "extensions": {"python.details": {"project_urls": {"Home": "http://github.com/Julian/jsonschema"}, "document_names": {"description": "DESCRIPTION.rst"}, "contacts": [{"role": "author", "email": "jul...@grayvines.com", "name": "Julian Berman"}]}, "python.commands": {"wrap_console": {"jsonschema": "jsonschema.cli:main"}}, "python.exports": {"console_scripts": {"jsonschema": "jsonschema.cli:main"}}}, "classifiers": ["Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating Sys tem :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy"], "extras": ["format"]} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/6a81d1e7/env2/lib/python2.7/site-packages/jsonschema-2.5.1.dist-info/pbr.json ---------------------------------------------------------------------- diff --git a/env2/lib/python2.7/site-packages/jsonschema-2.5.1.dist-info/pbr.json b/env2/lib/python2.7/site-packages/jsonschema-2.5.1.dist-info/pbr.json deleted file mode 100644 index 6506f82..0000000 --- a/env2/lib/python2.7/site-packages/jsonschema-2.5.1.dist-info/pbr.json +++ /dev/null @@ -1 +0,0 @@ -{"is_release": true, "git_version": "3f459b7"} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/6a81d1e7/env2/lib/python2.7/site-packages/jsonschema-2.5.1.dist-info/top_level.txt ---------------------------------------------------------------------- diff --git a/env2/lib/python2.7/site-packages/jsonschema-2.5.1.dist-info/top_level.txt b/env2/lib/python2.7/site-packages/jsonschema-2.5.1.dist-info/top_level.txt deleted file mode 100644 index d89304b..0000000 --- a/env2/lib/python2.7/site-packages/jsonschema-2.5.1.dist-info/top_level.txt +++ /dev/null @@ -1 +0,0 @@ -jsonschema http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/6a81d1e7/env2/lib/python2.7/site-packages/jsonschema/__init__.py ---------------------------------------------------------------------- diff --git a/env2/lib/python2.7/site-packages/jsonschema/__init__.py b/env2/lib/python2.7/site-packages/jsonschema/__init__.py deleted file mode 100644 index baf1d89..0000000 --- a/env2/lib/python2.7/site-packages/jsonschema/__init__.py +++ /dev/null @@ -1,24 +0,0 @@ -""" -An implementation of JSON Schema for Python - -The main functionality is provided by the validator classes for each of the -supported JSON Schema versions. - -Most commonly, :func:`validate` is the quickest way to simply validate a given -instance under a schema, and will create a validator for you. - -""" - -from jsonschema.exceptions import ( - ErrorTree, FormatError, RefResolutionError, SchemaError, ValidationError -) -from jsonschema._format import ( - FormatChecker, draft3_format_checker, draft4_format_checker, -) -from jsonschema.validators import ( - Draft3Validator, Draft4Validator, RefResolver, validate -) - -from jsonschema._version import __version__ - -# flake8: noqa http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/6a81d1e7/env2/lib/python2.7/site-packages/jsonschema/__main__.py ---------------------------------------------------------------------- diff --git a/env2/lib/python2.7/site-packages/jsonschema/__main__.py b/env2/lib/python2.7/site-packages/jsonschema/__main__.py deleted file mode 100644 index 82c29fd..0000000 --- a/env2/lib/python2.7/site-packages/jsonschema/__main__.py +++ /dev/null @@ -1,2 +0,0 @@ -from jsonschema.cli import main -main() http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/6a81d1e7/env2/lib/python2.7/site-packages/jsonschema/_format.py ---------------------------------------------------------------------- diff --git a/env2/lib/python2.7/site-packages/jsonschema/_format.py b/env2/lib/python2.7/site-packages/jsonschema/_format.py deleted file mode 100644 index bb52d18..0000000 --- a/env2/lib/python2.7/site-packages/jsonschema/_format.py +++ /dev/null @@ -1,240 +0,0 @@ -import datetime -import re -import socket - -from jsonschema.compat import str_types -from jsonschema.exceptions import FormatError - - -class FormatChecker(object): - """ - A ``format`` property checker. - - JSON Schema does not mandate that the ``format`` property actually do any - validation. If validation is desired however, instances of this class can - be hooked into validators to enable format validation. - - :class:`FormatChecker` objects always return ``True`` when asked about - formats that they do not know how to validate. - - To check a custom format using a function that takes an instance and - returns a ``bool``, use the :meth:`FormatChecker.checks` or - :meth:`FormatChecker.cls_checks` decorators. - - :argument iterable formats: the known formats to validate. This argument - can be used to limit which formats will be used - during validation. - - """ - - checkers = {} - - def __init__(self, formats=None): - if formats is None: - self.checkers = self.checkers.copy() - else: - self.checkers = dict((k, self.checkers[k]) for k in formats) - - def checks(self, format, raises=()): - """ - Register a decorated function as validating a new format. - - :argument str format: the format that the decorated function will check - :argument Exception raises: the exception(s) raised by the decorated - function when an invalid instance is found. The exception object - will be accessible as the :attr:`ValidationError.cause` attribute - of the resulting validation error. - - """ - - def _checks(func): - self.checkers[format] = (func, raises) - return func - return _checks - - cls_checks = classmethod(checks) - - def check(self, instance, format): - """ - Check whether the instance conforms to the given format. - - :argument instance: the instance to check - :type: any primitive type (str, number, bool) - :argument str format: the format that instance should conform to - :raises: :exc:`FormatError` if instance does not conform to format - - """ - - if format not in self.checkers: - return - - func, raises = self.checkers[format] - result, cause = None, None - try: - result = func(instance) - except raises as e: - cause = e - if not result: - raise FormatError( - "%r is not a %r" % (instance, format), cause=cause, - ) - - def conforms(self, instance, format): - """ - Check whether the instance conforms to the given format. - - :argument instance: the instance to check - :type: any primitive type (str, number, bool) - :argument str format: the format that instance should conform to - :rtype: bool - - """ - - try: - self.check(instance, format) - except FormatError: - return False - else: - return True - - -_draft_checkers = {"draft3": [], "draft4": []} - - -def _checks_drafts(both=None, draft3=None, draft4=None, raises=()): - draft3 = draft3 or both - draft4 = draft4 or both - - def wrap(func): - if draft3: - _draft_checkers["draft3"].append(draft3) - func = FormatChecker.cls_checks(draft3, raises)(func) - if draft4: - _draft_checkers["draft4"].append(draft4) - func = FormatChecker.cls_checks(draft4, raises)(func) - return func - return wrap - - -@_checks_drafts("email") -def is_email(instance): - if not isinstance(instance, str_types): - return True - return "@" in instance - - -_ipv4_re = re.compile(r"^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$") - -@_checks_drafts(draft3="ip-address", draft4="ipv4") -def is_ipv4(instance): - if not isinstance(instance, str_types): - return True - if not _ipv4_re.match(instance): - return False - return all(0 <= int(component) <= 255 for component in instance.split(".")) - - -if hasattr(socket, "inet_pton"): - @_checks_drafts("ipv6", raises=socket.error) - def is_ipv6(instance): - if not isinstance(instance, str_types): - return True - return socket.inet_pton(socket.AF_INET6, instance) - - -_host_name_re = re.compile(r"^[A-Za-z0-9][A-Za-z0-9\.\-]{1,255}$") - -@_checks_drafts(draft3="host-name", draft4="hostname") -def is_host_name(instance): - if not isinstance(instance, str_types): - return True - if not _host_name_re.match(instance): - return False - components = instance.split(".") - for component in components: - if len(component) > 63: - return False - return True - - -try: - import rfc3987 -except ImportError: - pass -else: - @_checks_drafts("uri", raises=ValueError) - def is_uri(instance): - if not isinstance(instance, str_types): - return True - return rfc3987.parse(instance, rule="URI") - - -try: - import strict_rfc3339 -except ImportError: - try: - import isodate - except ImportError: - pass - else: - @_checks_drafts("date-time", raises=(ValueError, isodate.ISO8601Error)) - def is_date(instance): - if not isinstance(instance, str_types): - return True - return isodate.parse_datetime(instance) -else: - @_checks_drafts("date-time") - def is_date(instance): - if not isinstance(instance, str_types): - return True - return strict_rfc3339.validate_rfc3339(instance) - - -@_checks_drafts("regex", raises=re.error) -def is_regex(instance): - if not isinstance(instance, str_types): - return True - return re.compile(instance) - - -@_checks_drafts(draft3="date", raises=ValueError) -def is_date(instance): - if not isinstance(instance, str_types): - return True - return datetime.datetime.strptime(instance, "%Y-%m-%d") - - -@_checks_drafts(draft3="time", raises=ValueError) -def is_time(instance): - if not isinstance(instance, str_types): - return True - return datetime.datetime.strptime(instance, "%H:%M:%S") - - -try: - import webcolors -except ImportError: - pass -else: - def is_css_color_code(instance): - return webcolors.normalize_hex(instance) - - - @_checks_drafts(draft3="color", raises=(ValueError, TypeError)) - def is_css21_color(instance): - if ( - not isinstance(instance, str_types) or - instance.lower() in webcolors.css21_names_to_hex - ): - return True - return is_css_color_code(instance) - - - def is_css3_color(instance): - if instance.lower() in webcolors.css3_names_to_hex: - return True - return is_css_color_code(instance) - - -draft3_format_checker = FormatChecker(_draft_checkers["draft3"]) -draft4_format_checker = FormatChecker(_draft_checkers["draft4"]) http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/6a81d1e7/env2/lib/python2.7/site-packages/jsonschema/_reflect.py ---------------------------------------------------------------------- diff --git a/env2/lib/python2.7/site-packages/jsonschema/_reflect.py b/env2/lib/python2.7/site-packages/jsonschema/_reflect.py deleted file mode 100644 index d09e38f..0000000 --- a/env2/lib/python2.7/site-packages/jsonschema/_reflect.py +++ /dev/null @@ -1,155 +0,0 @@ -# -*- test-case-name: twisted.test.test_reflect -*- -# Copyright (c) Twisted Matrix Laboratories. -# See LICENSE for details. - -""" -Standardized versions of various cool and/or strange things that you can do -with Python's reflection capabilities. -""" - -import sys - -from jsonschema.compat import PY3 - - -class _NoModuleFound(Exception): - """ - No module was found because none exists. - """ - - - -class InvalidName(ValueError): - """ - The given name is not a dot-separated list of Python objects. - """ - - - -class ModuleNotFound(InvalidName): - """ - The module associated with the given name doesn't exist and it can't be - imported. - """ - - - -class ObjectNotFound(InvalidName): - """ - The object associated with the given name doesn't exist and it can't be - imported. - """ - - - -if PY3: - def reraise(exception, traceback): - raise exception.with_traceback(traceback) -else: - exec("""def reraise(exception, traceback): - raise exception.__class__, exception, traceback""") - -reraise.__doc__ = """ -Re-raise an exception, with an optional traceback, in a way that is compatible -with both Python 2 and Python 3. - -Note that on Python 3, re-raised exceptions will be mutated, with their -C{__traceback__} attribute being set. - -@param exception: The exception instance. -@param traceback: The traceback to use, or C{None} indicating a new traceback. -""" - - -def _importAndCheckStack(importName): - """ - Import the given name as a module, then walk the stack to determine whether - the failure was the module not existing, or some code in the module (for - example a dependent import) failing. This can be helpful to determine - whether any actual application code was run. For example, to distiguish - administrative error (entering the wrong module name), from programmer - error (writing buggy code in a module that fails to import). - - @param importName: The name of the module to import. - @type importName: C{str} - @raise Exception: if something bad happens. This can be any type of - exception, since nobody knows what loading some arbitrary code might - do. - @raise _NoModuleFound: if no module was found. - """ - try: - return __import__(importName) - except ImportError: - excType, excValue, excTraceback = sys.exc_info() - while excTraceback: - execName = excTraceback.tb_frame.f_globals["__name__"] - # in Python 2 execName is None when an ImportError is encountered, - # where in Python 3 execName is equal to the importName. - if execName is None or execName == importName: - reraise(excValue, excTraceback) - excTraceback = excTraceback.tb_next - raise _NoModuleFound() - - - -def namedAny(name): - """ - Retrieve a Python object by its fully qualified name from the global Python - module namespace. The first part of the name, that describes a module, - will be discovered and imported. Each subsequent part of the name is - treated as the name of an attribute of the object specified by all of the - name which came before it. For example, the fully-qualified name of this - object is 'twisted.python.reflect.namedAny'. - - @type name: L{str} - @param name: The name of the object to return. - - @raise InvalidName: If the name is an empty string, starts or ends with - a '.', or is otherwise syntactically incorrect. - - @raise ModuleNotFound: If the name is syntactically correct but the - module it specifies cannot be imported because it does not appear to - exist. - - @raise ObjectNotFound: If the name is syntactically correct, includes at - least one '.', but the module it specifies cannot be imported because - it does not appear to exist. - - @raise AttributeError: If an attribute of an object along the way cannot be - accessed, or a module along the way is not found. - - @return: the Python object identified by 'name'. - """ - if not name: - raise InvalidName('Empty module name') - - names = name.split('.') - - # if the name starts or ends with a '.' or contains '..', the __import__ - # will raise an 'Empty module name' error. This will provide a better error - # message. - if '' in names: - raise InvalidName( - "name must be a string giving a '.'-separated list of Python " - "identifiers, not %r" % (name,)) - - topLevelPackage = None - moduleNames = names[:] - while not topLevelPackage: - if moduleNames: - trialname = '.'.join(moduleNames) - try: - topLevelPackage = _importAndCheckStack(trialname) - except _NoModuleFound: - moduleNames.pop() - else: - if len(names) == 1: - raise ModuleNotFound("No module named %r" % (name,)) - else: - raise ObjectNotFound('%r does not name an object' % (name,)) - - obj = topLevelPackage - for n in names[1:]: - obj = getattr(obj, n) - - return obj http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/6a81d1e7/env2/lib/python2.7/site-packages/jsonschema/_utils.py ---------------------------------------------------------------------- diff --git a/env2/lib/python2.7/site-packages/jsonschema/_utils.py b/env2/lib/python2.7/site-packages/jsonschema/_utils.py deleted file mode 100644 index ae7e2b5..0000000 --- a/env2/lib/python2.7/site-packages/jsonschema/_utils.py +++ /dev/null @@ -1,213 +0,0 @@ -import itertools -import json -import pkgutil -import re - -from jsonschema.compat import str_types, MutableMapping, urlsplit - - -class URIDict(MutableMapping): - """ - Dictionary which uses normalized URIs as keys. - - """ - - def normalize(self, uri): - return urlsplit(uri).geturl() - - def __init__(self, *args, **kwargs): - self.store = dict() - self.store.update(*args, **kwargs) - - def __getitem__(self, uri): - return self.store[self.normalize(uri)] - - def __setitem__(self, uri, value): - self.store[self.normalize(uri)] = value - - def __delitem__(self, uri): - del self.store[self.normalize(uri)] - - def __iter__(self): - return iter(self.store) - - def __len__(self): - return len(self.store) - - def __repr__(self): - return repr(self.store) - - -class Unset(object): - """ - An as-of-yet unset attribute or unprovided default parameter. - - """ - - def __repr__(self): - return "<unset>" - - -def load_schema(name): - """ - Load a schema from ./schemas/``name``.json and return it. - - """ - - data = pkgutil.get_data('jsonschema', "schemas/{0}.json".format(name)) - return json.loads(data.decode("utf-8")) - - -def indent(string, times=1): - """ - A dumb version of :func:`textwrap.indent` from Python 3.3. - - """ - - return "\n".join(" " * (4 * times) + line for line in string.splitlines()) - - -def format_as_index(indices): - """ - Construct a single string containing indexing operations for the indices. - - For example, [1, 2, "foo"] -> [1][2]["foo"] - - :type indices: sequence - - """ - - if not indices: - return "" - return "[%s]" % "][".join(repr(index) for index in indices) - - -def find_additional_properties(instance, schema): - """ - Return the set of additional properties for the given ``instance``. - - Weeds out properties that should have been validated by ``properties`` and - / or ``patternProperties``. - - Assumes ``instance`` is dict-like already. - - """ - - properties = schema.get("properties", {}) - patterns = "|".join(schema.get("patternProperties", {})) - for property in instance: - if property not in properties: - if patterns and re.search(patterns, property): - continue - yield property - - -def extras_msg(extras): - """ - Create an error message for extra items or properties. - - """ - - if len(extras) == 1: - verb = "was" - else: - verb = "were" - return ", ".join(repr(extra) for extra in extras), verb - - -def types_msg(instance, types): - """ - Create an error message for a failure to match the given types. - - If the ``instance`` is an object and contains a ``name`` property, it will - be considered to be a description of that object and used as its type. - - Otherwise the message is simply the reprs of the given ``types``. - - """ - - reprs = [] - for type in types: - try: - reprs.append(repr(type["name"])) - except Exception: - reprs.append(repr(type)) - return "%r is not of type %s" % (instance, ", ".join(reprs)) - - -def flatten(suitable_for_isinstance): - """ - isinstance() can accept a bunch of really annoying different types: - * a single type - * a tuple of types - * an arbitrary nested tree of tuples - - Return a flattened tuple of the given argument. - - """ - - types = set() - - if not isinstance(suitable_for_isinstance, tuple): - suitable_for_isinstance = (suitable_for_isinstance,) - for thing in suitable_for_isinstance: - if isinstance(thing, tuple): - types.update(flatten(thing)) - else: - types.add(thing) - return tuple(types) - - -def ensure_list(thing): - """ - Wrap ``thing`` in a list if it's a single str. - - Otherwise, return it unchanged. - - """ - - if isinstance(thing, str_types): - return [thing] - return thing - - -def unbool(element, true=object(), false=object()): - """ - A hack to make True and 1 and False and 0 unique for ``uniq``. - - """ - - if element is True: - return true - elif element is False: - return false - return element - - -def uniq(container): - """ - Check if all of a container's elements are unique. - - Successively tries first to rely that the elements are hashable, then - falls back on them being sortable, and finally falls back on brute - force. - - """ - - try: - return len(set(unbool(i) for i in container)) == len(container) - except TypeError: - try: - sort = sorted(unbool(i) for i in container) - sliced = itertools.islice(sort, 1, None) - for i, j in zip(sort, sliced): - if i == j: - return False - except (NotImplementedError, TypeError): - seen = [] - for e in container: - e = unbool(e) - if e in seen: - return False - seen.append(e) - return True http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/6a81d1e7/env2/lib/python2.7/site-packages/jsonschema/_validators.py ---------------------------------------------------------------------- diff --git a/env2/lib/python2.7/site-packages/jsonschema/_validators.py b/env2/lib/python2.7/site-packages/jsonschema/_validators.py deleted file mode 100644 index f566f6d..0000000 --- a/env2/lib/python2.7/site-packages/jsonschema/_validators.py +++ /dev/null @@ -1,366 +0,0 @@ -import re - -from jsonschema import _utils -from jsonschema.exceptions import FormatError, ValidationError -from jsonschema.compat import iteritems - - -def patternProperties(validator, patternProperties, instance, schema): - if not validator.is_type(instance, "object"): - return - - for pattern, subschema in iteritems(patternProperties): - for k, v in iteritems(instance): - if re.search(pattern, k): - for error in validator.descend( - v, subschema, path=k, schema_path=pattern, - ): - yield error - - -def additionalProperties(validator, aP, instance, schema): - if not validator.is_type(instance, "object"): - return - - extras = set(_utils.find_additional_properties(instance, schema)) - - if validator.is_type(aP, "object"): - for extra in extras: - for error in validator.descend(instance[extra], aP, path=extra): - yield error - elif not aP and extras: - error = "Additional properties are not allowed (%s %s unexpected)" - yield ValidationError(error % _utils.extras_msg(extras)) - - -def items(validator, items, instance, schema): - if not validator.is_type(instance, "array"): - return - - if validator.is_type(items, "object"): - for index, item in enumerate(instance): - for error in validator.descend(item, items, path=index): - yield error - else: - for (index, item), subschema in zip(enumerate(instance), items): - for error in validator.descend( - item, subschema, path=index, schema_path=index, - ): - yield error - - -def additionalItems(validator, aI, instance, schema): - if ( - not validator.is_type(instance, "array") or - validator.is_type(schema.get("items", {}), "object") - ): - return - - len_items = len(schema.get("items", [])) - if validator.is_type(aI, "object"): - for index, item in enumerate(instance[len_items:], start=len_items): - for error in validator.descend(item, aI, path=index): - yield error - elif not aI and len(instance) > len(schema.get("items", [])): - error = "Additional items are not allowed (%s %s unexpected)" - yield ValidationError( - error % - _utils.extras_msg(instance[len(schema.get("items", [])):]) - ) - - -def minimum(validator, minimum, instance, schema): - if not validator.is_type(instance, "number"): - return - - if schema.get("exclusiveMinimum", False): - failed = instance <= minimum - cmp = "less than or equal to" - else: - failed = instance < minimum - cmp = "less than" - - if failed: - yield ValidationError( - "%r is %s the minimum of %r" % (instance, cmp, minimum) - ) - - -def maximum(validator, maximum, instance, schema): - if not validator.is_type(instance, "number"): - return - - if schema.get("exclusiveMaximum", False): - failed = instance >= maximum - cmp = "greater than or equal to" - else: - failed = instance > maximum - cmp = "greater than" - - if failed: - yield ValidationError( - "%r is %s the maximum of %r" % (instance, cmp, maximum) - ) - - -def multipleOf(validator, dB, instance, schema): - if not validator.is_type(instance, "number"): - return - - if isinstance(dB, float): - quotient = instance / dB - failed = int(quotient) != quotient - else: - failed = instance % dB - - if failed: - yield ValidationError("%r is not a multiple of %r" % (instance, dB)) - - -def minItems(validator, mI, instance, schema): - if validator.is_type(instance, "array") and len(instance) < mI: - yield ValidationError("%r is too short" % (instance,)) - - -def maxItems(validator, mI, instance, schema): - if validator.is_type(instance, "array") and len(instance) > mI: - yield ValidationError("%r is too long" % (instance,)) - - -def uniqueItems(validator, uI, instance, schema): - if ( - uI and - validator.is_type(instance, "array") and - not _utils.uniq(instance) - ): - yield ValidationError("%r has non-unique elements" % instance) - - -def pattern(validator, patrn, instance, schema): - if ( - validator.is_type(instance, "string") and - not re.search(patrn, instance) - ): - yield ValidationError("%r does not match %r" % (instance, patrn)) - - -def format(validator, format, instance, schema): - if validator.format_checker is not None: - try: - validator.format_checker.check(instance, format) - except FormatError as error: - yield ValidationError(error.message, cause=error.cause) - - -def minLength(validator, mL, instance, schema): - if validator.is_type(instance, "string") and len(instance) < mL: - yield ValidationError("%r is too short" % (instance,)) - - -def maxLength(validator, mL, instance, schema): - if validator.is_type(instance, "string") and len(instance) > mL: - yield ValidationError("%r is too long" % (instance,)) - - -def dependencies(validator, dependencies, instance, schema): - if not validator.is_type(instance, "object"): - return - - for property, dependency in iteritems(dependencies): - if property not in instance: - continue - - if validator.is_type(dependency, "object"): - for error in validator.descend( - instance, dependency, schema_path=property, - ): - yield error - else: - dependencies = _utils.ensure_list(dependency) - for dependency in dependencies: - if dependency not in instance: - yield ValidationError( - "%r is a dependency of %r" % (dependency, property) - ) - - -def enum(validator, enums, instance, schema): - if instance not in enums: - yield ValidationError("%r is not one of %r" % (instance, enums)) - - -def ref(validator, ref, instance, schema): - resolve = getattr(validator.resolver, "resolve", None) - if resolve is None: - with validator.resolver.resolving(ref) as resolved: - for error in validator.descend(instance, resolved): - yield error - else: - scope, resolved = validator.resolver.resolve(ref) - validator.resolver.push_scope(scope) - - try: - for error in validator.descend(instance, resolved): - yield error - finally: - validator.resolver.pop_scope() - - -def type_draft3(validator, types, instance, schema): - types = _utils.ensure_list(types) - - all_errors = [] - for index, type in enumerate(types): - if type == "any": - return - if validator.is_type(type, "object"): - errors = list(validator.descend(instance, type, schema_path=index)) - if not errors: - return - all_errors.extend(errors) - else: - if validator.is_type(instance, type): - return - else: - yield ValidationError( - _utils.types_msg(instance, types), context=all_errors, - ) - - -def properties_draft3(validator, properties, instance, schema): - if not validator.is_type(instance, "object"): - return - - for property, subschema in iteritems(properties): - if property in instance: - for error in validator.descend( - instance[property], - subschema, - path=property, - schema_path=property, - ): - yield error - elif subschema.get("required", False): - error = ValidationError("%r is a required property" % property) - error._set( - validator="required", - validator_value=subschema["required"], - instance=instance, - schema=schema, - ) - error.path.appendleft(property) - error.schema_path.extend([property, "required"]) - yield error - - -def disallow_draft3(validator, disallow, instance, schema): - for disallowed in _utils.ensure_list(disallow): - if validator.is_valid(instance, {"type" : [disallowed]}): - yield ValidationError( - "%r is disallowed for %r" % (disallowed, instance) - ) - - -def extends_draft3(validator, extends, instance, schema): - if validator.is_type(extends, "object"): - for error in validator.descend(instance, extends): - yield error - return - for index, subschema in enumerate(extends): - for error in validator.descend(instance, subschema, schema_path=index): - yield error - - -def type_draft4(validator, types, instance, schema): - types = _utils.ensure_list(types) - - if not any(validator.is_type(instance, type) for type in types): - yield ValidationError(_utils.types_msg(instance, types)) - - -def properties_draft4(validator, properties, instance, schema): - if not validator.is_type(instance, "object"): - return - - for property, subschema in iteritems(properties): - if property in instance: - for error in validator.descend( - instance[property], - subschema, - path=property, - schema_path=property, - ): - yield error - - -def required_draft4(validator, required, instance, schema): - if not validator.is_type(instance, "object"): - return - for property in required: - if property not in instance: - yield ValidationError("%r is a required property" % property) - - -def minProperties_draft4(validator, mP, instance, schema): - if validator.is_type(instance, "object") and len(instance) < mP: - yield ValidationError( - "%r does not have enough properties" % (instance,) - ) - - -def maxProperties_draft4(validator, mP, instance, schema): - if not validator.is_type(instance, "object"): - return - if validator.is_type(instance, "object") and len(instance) > mP: - yield ValidationError("%r has too many properties" % (instance,)) - - -def allOf_draft4(validator, allOf, instance, schema): - for index, subschema in enumerate(allOf): - for error in validator.descend(instance, subschema, schema_path=index): - yield error - - -def oneOf_draft4(validator, oneOf, instance, schema): - subschemas = enumerate(oneOf) - all_errors = [] - for index, subschema in subschemas: - errs = list(validator.descend(instance, subschema, schema_path=index)) - if not errs: - first_valid = subschema - break - all_errors.extend(errs) - else: - yield ValidationError( - "%r is not valid under any of the given schemas" % (instance,), - context=all_errors, - ) - - more_valid = [s for i, s in subschemas if validator.is_valid(instance, s)] - if more_valid: - more_valid.append(first_valid) - reprs = ", ".join(repr(schema) for schema in more_valid) - yield ValidationError( - "%r is valid under each of %s" % (instance, reprs) - ) - - -def anyOf_draft4(validator, anyOf, instance, schema): - all_errors = [] - for index, subschema in enumerate(anyOf): - errs = list(validator.descend(instance, subschema, schema_path=index)) - if not errs: - break - all_errors.extend(errs) - else: - yield ValidationError( - "%r is not valid under any of the given schemas" % (instance,), - context=all_errors, - ) - - -def not_draft4(validator, not_schema, instance, schema): - if validator.is_valid(instance, not_schema): - yield ValidationError( - "%r is not allowed for %r" % (not_schema, instance) - ) http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/6a81d1e7/env2/lib/python2.7/site-packages/jsonschema/_version.py ---------------------------------------------------------------------- diff --git a/env2/lib/python2.7/site-packages/jsonschema/_version.py b/env2/lib/python2.7/site-packages/jsonschema/_version.py deleted file mode 100644 index acbd384..0000000 --- a/env2/lib/python2.7/site-packages/jsonschema/_version.py +++ /dev/null @@ -1,5 +0,0 @@ - -# This file is automatically generated by setup.py. -__version__ = '2.5.1' -__sha__ = 'g3f459b7' -__revision__ = 'g3f459b7' http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/6a81d1e7/env2/lib/python2.7/site-packages/jsonschema/cli.py ---------------------------------------------------------------------- diff --git a/env2/lib/python2.7/site-packages/jsonschema/cli.py b/env2/lib/python2.7/site-packages/jsonschema/cli.py deleted file mode 100644 index 0126564..0000000 --- a/env2/lib/python2.7/site-packages/jsonschema/cli.py +++ /dev/null @@ -1,72 +0,0 @@ -from __future__ import absolute_import -import argparse -import json -import sys - -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 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( - "schema", - help="the JSON Schema to validate with", - 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"]) - 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 http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/6a81d1e7/env2/lib/python2.7/site-packages/jsonschema/compat.py ---------------------------------------------------------------------- diff --git a/env2/lib/python2.7/site-packages/jsonschema/compat.py b/env2/lib/python2.7/site-packages/jsonschema/compat.py deleted file mode 100644 index 0789f1e..0000000 --- a/env2/lib/python2.7/site-packages/jsonschema/compat.py +++ /dev/null @@ -1,60 +0,0 @@ -import operator -import sys - - -try: - from collections import MutableMapping, Sequence # noqa -except ImportError: - from collections.abc import MutableMapping, Sequence # noqa - -PY3 = sys.version_info[0] >= 3 -PY26 = sys.version_info[:2] == (2, 6) - -if PY3: - zip = zip - from functools import lru_cache - from io import StringIO - from urllib.parse import ( - unquote, urljoin, urlunsplit, SplitResult, urlsplit as _urlsplit - ) - from urllib.request import urlopen - str_types = str, - int_types = int, - iteritems = operator.methodcaller("items") -else: - from itertools import izip as zip # noqa - from StringIO import StringIO - from urlparse import ( - urljoin, urlunsplit, SplitResult, urlsplit as _urlsplit # noqa - ) - from urllib import unquote # noqa - from urllib2 import urlopen # noqa - str_types = basestring - int_types = int, long - iteritems = operator.methodcaller("iteritems") - - if PY26: - from repoze.lru import lru_cache - else: - from functools32 import lru_cache - - -# On python < 3.3 fragments are not handled properly with unknown schemes -def urlsplit(url): - scheme, netloc, path, query, fragment = _urlsplit(url) - if "#" in path: - path, fragment = path.split("#", 1) - return SplitResult(scheme, netloc, path, query, fragment) - - -def urldefrag(url): - if "#" in url: - s, n, p, q, frag = urlsplit(url) - defrag = urlunsplit((s, n, p, q, '')) - else: - defrag = url - frag = '' - return defrag, frag - - -# flake8: noqa http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/6a81d1e7/env2/lib/python2.7/site-packages/jsonschema/exceptions.py ---------------------------------------------------------------------- diff --git a/env2/lib/python2.7/site-packages/jsonschema/exceptions.py b/env2/lib/python2.7/site-packages/jsonschema/exceptions.py deleted file mode 100644 index 3f3b4b4..0000000 --- a/env2/lib/python2.7/site-packages/jsonschema/exceptions.py +++ /dev/null @@ -1,276 +0,0 @@ -from collections import defaultdict, deque -import itertools -import pprint -import textwrap - -from jsonschema import _utils -from jsonschema.compat import PY3, iteritems - - -WEAK_MATCHES = frozenset(["anyOf", "oneOf"]) -STRONG_MATCHES = frozenset() - -_unset = _utils.Unset() - - -class _Error(Exception): - def __init__( - self, - message, - validator=_unset, - path=(), - cause=None, - context=(), - validator_value=_unset, - instance=_unset, - schema=_unset, - schema_path=(), - parent=None, - ): - super(_Error, self).__init__( - message, - validator, - path, - cause, - context, - validator_value, - instance, - schema, - schema_path, - parent, - ) - self.message = message - self.path = self.relative_path = deque(path) - self.schema_path = self.relative_schema_path = deque(schema_path) - self.context = list(context) - self.cause = self.__cause__ = cause - self.validator = validator - self.validator_value = validator_value - self.instance = instance - self.schema = schema - self.parent = parent - - for error in context: - error.parent = self - - def __repr__(self): - return "<%s: %r>" % (self.__class__.__name__, self.message) - - def __str__(self): - return unicode(self).encode("utf-8") - - def __unicode__(self): - essential_for_verbose = ( - self.validator, self.validator_value, self.instance, self.schema, - ) - if any(m is _unset for m in essential_for_verbose): - return self.message - - pschema = pprint.pformat(self.schema, width=72) - pinstance = pprint.pformat(self.instance, width=72) - return self.message + textwrap.dedent(""" - - Failed validating %r in schema%s: - %s - - On instance%s: - %s - """.rstrip() - ) % ( - self.validator, - _utils.format_as_index(list(self.relative_schema_path)[:-1]), - _utils.indent(pschema), - _utils.format_as_index(self.relative_path), - _utils.indent(pinstance), - ) - - if PY3: - __str__ = __unicode__ - - @classmethod - def create_from(cls, other): - return cls(**other._contents()) - - @property - def absolute_path(self): - parent = self.parent - if parent is None: - return self.relative_path - - path = deque(self.relative_path) - path.extendleft(reversed(parent.absolute_path)) - return path - - @property - def absolute_schema_path(self): - parent = self.parent - if parent is None: - return self.relative_schema_path - - path = deque(self.relative_schema_path) - path.extendleft(reversed(parent.absolute_schema_path)) - return path - - def _set(self, **kwargs): - for k, v in iteritems(kwargs): - if getattr(self, k) is _unset: - setattr(self, k, v) - - def _contents(self): - attrs = ( - "message", "cause", "context", "validator", "validator_value", - "path", "schema_path", "instance", "schema", "parent", - ) - return dict((attr, getattr(self, attr)) for attr in attrs) - - -class ValidationError(_Error): - pass - - -class SchemaError(_Error): - pass - - -class RefResolutionError(Exception): - pass - - -class UnknownType(Exception): - def __init__(self, type, instance, schema): - self.type = type - self.instance = instance - self.schema = schema - - def __str__(self): - return unicode(self).encode("utf-8") - - def __unicode__(self): - pschema = pprint.pformat(self.schema, width=72) - pinstance = pprint.pformat(self.instance, width=72) - return textwrap.dedent(""" - Unknown type %r for validator with schema: - %s - - While checking instance: - %s - """.rstrip() - ) % (self.type, _utils.indent(pschema), _utils.indent(pinstance)) - - if PY3: - __str__ = __unicode__ - - - -class FormatError(Exception): - def __init__(self, message, cause=None): - super(FormatError, self).__init__(message, cause) - self.message = message - self.cause = self.__cause__ = cause - - def __str__(self): - return self.message.encode("utf-8") - - def __unicode__(self): - return self.message - - if PY3: - __str__ = __unicode__ - - -class ErrorTree(object): - """ - ErrorTrees make it easier to check which validations failed. - - """ - - _instance = _unset - - def __init__(self, errors=()): - self.errors = {} - self._contents = defaultdict(self.__class__) - - for error in errors: - container = self - for element in error.path: - container = container[element] - container.errors[error.validator] = error - - self._instance = error.instance - - def __contains__(self, index): - """ - Check whether ``instance[index]`` has any errors. - - """ - - return index in self._contents - - def __getitem__(self, index): - """ - Retrieve the child tree one level down at the given ``index``. - - If the index is not in the instance that this tree corresponds to and - is not known by this tree, whatever error would be raised by - ``instance.__getitem__`` will be propagated (usually this is some - subclass of :class:`LookupError`. - - """ - - if self._instance is not _unset and index not in self: - self._instance[index] - return self._contents[index] - - def __setitem__(self, index, value): - self._contents[index] = value - - def __iter__(self): - """ - Iterate (non-recursively) over the indices in the instance with errors. - - """ - - return iter(self._contents) - - def __len__(self): - """ - Same as :attr:`total_errors`. - - """ - - return self.total_errors - - def __repr__(self): - return "<%s (%s total errors)>" % (self.__class__.__name__, len(self)) - - @property - def total_errors(self): - """ - The total number of errors in the entire tree, including children. - - """ - - child_errors = sum(len(tree) for _, tree in iteritems(self._contents)) - return len(self.errors) + child_errors - - -def by_relevance(weak=WEAK_MATCHES, strong=STRONG_MATCHES): - def relevance(error): - validator = error.validator - return -len(error.path), validator not in weak, validator in strong - return relevance - - -relevance = by_relevance() - - -def best_match(errors, key=relevance): - errors = iter(errors) - best = next(errors, None) - if best is None: - return - best = max(itertools.chain([best], errors), key=key) - - while best.context: - best = min(best.context, key=key) - return best http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/6a81d1e7/env2/lib/python2.7/site-packages/jsonschema/schemas/draft3.json ---------------------------------------------------------------------- diff --git a/env2/lib/python2.7/site-packages/jsonschema/schemas/draft3.json b/env2/lib/python2.7/site-packages/jsonschema/schemas/draft3.json deleted file mode 100644 index 5bcefe3..0000000 --- a/env2/lib/python2.7/site-packages/jsonschema/schemas/draft3.json +++ /dev/null @@ -1,201 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-03/schema#", - "dependencies": { - "exclusiveMaximum": "maximum", - "exclusiveMinimum": "minimum" - }, - "id": "http://json-schema.org/draft-03/schema#", - "properties": { - "$ref": { - "format": "uri", - "type": "string" - }, - "$schema": { - "format": "uri", - "type": "string" - }, - "additionalItems": { - "default": {}, - "type": [ - { - "$ref": "#" - }, - "boolean" - ] - }, - "additionalProperties": { - "default": {}, - "type": [ - { - "$ref": "#" - }, - "boolean" - ] - }, - "default": { - "type": "any" - }, - "dependencies": { - "additionalProperties": { - "items": { - "type": "string" - }, - "type": [ - "string", - "array", - { - "$ref": "#" - } - ] - }, - "default": {}, - "type": [ - "string", - "array", - "object" - ] - }, - "description": { - "type": "string" - }, - "disallow": { - "items": { - "type": [ - "string", - { - "$ref": "#" - } - ] - }, - "type": [ - "string", - "array" - ], - "uniqueItems": true - }, - "divisibleBy": { - "default": 1, - "exclusiveMinimum": true, - "minimum": 0, - "type": "number" - }, - "enum": { - "minItems": 1, - "type": "array", - "uniqueItems": true - }, - "exclusiveMaximum": { - "default": false, - "type": "boolean" - }, - "exclusiveMinimum": { - "default": false, - "type": "boolean" - }, - "extends": { - "default": {}, - "items": { - "$ref": "#" - }, - "type": [ - { - "$ref": "#" - }, - "array" - ] - }, - "format": { - "type": "string" - }, - "id": { - "format": "uri", - "type": "string" - }, - "items": { - "default": {}, - "items": { - "$ref": "#" - }, - "type": [ - { - "$ref": "#" - }, - "array" - ] - }, - "maxDecimal": { - "minimum": 0, - "type": "number" - }, - "maxItems": { - "minimum": 0, - "type": "integer" - }, - "maxLength": { - "type": "integer" - }, - "maximum": { - "type": "number" - }, - "minItems": { - "default": 0, - "minimum": 0, - "type": "integer" - }, - "minLength": { - "default": 0, - "minimum": 0, - "type": "integer" - }, - "minimum": { - "type": "number" - }, - "pattern": { - "format": "regex", - "type": "string" - }, - "patternProperties": { - "additionalProperties": { - "$ref": "#" - }, - "default": {}, - "type": "object" - }, - "properties": { - "additionalProperties": { - "$ref": "#", - "type": "object" - }, - "default": {}, - "type": "object" - }, - "required": { - "default": false, - "type": "boolean" - }, - "title": { - "type": "string" - }, - "type": { - "default": "any", - "items": { - "type": [ - "string", - { - "$ref": "#" - } - ] - }, - "type": [ - "string", - "array" - ], - "uniqueItems": true - }, - "uniqueItems": { - "default": false, - "type": "boolean" - } - }, - "type": "object" -} http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/6a81d1e7/env2/lib/python2.7/site-packages/jsonschema/schemas/draft4.json ---------------------------------------------------------------------- diff --git a/env2/lib/python2.7/site-packages/jsonschema/schemas/draft4.json b/env2/lib/python2.7/site-packages/jsonschema/schemas/draft4.json deleted file mode 100644 index bc7b2ee..0000000 --- a/env2/lib/python2.7/site-packages/jsonschema/schemas/draft4.json +++ /dev/null @@ -1,224 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "default": {}, - "definitions": { - "positiveInteger": { - "minimum": 0, - "type": "integer" - }, - "positiveIntegerDefault0": { - "allOf": [ - { - "$ref": "#/definitions/positiveInteger" - }, - { - "default": 0 - } - ] - }, - "schemaArray": { - "items": { - "$ref": "#" - }, - "minItems": 1, - "type": "array" - }, - "simpleTypes": { - "enum": [ - "array", - "boolean", - "integer", - "null", - "number", - "object", - "string" - ] - }, - "stringArray": { - "items": { - "type": "string" - }, - "minItems": 1, - "type": "array", - "uniqueItems": true - } - }, - "dependencies": { - "exclusiveMaximum": [ - "maximum" - ], - "exclusiveMinimum": [ - "minimum" - ] - }, - "description": "Core schema meta-schema", - "id": "http://json-schema.org/draft-04/schema#", - "properties": { - "$schema": { - "format": "uri", - "type": "string" - }, - "additionalItems": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#" - } - ], - "default": {} - }, - "additionalProperties": { - "anyOf": [ - { - "type": "boolean" - }, - { - "$ref": "#" - } - ], - "default": {} - }, - "allOf": { - "$ref": "#/definitions/schemaArray" - }, - "anyOf": { - "$ref": "#/definitions/schemaArray" - }, - "default": {}, - "definitions": { - "additionalProperties": { - "$ref": "#" - }, - "default": {}, - "type": "object" - }, - "dependencies": { - "additionalProperties": { - "anyOf": [ - { - "$ref": "#" - }, - { - "$ref": "#/definitions/stringArray" - } - ] - }, - "type": "object" - }, - "description": { - "type": "string" - }, - "enum": { - "minItems": 1, - "type": "array", - "uniqueItems": true - }, - "exclusiveMaximum": { - "default": false, - "type": "boolean" - }, - "exclusiveMinimum": { - "default": false, - "type": "boolean" - }, - "format": { - "type": "string" - }, - "id": { - "format": "uri", - "type": "string" - }, - "items": { - "anyOf": [ - { - "$ref": "#" - }, - { - "$ref": "#/definitions/schemaArray" - } - ], - "default": {} - }, - "maxItems": { - "$ref": "#/definitions/positiveInteger" - }, - "maxLength": { - "$ref": "#/definitions/positiveInteger" - }, - "maxProperties": { - "$ref": "#/definitions/positiveInteger" - }, - "maximum": { - "type": "number" - }, - "minItems": { - "$ref": "#/definitions/positiveIntegerDefault0" - }, - "minLength": { - "$ref": "#/definitions/positiveIntegerDefault0" - }, - "minProperties": { - "$ref": "#/definitions/positiveIntegerDefault0" - }, - "minimum": { - "type": "number" - }, - "multipleOf": { - "exclusiveMinimum": true, - "minimum": 0, - "type": "number" - }, - "not": { - "$ref": "#" - }, - "oneOf": { - "$ref": "#/definitions/schemaArray" - }, - "pattern": { - "format": "regex", - "type": "string" - }, - "patternProperties": { - "additionalProperties": { - "$ref": "#" - }, - "default": {}, - "type": "object" - }, - "properties": { - "additionalProperties": { - "$ref": "#" - }, - "default": {}, - "type": "object" - }, - "required": { - "$ref": "#/definitions/stringArray" - }, - "title": { - "type": "string" - }, - "type": { - "anyOf": [ - { - "$ref": "#/definitions/simpleTypes" - }, - { - "items": { - "$ref": "#/definitions/simpleTypes" - }, - "minItems": 1, - "type": "array", - "uniqueItems": true - } - ] - }, - "uniqueItems": { - "default": false, - "type": "boolean" - } - }, - "type": "object" -} http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/6a81d1e7/env2/lib/python2.7/site-packages/jsonschema/tests/__init__.py ---------------------------------------------------------------------- diff --git a/env2/lib/python2.7/site-packages/jsonschema/tests/__init__.py b/env2/lib/python2.7/site-packages/jsonschema/tests/__init__.py deleted file mode 100644 index e69de29..0000000 http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/6a81d1e7/env2/lib/python2.7/site-packages/jsonschema/tests/compat.py ---------------------------------------------------------------------- diff --git a/env2/lib/python2.7/site-packages/jsonschema/tests/compat.py b/env2/lib/python2.7/site-packages/jsonschema/tests/compat.py deleted file mode 100644 index b37483f..0000000 --- a/env2/lib/python2.7/site-packages/jsonschema/tests/compat.py +++ /dev/null @@ -1,15 +0,0 @@ -import sys - - -if sys.version_info[:2] < (2, 7): # pragma: no cover - import unittest2 as unittest -else: - import unittest - -try: - from unittest import mock -except ImportError: - import mock - - -# flake8: noqa http://git-wip-us.apache.org/repos/asf/incubator-senssoft-tap/blob/6a81d1e7/env2/lib/python2.7/site-packages/jsonschema/tests/test_cli.py ---------------------------------------------------------------------- diff --git a/env2/lib/python2.7/site-packages/jsonschema/tests/test_cli.py b/env2/lib/python2.7/site-packages/jsonschema/tests/test_cli.py deleted file mode 100644 index f625ca9..0000000 --- a/env2/lib/python2.7/site-packages/jsonschema/tests/test_cli.py +++ /dev/null @@ -1,110 +0,0 @@ -from jsonschema import Draft4Validator, ValidationError, cli -from jsonschema.compat import StringIO -from jsonschema.tests.compat import mock, unittest - - -def fake_validator(*errors): - errors = list(reversed(errors)) - - class FakeValidator(object): - def __init__(self, *args, **kwargs): - pass - - def iter_errors(self, instance): - if errors: - return errors.pop() - return [] - return FakeValidator - - -class TestParser(unittest.TestCase): - FakeValidator = fake_validator() - - def setUp(self): - mock_open = mock.mock_open() - patch_open = mock.patch.object(cli, "open", mock_open, create=True) - patch_open.start() - self.addCleanup(patch_open.stop) - - mock_json_load = mock.Mock() - mock_json_load.return_value = {} - patch_json_load = mock.patch("json.load") - patch_json_load.start() - self.addCleanup(patch_json_load.stop) - - def test_find_validator_by_fully_qualified_object_name(self): - arguments = cli.parse_args( - [ - "--validator", - "jsonschema.tests.test_cli.TestParser.FakeValidator", - "--instance", "foo.json", - "schema.json", - ] - ) - self.assertIs(arguments["validator"], self.FakeValidator) - - def test_find_validator_in_jsonschema(self): - arguments = cli.parse_args( - [ - "--validator", "Draft4Validator", - "--instance", "foo.json", - "schema.json", - ] - ) - self.assertIs(arguments["validator"], Draft4Validator) - - -class TestCLI(unittest.TestCase): - def test_successful_validation(self): - stdout, stderr = StringIO(), StringIO() - exit_code = cli.run( - { - "validator": fake_validator(), - "schema": {}, - "instances": [1], - "error_format": "{error.message}", - }, - stdout=stdout, - stderr=stderr, - ) - self.assertFalse(stdout.getvalue()) - self.assertFalse(stderr.getvalue()) - self.assertEqual(exit_code, 0) - - def test_unsuccessful_validation(self): - error = ValidationError("I am an error!", instance=1) - stdout, stderr = StringIO(), StringIO() - exit_code = cli.run( - { - "validator": fake_validator([error]), - "schema": {}, - "instances": [1], - "error_format": "{error.instance} - {error.message}", - }, - stdout=stdout, - stderr=stderr, - ) - self.assertFalse(stdout.getvalue()) - self.assertEqual(stderr.getvalue(), "1 - I am an error!") - self.assertEqual(exit_code, 1) - - def test_unsuccessful_validation_multiple_instances(self): - first_errors = [ - ValidationError("9", instance=1), - ValidationError("8", instance=1), - ] - second_errors = [ValidationError("7", instance=2)] - stdout, stderr = StringIO(), StringIO() - exit_code = cli.run( - { - "validator": fake_validator(first_errors, second_errors), - "schema": {}, - "instances": [1, 2], - "error_format": "{error.instance} - {error.message}\t", - }, - stdout=stdout, - stderr=stderr, - ) - self.assertFalse(stdout.getvalue()) - self.assertEqual(stderr.getvalue(), "1 - 9\t1 - 8\t2 - 7\t") - self.assertEqual(exit_code, 1)