summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/conf.py1
-rw-r--r--docs/jsonschema_role.py7
-rw-r--r--jsonschema/__init__.py11
-rw-r--r--jsonschema/__main__.py1
-rw-r--r--jsonschema/benchmarks/issue232.py1
-rw-r--r--jsonschema/benchmarks/json_schema_test_suite.py1
-rw-r--r--jsonschema/exceptions.py1
-rw-r--r--jsonschema/tests/_helpers.py2
-rw-r--r--jsonschema/tests/test_cli.py2
-rw-r--r--jsonschema/tests/test_format.py3
-rw-r--r--jsonschema/tests/test_jsonschema_test_suite.py1
-rw-r--r--jsonschema/validators.py2
-rw-r--r--pyproject.toml5
13 files changed, 22 insertions, 16 deletions
diff --git a/docs/conf.py b/docs/conf.py
index 565b00a..fbf6f30 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -9,7 +9,6 @@ import sys
import jsonschema
-
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
diff --git a/docs/jsonschema_role.py b/docs/jsonschema_role.py
index a63ff72..82ccfbe 100644
--- a/docs/jsonschema_role.py
+++ b/docs/jsonschema_role.py
@@ -1,17 +1,18 @@
from datetime import datetime
-from docutils import nodes
import errno
import os
+from docutils import nodes
+
try:
import urllib2 as urllib
except ImportError:
import urllib.request as urllib
-import certifi
-import jsonschema
from lxml import html
+import certifi
+import jsonschema
__version__ = "1.1.0"
VALIDATION_SPEC = "https://json-schema.org/draft-07/json-schema-validation.html"
diff --git a/jsonschema/__init__.py b/jsonschema/__init__.py
index 6b630cd..619a7ea 100644
--- a/jsonschema/__init__.py
+++ b/jsonschema/__init__.py
@@ -8,9 +8,6 @@ Most commonly, `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,
@@ -19,6 +16,13 @@ from jsonschema._format import (
draft7_format_checker,
)
from jsonschema._types import TypeChecker
+from jsonschema.exceptions import (
+ ErrorTree,
+ FormatError,
+ RefResolutionError,
+ SchemaError,
+ ValidationError,
+)
from jsonschema.validators import (
Draft3Validator,
Draft4Validator,
@@ -27,6 +31,7 @@ from jsonschema.validators import (
RefResolver,
validate,
)
+
try:
from importlib import metadata
except ImportError: # for Python<3.8
diff --git a/jsonschema/__main__.py b/jsonschema/__main__.py
index 82c29fd..fdc21e2 100644
--- a/jsonschema/__main__.py
+++ b/jsonschema/__main__.py
@@ -1,2 +1,3 @@
from jsonschema.cli import main
+
main()
diff --git a/jsonschema/benchmarks/issue232.py b/jsonschema/benchmarks/issue232.py
index b1b05b2..e08dff9 100644
--- a/jsonschema/benchmarks/issue232.py
+++ b/jsonschema/benchmarks/issue232.py
@@ -12,7 +12,6 @@ from pyrsistent import m
from jsonschema.tests._suite import Version
import jsonschema
-
issue232 = Version(
path=Path(__file__).parent / "issue232",
remotes=m(),
diff --git a/jsonschema/benchmarks/json_schema_test_suite.py b/jsonschema/benchmarks/json_schema_test_suite.py
index 5add505..4126fdc 100644
--- a/jsonschema/benchmarks/json_schema_test_suite.py
+++ b/jsonschema/benchmarks/json_schema_test_suite.py
@@ -9,6 +9,5 @@ from pyperf import Runner
from jsonschema.tests._suite import Suite
-
if __name__ == "__main__":
Suite().benchmark(runner=Runner())
diff --git a/jsonschema/exceptions.py b/jsonschema/exceptions.py
index 2c2ce4d..46ffced 100644
--- a/jsonschema/exceptions.py
+++ b/jsonschema/exceptions.py
@@ -10,7 +10,6 @@ import attr
from jsonschema import _utils
-
WEAK_MATCHES = frozenset(["anyOf", "oneOf"])
STRONG_MATCHES = frozenset()
diff --git a/jsonschema/tests/_helpers.py b/jsonschema/tests/_helpers.py
index 761b404..51fff4f 100644
--- a/jsonschema/tests/_helpers.py
+++ b/jsonschema/tests/_helpers.py
@@ -1,5 +1,5 @@
-from io import StringIO
from contextlib import contextmanager
+from io import StringIO
import sys
diff --git a/jsonschema/tests/test_cli.py b/jsonschema/tests/test_cli.py
index c473e58..7ca32fc 100644
--- a/jsonschema/tests/test_cli.py
+++ b/jsonschema/tests/test_cli.py
@@ -8,7 +8,7 @@ import os
import subprocess
import sys
-from jsonschema import Draft4Validator, cli, __version__
+from jsonschema import Draft4Validator, __version__, cli
from jsonschema.exceptions import SchemaError, ValidationError
from jsonschema.tests._helpers import captured_output
from jsonschema.validators import _LATEST_VERSION, validate
diff --git a/jsonschema/tests/test_format.py b/jsonschema/tests/test_format.py
index 254985f..6dba484 100644
--- a/jsonschema/tests/test_format.py
+++ b/jsonschema/tests/test_format.py
@@ -4,10 +4,9 @@ Tests for the parts of jsonschema related to the :validator:`format` property.
from unittest import TestCase
-from jsonschema import FormatError, ValidationError, FormatChecker
+from jsonschema import FormatChecker, FormatError, ValidationError
from jsonschema.validators import Draft4Validator
-
BOOM = ValueError("Boom!")
BANG = ZeroDivisionError("Bang!")
diff --git a/jsonschema/tests/test_jsonschema_test_suite.py b/jsonschema/tests/test_jsonschema_test_suite.py
index f87c0f6..37d45e0 100644
--- a/jsonschema/tests/test_jsonschema_test_suite.py
+++ b/jsonschema/tests/test_jsonschema_test_suite.py
@@ -23,7 +23,6 @@ from jsonschema.tests._helpers import bug
from jsonschema.tests._suite import Suite
from jsonschema.validators import _DEPRECATED_DEFAULT_TYPES, create
-
SUITE = Suite()
DRAFT3 = SUITE.version(name="draft3")
DRAFT4 = SUITE.version(name="draft4")
diff --git a/jsonschema/validators.py b/jsonschema/validators.py
index 2ea23ac..d6e0a0c 100644
--- a/jsonschema/validators.py
+++ b/jsonschema/validators.py
@@ -17,11 +17,11 @@ from jsonschema import (
_validators,
exceptions,
)
-
# Sigh. https://gitlab.com/pycqa/flake8/issues/280
# https://github.com/pyga/ebb-lint/issues/7
# Imported for backwards compatibility.
from jsonschema.exceptions import ErrorTree
+
ErrorTree
diff --git a/pyproject.toml b/pyproject.toml
index 9cdcbf7..477d5e6 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -8,4 +8,9 @@ requires = [
]
build-backend = "setuptools.build_meta"
+[tool.isort]
+from_first = true
+include_trailing_comma = true
+multi_line_output = 3
+
[tool.setuptools_scm]