diff --git a/configloader/jsonschema/.coveragerc b/configloader/jsonschema/.coveragerc deleted file mode 100644 index 2fa2f9b2b9..0000000000 --- a/configloader/jsonschema/.coveragerc +++ /dev/null @@ -1,13 +0,0 @@ -[run] -source = - dffml_configloader_jsonschema - tests -branch = True - -[report] -exclude_lines = - no cov - no qa - noqa - pragma: no cover - if __name__ == .__main__.: diff --git a/configloader/jsonschema/.gitignore b/configloader/jsonschema/.gitignore deleted file mode 100644 index 3af0b3e081..0000000000 --- a/configloader/jsonschema/.gitignore +++ /dev/null @@ -1,21 +0,0 @@ -*.log -*.pyc -.cache/ -.coverage -.idea/ -.vscode/ -*.egg-info/ -build/ -dist/ -docs/build/ -venv/ -wheelhouse/ -*.egss -.mypy_cache/ -*.swp -.venv/ -.eggs/ -*.modeldir -*.db -htmlcov/ -built_html_docs/ diff --git a/configloader/jsonschema/LICENSE b/configloader/jsonschema/LICENSE deleted file mode 100644 index 508c4dd864..0000000000 --- a/configloader/jsonschema/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -Copyright (c) 2022 Intel - -MIT License - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/configloader/jsonschema/MANIFEST.in b/configloader/jsonschema/MANIFEST.in deleted file mode 100644 index 683e228748..0000000000 --- a/configloader/jsonschema/MANIFEST.in +++ /dev/null @@ -1,3 +0,0 @@ -include README.rst -include LICENSE -recursive-include dffml_configloader_jsonschema * diff --git a/configloader/jsonschema/README.rst b/configloader/jsonschema/README.rst deleted file mode 100644 index 29e50edcb8..0000000000 --- a/configloader/jsonschema/README.rst +++ /dev/null @@ -1,22 +0,0 @@ -DFFML JSON Schema Configloader -============================== - -Used to export the JSON schema associated with an object. - -Install from pip - -.. code-block:: console - - $ pip install -e . - -Usage - -.. code-block:: console - - $ dffml service dev export -configloader jsonschema example:mydict - -Testing - -.. code-block:: console - - $ python -m unittest discover -v diff --git a/configloader/jsonschema/dffml_configloader_jsonschema/__init__.py b/configloader/jsonschema/dffml_configloader_jsonschema/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/configloader/jsonschema/dffml_configloader_jsonschema/configloader.py b/configloader/jsonschema/dffml_configloader_jsonschema/configloader.py deleted file mode 100644 index 110246d441..0000000000 --- a/configloader/jsonschema/dffml_configloader_jsonschema/configloader.py +++ /dev/null @@ -1,34 +0,0 @@ -""" -Description of what this config does -""" -import ast -from typing import Dict - -from dffml.util.entrypoint import entrypoint -from dffml.util.cli.arg import Arg -from dffml.base import BaseConfig -from dffml.configloader.configloader import ( - BaseConfigLoaderContext, - BaseConfigLoader, -) - - -class JSONSchemaConfigLoaderContext(BaseConfigLoaderContext): - async def loadb(self, resource: bytes) -> Dict: - return ast.literal_eval(resource.decode()) - - async def dumpb(self, resource: Dict) -> bytes: - return repr(resource).encode() - - -@entrypoint("jsonschema") -class JSONSchemaConfigLoader(BaseConfigLoader): - CONTEXT = JSONSchemaConfigLoaderContext - - @classmethod - def args(cls, args, *above) -> Dict[str, Arg]: - return args - - @classmethod - def config(cls, config, *above) -> BaseConfig: - return BaseConfig() diff --git a/configloader/jsonschema/dffml_configloader_jsonschema/version.py b/configloader/jsonschema/dffml_configloader_jsonschema/version.py deleted file mode 100644 index 901e5110b2..0000000000 --- a/configloader/jsonschema/dffml_configloader_jsonschema/version.py +++ /dev/null @@ -1 +0,0 @@ -VERSION = "0.0.1" diff --git a/configloader/jsonschema/entry_points.txt b/configloader/jsonschema/entry_points.txt deleted file mode 100644 index 191f401474..0000000000 --- a/configloader/jsonschema/entry_points.txt +++ /dev/null @@ -1,2 +0,0 @@ -[dffml.configloader] -jsonschema = dffml_configloader_jsonschema.configloader:JSONSchemaConfigLoader diff --git a/configloader/jsonschema/pyproject.toml b/configloader/jsonschema/pyproject.toml deleted file mode 100644 index 3ba7736eac..0000000000 --- a/configloader/jsonschema/pyproject.toml +++ /dev/null @@ -1,20 +0,0 @@ -requires = ["setuptools>=44", "wheel", "setuptools_scm[toml]>=3.4.3"] -build-backend = "setuptools.build_meta" - -[tool.black] -exclude = ''' -( - /( - \.eggs # exclude a few common directories in the - | \.git # root of the project - | \.hg - | \.mypy_cache - | \.tox - | \.venv - | _build - | buck-out - | build - | dist - ) -) -''' diff --git a/configloader/jsonschema/setup.cfg b/configloader/jsonschema/setup.cfg deleted file mode 100644 index a16a5b9a3c..0000000000 --- a/configloader/jsonschema/setup.cfg +++ /dev/null @@ -1,40 +0,0 @@ -[metadata] -name = dffml-configloader-jsonschema -description = DFFML config dffml-configloader-jsonschema -version = attr: dffml_configloader_jsonschema.version.VERSION -long_description = file: README.rst -author = Unknown -author_email = unknown@example.com -maintainer = Unknown -maintainer_email = unknown@example.com -url = https://github.com/coder/dffml-configloader-jsonschema -license = MIT -keywords = dffml -classifiers = - Development Status :: 3 - Alpha - Intended Audience :: Developers - License :: OSI Approved :: MIT License - Natural Language :: English - Operating System :: OS Independent - Programming Language :: Python :: 3 :: Only - Programming Language :: Python :: 3.7 - Programming Language :: Python :: Implementation :: CPython - Programming Language :: Python :: Implementation :: PyPy - -[options] -zip_safe = False -include_package_data = True -packages = find: -entry_points = file: entry_points.txt -install_requires = - dffml>=0.4.0 - pydantic>=1.10.2 - -[options.extras_require] -dev = - coverage - codecov - sphinx - twine - black==19.10b0 - importlib_metadata>=4.8.1;python_version<"3.8" diff --git a/configloader/jsonschema/setup.py b/configloader/jsonschema/setup.py deleted file mode 100644 index 17542f4d0e..0000000000 --- a/configloader/jsonschema/setup.py +++ /dev/null @@ -1,8 +0,0 @@ -import sys -import site -import setuptools - -# See https://github.com/pypa/pip/issues/7953 -site.ENABLE_USER_SITE = "--user" in sys.argv[1:] - -setuptools.setup() diff --git a/configloader/jsonschema/tests/__init__.py b/configloader/jsonschema/tests/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/configloader/jsonschema/tests/test_config.py b/configloader/jsonschema/tests/test_config.py deleted file mode 100644 index e9fd1d44d8..0000000000 --- a/configloader/jsonschema/tests/test_config.py +++ /dev/null @@ -1,140 +0,0 @@ -from dffml.util.asynctestcase import AsyncTestCase - -# from dffml_configloader_jsonschema.configloader import JSONSchemaConfigLoader -# ------------------- BEGIN dffml_configloader_jsonschema.configloader ------------------ -import ast -import json -import enum -from typing import Dict - -from dffml.base import config -from dffml.util.entrypoint import entrypoint -from dffml.util.cli.arg import Arg -from dffml.base import BaseConfig -from dffml.configloader.configloader import ( - BaseConfigLoaderContext, - BaseConfigLoader, -) - -from pydantic import BaseModel, Field - - -class FooBar(BaseModel): - count: int - size: float = None - - -class Gender(str, enum.Enum): - male = 'male' - female = 'female' - other = 'other' - not_given = 'not_given' - - -class MainModel(BaseModel): - """ - This is the description of the main model - """ - - foo_bar: FooBar = Field(...) - gender: Gender = Field(None, alias='Gender') - snap: int = Field( - 42, - title='The Snap', - description='this is the value of snap', - gt=30, - lt=50, - ) - - class Config: - title = 'Main' - schema_extra = { - "$schema": "https://intel.github.io/dffml/manifest-format-name.0.0.2.schema.json", - } - - -@config -class JSONSchemaConfigLoaderConfig: - pass - - -class JSONSchemaConfigLoaderContext(BaseConfigLoaderContext): - async def loadb(self, resource: bytes) -> Dict: - return json.loads(resource.decode()) - - async def dumpb(self, resource: Dict) -> bytes: - return MainModel.schema_json(indent=2).encode() - - -@entrypoint("jsonschema") -class JSONSchemaConfigLoader(BaseConfigLoader): - CONTEXT = JSONSchemaConfigLoaderContext - CONFIG = JSONSchemaConfigLoaderConfig - - -# ------------------- END dffml_configloader_jsonschema.configloader ------------------ - - -TEST_0_SCHEMA_SHOULD_BE = { - "title": "Main", - "description": "This is the description of the main model", - "type": "object", - "properties": { - "foo_bar": { - "$ref": "#/definitions/FooBar" - }, - "Gender": { - "$ref": "#/definitions/Gender" - }, - "snap": { - "title": "The Snap", - "description": "this is the value of snap", - "default": 42, - "exclusiveMinimum": 30, - "exclusiveMaximum": 50, - "type": "integer" - } - }, - "required": [ - "foo_bar" - ], - "definitions": { - "FooBar": { - "title": "FooBar", - "type": "object", - "properties": { - "count": { - "title": "Count", - "type": "integer" - }, - "size": { - "title": "Size", - "type": "number" - } - }, - "required": [ - "count" - ] - }, - "Gender": { - "title": "Gender", - "description": "An enumeration.", - "enum": [ - "male", - "female", - "other", - "not_given" - ], - "type": "string" - } - } -} - - -class TestConfig(AsyncTestCase): - async def test_0_dumpb_loadb(self): - async with JSONSchemaConfigLoader.withconfig({}) as configloader: - async with configloader() as ctx: - original = {"Test": ["dict"]} - reloaded = await ctx.loadb(await ctx.dumpb(original)) - self.assertEqual(original, TEST_0_SCHEMA_SHOULD_BE) diff --git a/dffml/plugins.py b/dffml/plugins.py index 766005d656..48dcf3a59d 100644 --- a/dffml/plugins.py +++ b/dffml/plugins.py @@ -23,7 +23,6 @@ def inpath(binary): CORE_PLUGINS = [ ("configloader", "yaml"), ("configloader", "image"), - ("configloader", "jsonschema"), ("model", "scratch"), ("model", "scikit"), ("model", "tensorflow"),