From 7ae38906926dc09bc10670c361af0d2bf0050426 Mon Sep 17 00:00:00 2001 From: Hsuan Lee Date: Sat, 19 Jan 2019 18:42:04 +0800 Subject: Update dependency packages --- python-packages/json_schemas/.discharge.json | 13 -- python-packages/json_schemas/.pylintrc | 3 - python-packages/json_schemas/README.md | 43 ----- python-packages/json_schemas/setup.py | 200 --------------------- python-packages/json_schemas/src/conf.py | 54 ------ .../json_schemas/src/doc_static/.gitkeep | 0 python-packages/json_schemas/src/index.rst | 18 -- .../json_schemas/src/zero_ex/__init__.py | 2 - .../src/zero_ex/json_schemas/__init__.py | 83 --------- .../json_schemas/src/zero_ex/json_schemas/py.typed | 0 .../json_schemas/schemas/address_schema.json | 5 - .../schemas/asset_pairs_request_opts_schema.json | 8 - .../json_schemas/schemas/block_param_schema.json | 11 -- .../json_schemas/schemas/block_range_schema.json | 8 - .../json_schemas/schemas/call_data_schema.json | 27 --- .../schemas/ec_signature_parameter_schema.json | 5 - .../json_schemas/schemas/ec_signature_schema.json | 14 -- .../schemas/eip712_typed_data_schema.json | 28 --- .../zero_ex/json_schemas/schemas/hex_schema.json | 5 - .../schemas/index_filter_values_schema.json | 7 - .../json_schemas/schemas/js_number_schema.json | 5 - .../json_schemas/schemas/number_schema.json | 5 - .../json_schemas/schemas/order_cancel_schema.json | 12 -- .../schemas/order_config_request_schema.json | 24 --- .../order_fill_or_kill_requests_schema.json | 12 -- .../schemas/order_fill_requests_schema.json | 12 -- .../json_schemas/schemas/order_hash_schema.json | 5 - .../zero_ex/json_schemas/schemas/order_schema.json | 34 ---- .../order_watcher_web_socket_request_schema.json | 52 ------ ...der_watcher_web_socket_utf8_message_schema.json | 10 -- .../schemas/orderbook_request_schema.json | 9 - .../schemas/orders_request_opts_schema.json | 19 -- .../json_schemas/schemas/orders_schema.json | 5 - .../schemas/paged_request_opts_schema.json | 8 - .../schemas/paginated_collection_schema.json | 10 -- ...layer_api_asset_data_pairs_response_schema.json | 13 -- .../relayer_api_asset_data_pairs_schema.json | 12 -- .../relayer_api_asset_data_trade_info_schema.json | 11 -- .../schemas/relayer_api_error_response_schema.json | 21 --- ...relayer_api_fee_recipients_response_schema.json | 16 -- .../relayer_api_order_config_payload_schema.json | 24 --- .../relayer_api_order_config_response_schema.json | 11 -- .../schemas/relayer_api_order_schema.json | 9 - .../relayer_api_orderbook_response_schema.json | 9 - ...pi_orders_channel_subscribe_payload_schema.json | 14 -- ...elayer_api_orders_channel_subscribe_schema.json | 11 -- ..._api_orders_channel_update_response_schema.json | 11 -- .../relayer_api_orders_response_schema.json | 13 -- .../schemas/relayer_api_orders_schema.json | 5 - .../json_schemas/schemas/request_opts_schema.json | 7 - .../json_schemas/schemas/signed_order_schema.json | 12 -- .../json_schemas/schemas/signed_orders_schema.json | 5 - .../zero_ex/json_schemas/schemas/token_schema.json | 11 -- .../json_schemas/schemas/tx_data_schema.json | 26 --- .../json_schemas/schemas/whole_number_schema.json | 12 -- .../schemas/zero_ex_transaction_schema.json | 10 -- .../json_schemas/stubs/distutils/__init__.pyi | 0 .../stubs/distutils/command/__init__.pyi | 0 .../json_schemas/stubs/distutils/command/clean.pyi | 7 - .../json_schemas/stubs/jsonschema/__init__.pyi | 11 -- .../json_schemas/stubs/jsonschema/exceptions.pyi | 0 .../json_schemas/stubs/pytest/__init__.pyi | 0 .../json_schemas/stubs/pytest/raises.pyi | 1 - .../json_schemas/stubs/setuptools/__init__.pyi | 8 - .../stubs/setuptools/command/__init__.pyi | 0 .../json_schemas/stubs/setuptools/command/test.pyi | 3 - .../json_schemas/stubs/stringcase/__init__.pyi | 2 - python-packages/json_schemas/test/__init__.py | 1 - .../json_schemas/test/test_json_schemas.py | 42 ----- python-packages/json_schemas/tox.ini | 25 --- 70 files changed, 1119 deletions(-) delete mode 100644 python-packages/json_schemas/.discharge.json delete mode 100644 python-packages/json_schemas/.pylintrc delete mode 100644 python-packages/json_schemas/README.md delete mode 100755 python-packages/json_schemas/setup.py delete mode 100644 python-packages/json_schemas/src/conf.py delete mode 100644 python-packages/json_schemas/src/doc_static/.gitkeep delete mode 100644 python-packages/json_schemas/src/index.rst delete mode 100644 python-packages/json_schemas/src/zero_ex/__init__.py delete mode 100644 python-packages/json_schemas/src/zero_ex/json_schemas/__init__.py delete mode 100644 python-packages/json_schemas/src/zero_ex/json_schemas/py.typed delete mode 100644 python-packages/json_schemas/src/zero_ex/json_schemas/schemas/address_schema.json delete mode 100644 python-packages/json_schemas/src/zero_ex/json_schemas/schemas/asset_pairs_request_opts_schema.json delete mode 100644 python-packages/json_schemas/src/zero_ex/json_schemas/schemas/block_param_schema.json delete mode 100644 python-packages/json_schemas/src/zero_ex/json_schemas/schemas/block_range_schema.json delete mode 100644 python-packages/json_schemas/src/zero_ex/json_schemas/schemas/call_data_schema.json delete mode 100644 python-packages/json_schemas/src/zero_ex/json_schemas/schemas/ec_signature_parameter_schema.json delete mode 100644 python-packages/json_schemas/src/zero_ex/json_schemas/schemas/ec_signature_schema.json delete mode 100644 python-packages/json_schemas/src/zero_ex/json_schemas/schemas/eip712_typed_data_schema.json delete mode 100644 python-packages/json_schemas/src/zero_ex/json_schemas/schemas/hex_schema.json delete mode 100644 python-packages/json_schemas/src/zero_ex/json_schemas/schemas/index_filter_values_schema.json delete mode 100644 python-packages/json_schemas/src/zero_ex/json_schemas/schemas/js_number_schema.json delete mode 100644 python-packages/json_schemas/src/zero_ex/json_schemas/schemas/number_schema.json delete mode 100644 python-packages/json_schemas/src/zero_ex/json_schemas/schemas/order_cancel_schema.json delete mode 100644 python-packages/json_schemas/src/zero_ex/json_schemas/schemas/order_config_request_schema.json delete mode 100644 python-packages/json_schemas/src/zero_ex/json_schemas/schemas/order_fill_or_kill_requests_schema.json delete mode 100644 python-packages/json_schemas/src/zero_ex/json_schemas/schemas/order_fill_requests_schema.json delete mode 100644 python-packages/json_schemas/src/zero_ex/json_schemas/schemas/order_hash_schema.json delete mode 100644 python-packages/json_schemas/src/zero_ex/json_schemas/schemas/order_schema.json delete mode 100644 python-packages/json_schemas/src/zero_ex/json_schemas/schemas/order_watcher_web_socket_request_schema.json delete mode 100644 python-packages/json_schemas/src/zero_ex/json_schemas/schemas/order_watcher_web_socket_utf8_message_schema.json delete mode 100644 python-packages/json_schemas/src/zero_ex/json_schemas/schemas/orderbook_request_schema.json delete mode 100644 python-packages/json_schemas/src/zero_ex/json_schemas/schemas/orders_request_opts_schema.json delete mode 100644 python-packages/json_schemas/src/zero_ex/json_schemas/schemas/orders_schema.json delete mode 100644 python-packages/json_schemas/src/zero_ex/json_schemas/schemas/paged_request_opts_schema.json delete mode 100644 python-packages/json_schemas/src/zero_ex/json_schemas/schemas/paginated_collection_schema.json delete mode 100644 python-packages/json_schemas/src/zero_ex/json_schemas/schemas/relayer_api_asset_data_pairs_response_schema.json delete mode 100644 python-packages/json_schemas/src/zero_ex/json_schemas/schemas/relayer_api_asset_data_pairs_schema.json delete mode 100644 python-packages/json_schemas/src/zero_ex/json_schemas/schemas/relayer_api_asset_data_trade_info_schema.json delete mode 100644 python-packages/json_schemas/src/zero_ex/json_schemas/schemas/relayer_api_error_response_schema.json delete mode 100644 python-packages/json_schemas/src/zero_ex/json_schemas/schemas/relayer_api_fee_recipients_response_schema.json delete mode 100644 python-packages/json_schemas/src/zero_ex/json_schemas/schemas/relayer_api_order_config_payload_schema.json delete mode 100644 python-packages/json_schemas/src/zero_ex/json_schemas/schemas/relayer_api_order_config_response_schema.json delete mode 100644 python-packages/json_schemas/src/zero_ex/json_schemas/schemas/relayer_api_order_schema.json delete mode 100644 python-packages/json_schemas/src/zero_ex/json_schemas/schemas/relayer_api_orderbook_response_schema.json delete mode 100644 python-packages/json_schemas/src/zero_ex/json_schemas/schemas/relayer_api_orders_channel_subscribe_payload_schema.json delete mode 100644 python-packages/json_schemas/src/zero_ex/json_schemas/schemas/relayer_api_orders_channel_subscribe_schema.json delete mode 100644 python-packages/json_schemas/src/zero_ex/json_schemas/schemas/relayer_api_orders_channel_update_response_schema.json delete mode 100644 python-packages/json_schemas/src/zero_ex/json_schemas/schemas/relayer_api_orders_response_schema.json delete mode 100644 python-packages/json_schemas/src/zero_ex/json_schemas/schemas/relayer_api_orders_schema.json delete mode 100644 python-packages/json_schemas/src/zero_ex/json_schemas/schemas/request_opts_schema.json delete mode 100644 python-packages/json_schemas/src/zero_ex/json_schemas/schemas/signed_order_schema.json delete mode 100644 python-packages/json_schemas/src/zero_ex/json_schemas/schemas/signed_orders_schema.json delete mode 100644 python-packages/json_schemas/src/zero_ex/json_schemas/schemas/token_schema.json delete mode 100644 python-packages/json_schemas/src/zero_ex/json_schemas/schemas/tx_data_schema.json delete mode 100644 python-packages/json_schemas/src/zero_ex/json_schemas/schemas/whole_number_schema.json delete mode 100644 python-packages/json_schemas/src/zero_ex/json_schemas/schemas/zero_ex_transaction_schema.json delete mode 100644 python-packages/json_schemas/stubs/distutils/__init__.pyi delete mode 100644 python-packages/json_schemas/stubs/distutils/command/__init__.pyi delete mode 100644 python-packages/json_schemas/stubs/distutils/command/clean.pyi delete mode 100644 python-packages/json_schemas/stubs/jsonschema/__init__.pyi delete mode 100644 python-packages/json_schemas/stubs/jsonschema/exceptions.pyi delete mode 100644 python-packages/json_schemas/stubs/pytest/__init__.pyi delete mode 100644 python-packages/json_schemas/stubs/pytest/raises.pyi delete mode 100644 python-packages/json_schemas/stubs/setuptools/__init__.pyi delete mode 100644 python-packages/json_schemas/stubs/setuptools/command/__init__.pyi delete mode 100644 python-packages/json_schemas/stubs/setuptools/command/test.pyi delete mode 100644 python-packages/json_schemas/stubs/stringcase/__init__.pyi delete mode 100644 python-packages/json_schemas/test/__init__.py delete mode 100644 python-packages/json_schemas/test/test_json_schemas.py delete mode 100644 python-packages/json_schemas/tox.ini (limited to 'python-packages/json_schemas') diff --git a/python-packages/json_schemas/.discharge.json b/python-packages/json_schemas/.discharge.json deleted file mode 100644 index 66d95679f..000000000 --- a/python-packages/json_schemas/.discharge.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "domain": "0x-json-schemas-py", - "build_command": "python setup.py build_sphinx", - "upload_directory": "build/docs/html", - "index_key": "index.html", - "error_key": "index.html", - "trailing_slashes": true, - "cache": 3600, - "aws_profile": "default", - "aws_region": "us-east-1", - "cdn": false, - "dns_configured": true -} diff --git a/python-packages/json_schemas/.pylintrc b/python-packages/json_schemas/.pylintrc deleted file mode 100644 index 937bc6313..000000000 --- a/python-packages/json_schemas/.pylintrc +++ /dev/null @@ -1,3 +0,0 @@ -[MESSAGES CONTROL] -disable=C0330,line-too-long,fixme,too-few-public-methods,too-many-ancestors -# C0330 is "bad hanging indent". we use indents per `black`. diff --git a/python-packages/json_schemas/README.md b/python-packages/json_schemas/README.md deleted file mode 100644 index 29b18baea..000000000 --- a/python-packages/json_schemas/README.md +++ /dev/null @@ -1,43 +0,0 @@ -## 0x-json-schemas - -0x JSON schemas for those developing on top of 0x protocol. - -Read the [documentation](http://0x-json-schemas-py.s3-website-us-east-1.amazonaws.com/) - -## Installing - -```bash -pip install 0x-json-schemas -``` - -## Contributing - -We welcome improvements and fixes from the wider community! To report bugs within this package, please create an issue in this repository. - -Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started. - -### Install Code and Dependencies - -```bash -pip install -e .[dev] -``` - -### Test - -`./setup.py test`. - -### Clean - -`./setup.py clean --all` - -### Lint - -`./setup.py lint` - -### Build Documentation - -`./setup.py build_sphinx` - -### More - -See `./setup.py --help-commands` for more info. diff --git a/python-packages/json_schemas/setup.py b/python-packages/json_schemas/setup.py deleted file mode 100755 index 389d14591..000000000 --- a/python-packages/json_schemas/setup.py +++ /dev/null @@ -1,200 +0,0 @@ -#!/usr/bin/env python - -"""setuptools module for json_schemas package.""" - -import distutils.command.build_py -from distutils.command.clean import clean -import subprocess # nosec -from shutil import rmtree -from os import environ, path -from sys import argv - -from setuptools import find_packages, setup -from setuptools.command.test import test as TestCommand - - -class TestCommandExtension(TestCommand): - """Run pytest tests.""" - - def run_tests(self): - """Invoke pytest.""" - import pytest - - exit(pytest.main(["--doctest-modules"])) - - -class LintCommand(distutils.command.build_py.build_py): - """Custom setuptools command class for running linters.""" - - description = "Run linters" - - def run(self): - """Run linter shell commands.""" - lint_commands = [ - # formatter: - "black --line-length 79 --check --diff src test setup.py".split(), - # style guide checker (formerly pep8): - "pycodestyle src test setup.py".split(), - # docstring style checker: - "pydocstyle src test setup.py".split(), - # static type checker: - "mypy src test setup.py".split(), - # security issue checker: - "bandit -r src ./setup.py".split(), - # HACK: ensure json schemas don't differ from the authoritative - # copies: this is a hack. ideally we would symlink to the - # authoritative copies, but a problem with setuptools is preventing - # it from following symlinks when gathering package_data. see - # https://github.com/pypa/setuptools/issues/415. - ( - "diff src/zero_ex/json_schemas/schemas" - + " ../../packages/json-schemas/schemas" - ).split(), - # general linter: - "pylint src test setup.py".split(), - # pylint takes relatively long to run, so it runs last, to enable - # fast failures. - ] - - # tell mypy where to find interface stubs for 3rd party libs - environ["MYPYPATH"] = path.join( - path.dirname(path.realpath(argv[0])), "stubs" - ) - - for lint_command in lint_commands: - print( - "Running lint command `", " ".join(lint_command).strip(), "`" - ) - subprocess.check_call(lint_command) # nosec - - -class CleanCommandExtension(clean): - """Custom command to do custom cleanup.""" - - def run(self): - """Run the regular clean, followed by our custom commands.""" - super().run() - rmtree("dist", ignore_errors=True) - rmtree(".mypy_cache", ignore_errors=True) - rmtree(".tox", ignore_errors=True) - rmtree(".pytest_cache", ignore_errors=True) - rmtree("src/*.egg-info", ignore_errors=True) - - -class TestPublishCommand(distutils.command.build_py.build_py): - """Custom command to publish to test.pypi.org.""" - - description = ( - "Publish dist/* to test.pypi.org. Run sdist & bdist_wheel first." - ) - - def run(self): - """Run twine to upload to test.pypi.org.""" - subprocess.check_call( # nosec - ( - "twine upload --repository-url https://test.pypi.org/legacy/" - + " --verbose dist/*" - ).split() - ) - - -class PublishCommand(distutils.command.build_py.build_py): - """Custom command to publish to pypi.org.""" - - description = "Publish dist/* to pypi.org. Run sdist & bdist_wheel first." - - def run(self): - """Run twine to upload to pypi.org.""" - subprocess.check_call("twine upload dist/*".split()) # nosec - - -class PublishDocsCommand(distutils.command.build_py.build_py): - """Custom command to publish docs to S3.""" - - description = ( - "Publish docs to " - + "http://0x-json-schemas-py.s3-website-us-east-1.amazonaws.com/" - ) - - def run(self): - """Run npm package `discharge` to build & upload docs.""" - subprocess.check_call("discharge deploy".split()) # nosec - - -with open("README.md", "r") as file_handle: - README_MD = file_handle.read() - - -setup( - name="0x-json-schemas", - version="1.0.0", - description="JSON schemas for 0x applications", - long_description=README_MD, - long_description_content_type="text/markdown", - url=( - "https://github.com/0xProject/0x-monorepo/tree/development" - + "/python-packages/json_schemas" - ), - author="F. Eugene Aumson", - author_email="feuGeneA@users.noreply.github.com", - cmdclass={ - "clean": CleanCommandExtension, - "lint": LintCommand, - "test": TestCommandExtension, - "test_publish": TestPublishCommand, - "publish": PublishCommand, - "publish_docs": PublishDocsCommand, - }, - install_requires=["jsonschema", "mypy_extensions", "stringcase"], - extras_require={ - "dev": [ - "bandit", - "black", - "coverage", - "coveralls", - "mypy", - "mypy_extensions", - "pycodestyle", - "pydocstyle", - "pylint", - "pytest", - "sphinx", - "tox", - "twine", - ] - }, - python_requires=">=3.6, <4", - package_data={"zero_ex.json_schemas": ["py.typed", "schemas/*"]}, - package_dir={"": "src"}, - license="Apache 2.0", - keywords=( - "ethereum cryptocurrency 0x decentralized blockchain dex exchange" - ), - namespace_packages=["zero_ex"], - packages=find_packages("src"), - classifiers=[ - "Development Status :: 2 - Pre-Alpha", - "Intended Audience :: Developers", - "Intended Audience :: Financial and Insurance Industry", - "License :: OSI Approved :: Apache Software License", - "Natural Language :: English", - "Operating System :: OS Independent", - "Programming Language :: Python", - "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3.6", - "Programming Language :: Python :: 3.7", - "Topic :: Internet :: WWW/HTTP", - "Topic :: Office/Business :: Financial", - "Topic :: Other/Nonlisted Topic", - "Topic :: Security :: Cryptography", - "Topic :: Software Development :: Libraries", - "Topic :: Utilities", - ], - zip_safe=False, # required per mypy - command_options={ - "build_sphinx": { - "source_dir": ("setup.py", "src"), - "build_dir": ("setup.py", "build/docs"), - } - }, -) diff --git a/python-packages/json_schemas/src/conf.py b/python-packages/json_schemas/src/conf.py deleted file mode 100644 index 1ae1493e3..000000000 --- a/python-packages/json_schemas/src/conf.py +++ /dev/null @@ -1,54 +0,0 @@ -"""Configuration file for the Sphinx documentation builder.""" - -# Reference: http://www.sphinx-doc.org/en/master/config - -from typing import List -import pkg_resources - - -# pylint: disable=invalid-name -# because these variables are not named in upper case, as globals should be. - -project = "0x-json-schemas" -# pylint: disable=redefined-builtin -copyright = "2018, ZeroEx, Intl." -author = "F. Eugene Aumson" -version = pkg_resources.get_distribution("0x-json-schemas").version -release = "" # The full version, including alpha/beta/rc tags - -extensions = [ - "sphinx.ext.autodoc", - "sphinx.ext.doctest", - "sphinx.ext.intersphinx", - "sphinx.ext.coverage", - "sphinx.ext.viewcode", -] - -templates_path = ["doc_templates"] - -source_suffix = ".rst" -# eg: source_suffix = [".rst", ".md"] - -master_doc = "index" # The master toctree document. - -language = None - -exclude_patterns: List[str] = [] - -# The name of the Pygments (syntax highlighting) style to use. -pygments_style = None - -html_theme = "alabaster" - -html_static_path = ["doc_static"] -# Add any paths that contain custom static files (such as style sheets) here, -# relative to this directory. They are copied after the builtin static files, -# so a file named "default.css" will overwrite the builtin "default.css". - -# Output file base name for HTML help builder. -htmlhelp_basename = "json_schemaspydoc" - -# -- Extension configuration: - -# Example configuration for intersphinx: refer to the Python standard library. -intersphinx_mapping = {"https://docs.python.org/": None} diff --git a/python-packages/json_schemas/src/doc_static/.gitkeep b/python-packages/json_schemas/src/doc_static/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/python-packages/json_schemas/src/index.rst b/python-packages/json_schemas/src/index.rst deleted file mode 100644 index 3de809aa3..000000000 --- a/python-packages/json_schemas/src/index.rst +++ /dev/null @@ -1,18 +0,0 @@ -.. source for the sphinx-generated build/docs/web/index.html - -Python zero_ex.json_schemas -=========================== - -.. toctree:: - :maxdepth: 2 - :caption: Contents: - -.. automodule:: zero_ex.json_schemas - :members: - -Indices and tables -================== - -* :ref:`genindex` -* :ref:`modindex` -* :ref:`search` diff --git a/python-packages/json_schemas/src/zero_ex/__init__.py b/python-packages/json_schemas/src/zero_ex/__init__.py deleted file mode 100644 index e90d833db..000000000 --- a/python-packages/json_schemas/src/zero_ex/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -"""0x Python API.""" -__import__("pkg_resources").declare_namespace(__name__) diff --git a/python-packages/json_schemas/src/zero_ex/json_schemas/__init__.py b/python-packages/json_schemas/src/zero_ex/json_schemas/__init__.py deleted file mode 100644 index 10c564b99..000000000 --- a/python-packages/json_schemas/src/zero_ex/json_schemas/__init__.py +++ /dev/null @@ -1,83 +0,0 @@ -"""JSON schemas and associated utilities.""" - -from os import path -import json -from typing import Mapping - -from pkg_resources import resource_string -import jsonschema -from stringcase import snakecase - - -class _LocalRefResolver(jsonschema.RefResolver): - """Resolve package-local JSON schema id's.""" - - def __init__(self): - """Initialize a new instance.""" - jsonschema.RefResolver.__init__(self, "", "") - - @staticmethod - def resolve_from_url(url: str) -> str: - """Resolve the given URL. - - :param url: a string representing the URL of the JSON schema to fetch. - :returns: a string representing the deserialized JSON schema - :raises jsonschema.ValidationError: when the resource associated with - `url` does not exist. - """ - ref = url.replace("file://", "") - return json.loads( - resource_string( - "zero_ex.json_schemas", - f"schemas/{snakecase(ref.lstrip('/'))}.json", - ) - ) - - -# Instantiate the `_LocalRefResolver()` only once so that `assert_valid()` can -# perform multiple schema validations without reading from disk the schema -# every time. -_LOCAL_RESOLVER = _LocalRefResolver() - - -def assert_valid(data: Mapping, schema_id: str) -> None: - """Validate the given `data` against the specified `schema`. - - :param data: Python dictionary to be validated as a JSON object. - :param schema_id: id property of the JSON schema to validate against. Must - be one of those listed in `the 0x JSON schema files - `_. - - Raises an exception if validation fails. - - >>> assert_valid( - ... {'v': 27, 'r': '0x'+'f'*64, 's': '0x'+'f'*64}, - ... '/ecSignatureSchema', - ... ) - """ - # noqa - - _, schema = _LOCAL_RESOLVER.resolve(schema_id) - jsonschema.validate(data, schema, resolver=_LOCAL_RESOLVER) - - -def assert_valid_json(data: str, schema_id: str) -> None: - """Validate the given `data` against the specified `schema`. - - :param data: JSON string to be validated. - :param schema_id: id property of the JSON schema to validate against. Must - be one of those listed in `the 0x JSON schema files - `_. - - Raises an exception if validation fails. - - >>> assert_valid_json( - ... r'''{ - ... "v": 27, - ... "r": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", - ... "s": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" - ... }''', - ... '/ecSignatureSchema', - ... ) - """ # noqa: E501 (line too long) - assert_valid(json.loads(data), schema_id) diff --git a/python-packages/json_schemas/src/zero_ex/json_schemas/py.typed b/python-packages/json_schemas/src/zero_ex/json_schemas/py.typed deleted file mode 100644 index e69de29bb..000000000 diff --git a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/address_schema.json b/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/address_schema.json deleted file mode 100644 index 0dc02d331..000000000 --- a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/address_schema.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "id": "/addressSchema", - "type": "string", - "pattern": "^0x[0-9a-f]{40}$" -} diff --git a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/asset_pairs_request_opts_schema.json b/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/asset_pairs_request_opts_schema.json deleted file mode 100644 index fad0bd371..000000000 --- a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/asset_pairs_request_opts_schema.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "id": "/AssetPairsRequestOptsSchema", - "type": "object", - "properties": { - "assetDataA": { "$ref": "/hexSchema" }, - "assetDataB": { "$ref": "/hexSchema" } - } -} diff --git a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/block_param_schema.json b/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/block_param_schema.json deleted file mode 100644 index ed4dd1e87..000000000 --- a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/block_param_schema.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "id": "/blockParamSchema", - "oneOf": [ - { - "type": "number" - }, - { - "enum": ["latest", "earliest", "pending"] - } - ] -} diff --git a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/block_range_schema.json b/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/block_range_schema.json deleted file mode 100644 index b14294649..000000000 --- a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/block_range_schema.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "id": "/blockRangeSchema", - "properties": { - "fromBlock": { "$ref": "/blockParamSchema" }, - "toBlock": { "$ref": "/blockParamSchema" } - }, - "type": "object" -} diff --git a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/call_data_schema.json b/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/call_data_schema.json deleted file mode 100644 index e5e6e3282..000000000 --- a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/call_data_schema.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "id": "/callDataSchema", - "properties": { - "from": { "$ref": "/addressSchema" }, - "to": { "$ref": "/addressSchema" }, - "value": { - "oneOf": [{ "$ref": "/numberSchema" }, { "$ref": "/jsNumberSchema" }] - }, - "gas": { - "oneOf": [{ "$ref": "/numberSchema" }, { "$ref": "/jsNumberSchema" }] - }, - "gasPrice": { - "oneOf": [{ "$ref": "/numberSchema" }, { "$ref": "/jsNumberSchema" }] - }, - "data": { - "type": "string", - "pattern": "^0x[0-9a-f]*$" - }, - "nonce": { - "type": "number", - "minimum": 0 - } - }, - "required": [], - "type": "object", - "additionalProperties": false -} diff --git a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/ec_signature_parameter_schema.json b/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/ec_signature_parameter_schema.json deleted file mode 100644 index 0c08ec240..000000000 --- a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/ec_signature_parameter_schema.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "id": "/ecSignatureParameterSchema", - "type": "string", - "pattern": "^0[xX][0-9A-Fa-f]{64}$" -} diff --git a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/ec_signature_schema.json b/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/ec_signature_schema.json deleted file mode 100644 index 52ccfe7bb..000000000 --- a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/ec_signature_schema.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "id": "/ecSignatureSchema", - "properties": { - "v": { - "type": "number", - "minimum": 27, - "maximum": 28 - }, - "r": { "$ref": "/ecSignatureParameterSchema" }, - "s": { "$ref": "/ecSignatureParameterSchema" } - }, - "required": ["v", "r", "s"], - "type": "object" -} diff --git a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/eip712_typed_data_schema.json b/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/eip712_typed_data_schema.json deleted file mode 100644 index 8efd6de44..000000000 --- a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/eip712_typed_data_schema.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "id": "/eip712TypedDataSchema", - "type": "object", - "properties": { - "types": { - "type": "object", - "properties": { - "EIP712Domain": { "type": "array" } - }, - "additionalProperties": { - "type": "array", - "items": { - "type": "object", - "properties": { - "name": { "type": "string" }, - "type": { "type": "string" } - }, - "required": ["name", "type"] - } - }, - "required": ["EIP712Domain"] - }, - "primaryType": { "type": "string" }, - "domain": { "type": "object" }, - "message": { "type": "object" } - }, - "required": ["types", "primaryType", "domain", "message"] -} diff --git a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/hex_schema.json b/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/hex_schema.json deleted file mode 100644 index f37815d5b..000000000 --- a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/hex_schema.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "id": "/hexSchema", - "type": "string", - "pattern": "^0x(([0-9a-f][0-9a-f])+)?$" -} diff --git a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/index_filter_values_schema.json b/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/index_filter_values_schema.json deleted file mode 100644 index bec00d79e..000000000 --- a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/index_filter_values_schema.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "id": "/indexFilterValuesSchema", - "additionalProperties": { - "oneOf": [{ "$ref": "/numberSchema" }, { "$ref": "/addressSchema" }, { "$ref": "/orderHashSchema" }] - }, - "type": "object" -} diff --git a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/js_number_schema.json b/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/js_number_schema.json deleted file mode 100644 index 7df1c4747..000000000 --- a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/js_number_schema.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "id": "/jsNumberSchema", - "type": "number", - "minimum": 0 -} diff --git a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/number_schema.json b/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/number_schema.json deleted file mode 100644 index a48f3e8cf..000000000 --- a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/number_schema.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "id": "/numberSchema", - "type": "string", - "pattern": "^\\d+(\\.\\d+)?$" -} diff --git a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/order_cancel_schema.json b/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/order_cancel_schema.json deleted file mode 100644 index 8d0999941..000000000 --- a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/order_cancel_schema.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "id": "/orderCancellationRequestsSchema", - "type": "array", - "items": { - "properties": { - "order": { "$ref": "/orderSchema" }, - "takerTokenCancelAmount": { "$ref": "/wholeNumberSchema" } - }, - "required": ["order", "takerTokenCancelAmount"], - "type": "object" - } -} diff --git a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/order_config_request_schema.json b/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/order_config_request_schema.json deleted file mode 100644 index 19b043e7f..000000000 --- a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/order_config_request_schema.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "id": "/OrderConfigRequestSchema", - "type": "object", - "properties": { - "makerAddress": { "$ref": "/addressSchema" }, - "takerAddress": { "$ref": "/addressSchema" }, - "makerAssetAmount": { "$ref": "/wholeNumberSchema" }, - "takerAssetAmount": { "$ref": "/wholeNumberSchema" }, - "makerAssetData": { "$ref": "/hexSchema" }, - "takerAssetData": { "$ref": "/hexSchema" }, - "exchangeAddress": { "$ref": "/addressSchema" }, - "expirationTimeSeconds": { "$ref": "/wholeNumberSchema" } - }, - "required": [ - "makerAddress", - "takerAddress", - "makerAssetAmount", - "takerAssetAmount", - "makerAssetData", - "takerAssetData", - "exchangeAddress", - "expirationTimeSeconds" - ] -} diff --git a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/order_fill_or_kill_requests_schema.json b/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/order_fill_or_kill_requests_schema.json deleted file mode 100644 index 73bbf20bb..000000000 --- a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/order_fill_or_kill_requests_schema.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "id": "/orderFillOrKillRequestsSchema", - "type": "array", - "items": { - "properties": { - "signedOrder": { "$ref": "/signedOrderSchema" }, - "fillTakerAmount": { "$ref": "/wholeNumberSchema" } - }, - "required": ["signedOrder", "fillTakerAmount"], - "type": "object" - } -} diff --git a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/order_fill_requests_schema.json b/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/order_fill_requests_schema.json deleted file mode 100644 index d06fb19a2..000000000 --- a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/order_fill_requests_schema.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "id": "/orderFillRequestsSchema", - "type": "array", - "items": { - "properties": { - "signedOrder": { "$ref": "/signedOrderSchema" }, - "takerTokenFillAmount": { "$ref": "/wholeNumberSchema" } - }, - "required": ["signedOrder", "takerTokenFillAmount"], - "type": "object" - } -} diff --git a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/order_hash_schema.json b/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/order_hash_schema.json deleted file mode 100644 index 4a770579f..000000000 --- a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/order_hash_schema.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "id": "/orderHashSchema", - "type": "string", - "pattern": "^0x[0-9a-fA-F]{64}$" -} diff --git a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/order_schema.json b/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/order_schema.json deleted file mode 100644 index c70b9e2dd..000000000 --- a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/order_schema.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "id": "/orderSchema", - "properties": { - "makerAddress": { "$ref": "/addressSchema" }, - "takerAddress": { "$ref": "/addressSchema" }, - "makerFee": { "$ref": "/wholeNumberSchema" }, - "takerFee": { "$ref": "/wholeNumberSchema" }, - "senderAddress": { "$ref": "/addressSchema" }, - "makerAssetAmount": { "$ref": "/wholeNumberSchema" }, - "takerAssetAmount": { "$ref": "/wholeNumberSchema" }, - "makerAssetData": { "$ref": "/hexSchema" }, - "takerAssetData": { "$ref": "/hexSchema" }, - "salt": { "$ref": "/wholeNumberSchema" }, - "exchangeAddress": { "$ref": "/addressSchema" }, - "feeRecipientAddress": { "$ref": "/addressSchema" }, - "expirationTimeSeconds": { "$ref": "/wholeNumberSchema" } - }, - "required": [ - "makerAddress", - "takerAddress", - "makerFee", - "takerFee", - "senderAddress", - "makerAssetAmount", - "takerAssetAmount", - "makerAssetData", - "takerAssetData", - "salt", - "exchangeAddress", - "feeRecipientAddress", - "expirationTimeSeconds" - ], - "type": "object" -} diff --git a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/order_watcher_web_socket_request_schema.json b/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/order_watcher_web_socket_request_schema.json deleted file mode 100644 index b0c419f94..000000000 --- a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/order_watcher_web_socket_request_schema.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "id": "/orderWatcherWebSocketRequestSchema", - "type": "object", - "definitions": { - "signedOrderParam": { - "type": "object", - "properties": { - "signedOrder": { "$ref": "/signedOrderSchema" } - }, - "required": ["signedOrder"] - }, - "orderHashParam": { - "type": "object", - "properties": { - "orderHash": { "$ref": "/hexSchema" } - }, - "required": ["orderHash"] - } - }, - "oneOf": [ - { - "type": "object", - "properties": { - "id": { "type": "number" }, - "jsonrpc": { "type": "string" }, - "method": { "enum": ["ADD_ORDER"] }, - "params": { "$ref": "#/definitions/signedOrderParam" } - }, - "required": ["id", "jsonrpc", "method", "params"] - }, - { - "type": "object", - "properties": { - "id": { "type": "number" }, - "jsonrpc": { "type": "string" }, - "method": { "enum": ["REMOVE_ORDER"] }, - "params": { "$ref": "#/definitions/orderHashParam" } - }, - "required": ["id", "jsonrpc", "method", "params"] - }, - { - "type": "object", - "properties": { - "id": { "type": "number" }, - "jsonrpc": { "type": "string" }, - "method": { "enum": ["GET_STATS"] }, - "params": {} - }, - "required": ["id", "jsonrpc", "method"] - } - ] -} \ No newline at end of file diff --git a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/order_watcher_web_socket_utf8_message_schema.json b/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/order_watcher_web_socket_utf8_message_schema.json deleted file mode 100644 index 154d6d754..000000000 --- a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/order_watcher_web_socket_utf8_message_schema.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "id": "/orderWatcherWebSocketUtf8MessageSchema", - "properties": { - "utf8Data": { "type": "string" } - }, - "required": [ - "utf8Data" - ], - "type": "object" -} diff --git a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/orderbook_request_schema.json b/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/orderbook_request_schema.json deleted file mode 100644 index 5ce6e8ab0..000000000 --- a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/orderbook_request_schema.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "id": "/OrderbookRequestSchema", - "type": "object", - "properties": { - "baseAssetData": { "$ref": "/hexSchema" }, - "quoteAssetData": { "$ref": "/hexSchema" } - }, - "required": ["baseAssetData", "quoteAssetData"] -} diff --git a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/orders_request_opts_schema.json b/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/orders_request_opts_schema.json deleted file mode 100644 index 4c1b9b4e9..000000000 --- a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/orders_request_opts_schema.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "id": "/OrdersRequestOptsSchema", - "type": "object", - "properties": { - "makerAssetProxyId": { "$ref": "/hexSchema" }, - "takerAssetProxyId": { "$ref": "/hexSchema" }, - "makerAssetAddress": { "$ref": "/addressSchema" }, - "takerAssetAddress": { "$ref": "/addressSchema" }, - "exchangeAddress": { "$ref": "/addressSchema" }, - "senderAddress": { "$ref": "/addressSchema" }, - "makerAssetData": { "$ref": "/hexSchema" }, - "takerAssetData": { "$ref": "/hexSchema" }, - "traderAssetData": { "$ref": "/hexSchema" }, - "makerAddress": { "$ref": "/addressSchema" }, - "takerAddress": { "$ref": "/addressSchema" }, - "traderAddress": { "$ref": "/addressSchema" }, - "feeRecipientAddress": { "$ref": "/addressSchema" } - } -} diff --git a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/orders_schema.json b/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/orders_schema.json deleted file mode 100644 index 1e1c6a875..000000000 --- a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/orders_schema.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "id": "/ordersSchema", - "type": "array", - "items": { "$ref": "/orderSchema" } -} diff --git a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/paged_request_opts_schema.json b/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/paged_request_opts_schema.json deleted file mode 100644 index f143c28b0..000000000 --- a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/paged_request_opts_schema.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "id": "/PagedRequestOptsSchema", - "type": "object", - "properties": { - "page": { "type": "number" }, - "perPage": { "type": "number" } - } -} diff --git a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/paginated_collection_schema.json b/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/paginated_collection_schema.json deleted file mode 100644 index 9dcedf5b4..000000000 --- a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/paginated_collection_schema.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "id": "/paginatedCollectionSchema", - "type": "object", - "properties": { - "total": { "type": "number" }, - "perPage": { "type": "number" }, - "page": { "type": "number" } - }, - "required": ["total", "perPage", "page"] -} diff --git a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/relayer_api_asset_data_pairs_response_schema.json b/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/relayer_api_asset_data_pairs_response_schema.json deleted file mode 100644 index d1150d3db..000000000 --- a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/relayer_api_asset_data_pairs_response_schema.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "id": "/relayerApiAssetDataPairsResponseSchema", - "type": "object", - "allOf": [ - { "$ref": "/paginatedCollectionSchema" }, - { - "properties": { - "records": { "$ref": "/relayerApiAssetDataPairsSchema" } - }, - "required": ["records"] - } - ] -} diff --git a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/relayer_api_asset_data_pairs_schema.json b/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/relayer_api_asset_data_pairs_schema.json deleted file mode 100644 index 62d4745b8..000000000 --- a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/relayer_api_asset_data_pairs_schema.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "id": "/relayerApiAssetDataPairsSchema", - "type": "array", - "items": { - "properties": { - "assetDataA": { "$ref": "/relayerApiAssetDataTradeInfoSchema" }, - "assetDataB": { "$ref": "/relayerApiAssetDataTradeInfoSchema" } - }, - "required": ["assetDataA", "assetDataB"], - "type": "object" - } -} diff --git a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/relayer_api_asset_data_trade_info_schema.json b/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/relayer_api_asset_data_trade_info_schema.json deleted file mode 100644 index e0f274c5d..000000000 --- a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/relayer_api_asset_data_trade_info_schema.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "id": "/relayerApiAssetDataTradeInfoSchema", - "type": "object", - "properties": { - "assetData": { "$ref": "/hexSchema" }, - "minAmount": { "$ref": "/wholeNumberSchema" }, - "maxAmount": { "$ref": "/wholeNumberSchema" }, - "precision": { "type": "number" } - }, - "required": ["assetData"] -} diff --git a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/relayer_api_error_response_schema.json b/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/relayer_api_error_response_schema.json deleted file mode 100644 index be4659b0b..000000000 --- a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/relayer_api_error_response_schema.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "id": "/relayerApiErrorResponseSchema", - "type": "object", - "properties": { - "code": { "type": "integer", "minimum": 100, "maximum": 103 }, - "reason": { "type": "string" }, - "validationErrors": { - "type": "array", - "items": { - "type": "object", - "properties": { - "field": { "type": "string" }, - "code": { "type": "integer", "minimum": 1000, "maximum": 1006 }, - "reason": { "type": "string" } - }, - "required": ["field", "code", "reason"] - } - } - }, - "required": ["code", "reason"] -} diff --git a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/relayer_api_fee_recipients_response_schema.json b/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/relayer_api_fee_recipients_response_schema.json deleted file mode 100644 index c73506dbb..000000000 --- a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/relayer_api_fee_recipients_response_schema.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "id": "/relayerApiFeeRecipientsResponseSchema", - "type": "object", - "allOf": [ - { "$ref": "/paginatedCollectionSchema" }, - { - "properties": { - "records": { - "type": "array", - "items": { "$ref": "/addressSchema" } - } - }, - "required": ["records"] - } - ] -} diff --git a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/relayer_api_order_config_payload_schema.json b/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/relayer_api_order_config_payload_schema.json deleted file mode 100644 index f4583fc62..000000000 --- a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/relayer_api_order_config_payload_schema.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "id": "/relayerApiOrderConfigPayloadSchema", - "type": "object", - "properties": { - "makerAddress": { "$ref": "/addressSchema" }, - "takerAddress": { "$ref": "/addressSchema" }, - "makerAssetAmount": { "$ref": "/wholeNumberSchema" }, - "takerAssetAmount": { "$ref": "/wholeNumberSchema" }, - "makerAssetData": { "$ref": "/hexSchema" }, - "takerAssetData": { "$ref": "/hexSchema" }, - "exchangeAddress": { "$ref": "/addressSchema" }, - "expirationTimeSeconds": { "$ref": "/wholeNumberSchema" } - }, - "required": [ - "makerAddress", - "takerAddress", - "makerAssetAmount", - "takerAssetAmount", - "makerAssetData", - "takerAssetData", - "exchangeAddress", - "expirationTimeSeconds" - ] -} diff --git a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/relayer_api_order_config_response_schema.json b/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/relayer_api_order_config_response_schema.json deleted file mode 100644 index 8193861e1..000000000 --- a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/relayer_api_order_config_response_schema.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "id": "/relayerApiOrderConfigResponseSchema", - "type": "object", - "properties": { - "makerFee": { "$ref": "/wholeNumberSchema" }, - "takerFee": { "$ref": "/wholeNumberSchema" }, - "feeRecipientAddress": { "$ref": "/addressSchema" }, - "senderAddress": { "$ref": "/addressSchema" } - }, - "required": ["makerFee", "takerFee", "feeRecipientAddress", "senderAddress"] -} diff --git a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/relayer_api_order_schema.json b/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/relayer_api_order_schema.json deleted file mode 100644 index e0f6539b9..000000000 --- a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/relayer_api_order_schema.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "id": "/relayerApiOrderSchema", - "type": "object", - "properties": { - "order": { "$ref": "/orderSchema" }, - "metaData": { "type": "object" } - }, - "required": ["order", "metaData"] -} diff --git a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/relayer_api_orderbook_response_schema.json b/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/relayer_api_orderbook_response_schema.json deleted file mode 100644 index b44f2a740..000000000 --- a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/relayer_api_orderbook_response_schema.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "id": "/relayerApiOrderbookResponseSchema", - "type": "object", - "properties": { - "bids": { "$ref": "/relayerApiOrdersResponseSchema" }, - "asks": { "$ref": "/relayerApiOrdersResponseSchema" } - }, - "required": ["bids", "asks"] -} diff --git a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/relayer_api_orders_channel_subscribe_payload_schema.json b/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/relayer_api_orders_channel_subscribe_payload_schema.json deleted file mode 100644 index 274ef1625..000000000 --- a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/relayer_api_orders_channel_subscribe_payload_schema.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "id": "/relayerApiOrdersChannelSubscribePayloadSchema", - "type": "object", - "properties": { - "makerAssetProxyId": { "$ref": "/hexSchema" }, - "takerAssetProxyId": { "$ref": "/hexSchema" }, - "networkId": { "type": "number" }, - "makerAssetAddress": { "$ref": "/addressSchema" }, - "takerAssetAddress": { "$ref": "/addressSchema" }, - "makerAssetData": { "$ref": "/hexSchema" }, - "takerAssetData": { "$ref": "/hexSchema" }, - "traderAssetData": { "$ref": "/hexSchema" } - } -} diff --git a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/relayer_api_orders_channel_subscribe_schema.json b/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/relayer_api_orders_channel_subscribe_schema.json deleted file mode 100644 index 29561d09f..000000000 --- a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/relayer_api_orders_channel_subscribe_schema.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "id": "/relayerApiOrdersChannelSubscribeSchema", - "type": "object", - "properties": { - "type": { "enum": ["subscribe"] }, - "channel": { "enum": ["orders"] }, - "requestId": { "type": "string" }, - "payload": { "$ref": "/relayerApiOrdersChannelSubscribePayloadSchema" } - }, - "required": ["type", "channel", "requestId"] -} diff --git a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/relayer_api_orders_channel_update_response_schema.json b/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/relayer_api_orders_channel_update_response_schema.json deleted file mode 100644 index 239e7c586..000000000 --- a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/relayer_api_orders_channel_update_response_schema.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "id": "/relayerApiOrdersChannelUpdateSchema", - "type": "object", - "properties": { - "type": { "enum": ["update"] }, - "channel": { "enum": ["orders"] }, - "requestId": { "type": "string" }, - "payload": { "$ref": "/relayerApiOrdersSchema" } - }, - "required": ["type", "channel", "requestId"] -} diff --git a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/relayer_api_orders_response_schema.json b/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/relayer_api_orders_response_schema.json deleted file mode 100644 index a5023a3fc..000000000 --- a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/relayer_api_orders_response_schema.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "id": "/relayerApiOrdersResponseSchema", - "type": "object", - "allOf": [ - { "$ref": "/paginatedCollectionSchema" }, - { - "properties": { - "records": { "$ref": "/relayerApiOrdersSchema" } - }, - "required": ["records"] - } - ] -} diff --git a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/relayer_api_orders_schema.json b/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/relayer_api_orders_schema.json deleted file mode 100644 index 84e75cd04..000000000 --- a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/relayer_api_orders_schema.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "id": "/relayerApiOrdersSchema", - "type": "array", - "items": { "$ref": "/relayerApiOrderSchema" } -} diff --git a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/request_opts_schema.json b/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/request_opts_schema.json deleted file mode 100644 index 2206f5016..000000000 --- a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/request_opts_schema.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "id": "/RequestOptsSchema", - "type": "object", - "properties": { - "networkId": { "type": "number" } - } -} diff --git a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/signed_order_schema.json b/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/signed_order_schema.json deleted file mode 100644 index 137ae4a24..000000000 --- a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/signed_order_schema.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "id": "/signedOrderSchema", - "allOf": [ - { "$ref": "/orderSchema" }, - { - "properties": { - "signature": { "$ref": "/hexSchema" } - }, - "required": ["signature"] - } - ] -} diff --git a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/signed_orders_schema.json b/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/signed_orders_schema.json deleted file mode 100644 index e7c3a0b6c..000000000 --- a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/signed_orders_schema.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "id": "/signedOrdersSchema", - "type": "array", - "items": { "$ref": "/signedOrderSchema" } -} diff --git a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/token_schema.json b/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/token_schema.json deleted file mode 100644 index 31e41c4b8..000000000 --- a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/token_schema.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "id": "/tokenSchema", - "properties": { - "name": { "type": "string" }, - "symbol": { "type": "string" }, - "decimals": { "type": "number" }, - "address": { "$ref": "/addressSchema" } - }, - "required": ["name", "symbol", "decimals", "address"], - "type": "object" -} diff --git a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/tx_data_schema.json b/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/tx_data_schema.json deleted file mode 100644 index 8c3daba4e..000000000 --- a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/tx_data_schema.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "id": "/txDataSchema", - "properties": { - "from": { "$ref": "/addressSchema" }, - "to": { "$ref": "/addressSchema" }, - "value": { - "oneOf": [{ "$ref": "/numberSchema" }, { "$ref": "/jsNumberSchema" }] - }, - "gas": { - "oneOf": [{ "$ref": "/numberSchema" }, { "$ref": "/jsNumberSchema" }] - }, - "gasPrice": { - "oneOf": [{ "$ref": "/numberSchema" }, { "$ref": "/jsNumberSchema" }] - }, - "data": { - "type": "string", - "pattern": "^0x[0-9a-f]*$" - }, - "nonce": { - "type": "number", - "minimum": 0 - } - }, - "required": ["from"], - "type": "object" -} diff --git a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/whole_number_schema.json b/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/whole_number_schema.json deleted file mode 100644 index aa469954c..000000000 --- a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/whole_number_schema.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "id": "/wholeNumberSchema", - "anyOf": [ - { - "type": "string", - "pattern": "^\\d+$" - }, - { - "type": "integer" - } - ] -} diff --git a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/zero_ex_transaction_schema.json b/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/zero_ex_transaction_schema.json deleted file mode 100644 index 0c714f14d..000000000 --- a/python-packages/json_schemas/src/zero_ex/json_schemas/schemas/zero_ex_transaction_schema.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "id": "/zeroExTransactionSchema", - "properties": { - "data": { "$ref": "/hexSchema" }, - "signerAddress": { "$ref": "/addressSchema" }, - "salt": { "$ref": "/wholeNumberSchema" } - }, - "required": ["data", "salt", "signerAddress"], - "type": "object" -} diff --git a/python-packages/json_schemas/stubs/distutils/__init__.pyi b/python-packages/json_schemas/stubs/distutils/__init__.pyi deleted file mode 100644 index e69de29bb..000000000 diff --git a/python-packages/json_schemas/stubs/distutils/command/__init__.pyi b/python-packages/json_schemas/stubs/distutils/command/__init__.pyi deleted file mode 100644 index e69de29bb..000000000 diff --git a/python-packages/json_schemas/stubs/distutils/command/clean.pyi b/python-packages/json_schemas/stubs/distutils/command/clean.pyi deleted file mode 100644 index 46a42ddb1..000000000 --- a/python-packages/json_schemas/stubs/distutils/command/clean.pyi +++ /dev/null @@ -1,7 +0,0 @@ -from distutils.core import Command - -class clean(Command): - def initialize_options(self: clean) -> None: ... - def finalize_options(self: clean) -> None: ... - def run(self: clean) -> None: ... - ... diff --git a/python-packages/json_schemas/stubs/jsonschema/__init__.pyi b/python-packages/json_schemas/stubs/jsonschema/__init__.pyi deleted file mode 100644 index 442e2f65e..000000000 --- a/python-packages/json_schemas/stubs/jsonschema/__init__.pyi +++ /dev/null @@ -1,11 +0,0 @@ -from typing import Any, Dict, Tuple - - -class RefResolver: - def resolve(self, url: str) -> Tuple[str, Dict]: - ... - - -class ValidationError(Exception): pass - -def validate(instance: Any, schema: Dict, cls=None, *args, **kwargs) -> None: pass diff --git a/python-packages/json_schemas/stubs/jsonschema/exceptions.pyi b/python-packages/json_schemas/stubs/jsonschema/exceptions.pyi deleted file mode 100644 index e69de29bb..000000000 diff --git a/python-packages/json_schemas/stubs/pytest/__init__.pyi b/python-packages/json_schemas/stubs/pytest/__init__.pyi deleted file mode 100644 index e69de29bb..000000000 diff --git a/python-packages/json_schemas/stubs/pytest/raises.pyi b/python-packages/json_schemas/stubs/pytest/raises.pyi deleted file mode 100644 index 2e3b29f3d..000000000 --- a/python-packages/json_schemas/stubs/pytest/raises.pyi +++ /dev/null @@ -1 +0,0 @@ -def raises(exception: Exception) -> ExceptionInfo: ... diff --git a/python-packages/json_schemas/stubs/setuptools/__init__.pyi b/python-packages/json_schemas/stubs/setuptools/__init__.pyi deleted file mode 100644 index 8ea8d32b7..000000000 --- a/python-packages/json_schemas/stubs/setuptools/__init__.pyi +++ /dev/null @@ -1,8 +0,0 @@ -from distutils.dist import Distribution -from typing import Any, List - -def setup(**attrs: Any) -> Distribution: ... - -class Command: ... - -def find_packages(where: str) -> List[str]: ... diff --git a/python-packages/json_schemas/stubs/setuptools/command/__init__.pyi b/python-packages/json_schemas/stubs/setuptools/command/__init__.pyi deleted file mode 100644 index e69de29bb..000000000 diff --git a/python-packages/json_schemas/stubs/setuptools/command/test.pyi b/python-packages/json_schemas/stubs/setuptools/command/test.pyi deleted file mode 100644 index c5ec770ad..000000000 --- a/python-packages/json_schemas/stubs/setuptools/command/test.pyi +++ /dev/null @@ -1,3 +0,0 @@ -from setuptools import Command - -class test(Command): ... diff --git a/python-packages/json_schemas/stubs/stringcase/__init__.pyi b/python-packages/json_schemas/stubs/stringcase/__init__.pyi deleted file mode 100644 index 56d784cf5..000000000 --- a/python-packages/json_schemas/stubs/stringcase/__init__.pyi +++ /dev/null @@ -1,2 +0,0 @@ -def snakecase(_: str): - ... diff --git a/python-packages/json_schemas/test/__init__.py b/python-packages/json_schemas/test/__init__.py deleted file mode 100644 index ce724e180..000000000 --- a/python-packages/json_schemas/test/__init__.py +++ /dev/null @@ -1 +0,0 @@ -"""Tests of zero_ex.json_schemas.""" diff --git a/python-packages/json_schemas/test/test_json_schemas.py b/python-packages/json_schemas/test/test_json_schemas.py deleted file mode 100644 index 1d1efdd12..000000000 --- a/python-packages/json_schemas/test/test_json_schemas.py +++ /dev/null @@ -1,42 +0,0 @@ -"""Tests of zero_ex.json_schemas""" - - -from zero_ex.order_utils import make_empty_order, order_to_jsdict -from zero_ex.json_schemas import _LOCAL_RESOLVER, assert_valid - - -NULL_ADDRESS = "0x0000000000000000000000000000000000000000" - -EMPTY_ORDER = { - "makerAddress": NULL_ADDRESS, - "takerAddress": NULL_ADDRESS, - "senderAddress": NULL_ADDRESS, - "feeRecipientAddress": NULL_ADDRESS, - "makerAssetData": NULL_ADDRESS, - "takerAssetData": NULL_ADDRESS, - "salt": "0", - "makerFee": "0", - "takerFee": "0", - "makerAssetAmount": "0", - "takerAssetAmount": "0", - "expirationTimeSeconds": "0", - "exchangeAddress": NULL_ADDRESS, -} - - -def test_assert_valid_caches_resources(): - """Test that the JSON ref resolver in `assert_valid()` caches resources - - In order to test the cache we much access the private class of - `json_schemas` and reset the LRU cache on `_LocalRefResolver`. - For this to happen, we need to disable errror `W0212` - on _LOCAL_RESOLVER - """ - _LOCAL_RESOLVER._remote_cache.cache_clear() # pylint: disable=W0212 - - assert_valid(order_to_jsdict(make_empty_order()), "/orderSchema") - cache_info = ( - _LOCAL_RESOLVER._remote_cache.cache_info() # pylint: disable=W0212 - ) - assert cache_info.currsize == 4 - assert cache_info.hits > 0 diff --git a/python-packages/json_schemas/tox.ini b/python-packages/json_schemas/tox.ini deleted file mode 100644 index 1d5de646e..000000000 --- a/python-packages/json_schemas/tox.ini +++ /dev/null @@ -1,25 +0,0 @@ -# tox (https://tox.readthedocs.io/) is a tool for running tests -# in multiple virtualenvs. This configuration file will run the -# test suite on all supported python versions. To use it, "pip install tox" -# and then run "tox" from this directory. - -[tox] -envlist = py37 - -[testenv] -commands = - pip install -e .[dev] - python setup.py test - -[testenv:run_tests_against_test_deployment] -commands = - # install dependencies from real PyPI - pip install jsonschema mypy_extensions pytest - # install package-under-test from test PyPI - pip install --index-url https://test.pypi.org/legacy/ 0x-json-schemas - pytest test - -[testenv:run_tests_against_deployment] -commands = - pip install 0x-json-schemas - pytest test -- cgit v1.2.3