Skip to content

Commit

Permalink
Remove code deprecated in 0.11
Browse files Browse the repository at this point in the history
  • Loading branch information
marksparkza committed Oct 24, 2023
1 parent 9ec0157 commit df3c840
Show file tree
Hide file tree
Showing 19 changed files with 42 additions and 51 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ Changelog

v0.12.0 (unreleased)
--------------------
Deprecation removals:

* Exception classes dropped from the top-level package API
* ``jschon.exceptions`` module renamed to ``jschon.exc``


v0.11.1 (2023-10-22)
Expand Down
3 changes: 2 additions & 1 deletion examples/custom_keyword.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import pathlib
import pprint

from jschon import create_catalog, URI, JSON, JSONSchema, JSONSchemaError, LocalSource
from jschon import JSON, JSONSchema, LocalSource, URI, create_catalog
from jschon.exc import JSONSchemaError
from jschon.jsonschema import Result
from jschon.vocabulary import Keyword

Expand Down
7 changes: 3 additions & 4 deletions jschon/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from .catalog import Catalog, LocalSource, RemoteSource
from .exceptions import CatalogError, JSONError, JSONPatchError, JSONPointerError, JSONSchemaError, URIError
from .json import JSON, JSONCompatible
from .jsonpatch import JSONPatch, JSONPatchOperation
from .jsonpointer import JSONPointer, RelativeJSONPointer
Expand All @@ -8,15 +7,15 @@

__all__ = [
'Catalog',
'LocalSource',
'RemoteSource',
'JSON',
'JSONCompatible',
'JSONPatch',
'JSONPatchOperation',
'JSONPointer',
'JSONSchema',
'LocalSource',
'RelativeJSONPointer',
'RemoteSource',
'JSONSchema',
'Result',
'URI',
'create_catalog',
Expand Down
2 changes: 1 addition & 1 deletion jschon/catalog/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from os import PathLike
from typing import Any, ContextManager, Dict, Hashable, Set, Union

from jschon.exceptions import CatalogError, JSONPointerError, URIError
from jschon.exc import CatalogError, JSONPointerError, URIError
from jschon.json import JSONCompatible
from jschon.jsonpointer import JSONPointer
from jschon.jsonschema import JSONSchema
Expand Down
2 changes: 0 additions & 2 deletions jschon/exceptions.py

This file was deleted.

2 changes: 1 addition & 1 deletion jschon/json.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from os import PathLike
from typing import Any, Dict, Iterator, List, Mapping, MutableMapping, MutableSequence, Optional, Sequence, Type, Union

from jschon.exceptions import JSONError, JSONPointerError
from jschon.exc import JSONError, JSONPointerError
from jschon.jsonpointer import JSONPointer
from jschon.utils import json_dumpf, json_dumps, json_loadf, json_loadr, json_loads

Expand Down
2 changes: 1 addition & 1 deletion jschon/jsonpatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from enum import Enum
from typing import Dict, Iterable, List, Mapping, MutableSequence, Optional, Sequence, Union, overload

from jschon.exceptions import JSONPatchError, JSONPointerError
from jschon.exc import JSONPatchError, JSONPointerError
from jschon.json import JSON, JSONCompatible
from jschon.jsonpointer import JSONPointer

Expand Down
2 changes: 1 addition & 1 deletion jschon/jsonschema.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from typing import Any, ContextManager, Dict, Hashable, Iterator, Mapping, Optional, TYPE_CHECKING, Tuple, Type, Union
from uuid import uuid4

from jschon.exceptions import JSONSchemaError
from jschon.exc import JSONSchemaError
from jschon.json import JSON, JSONCompatible
from jschon.jsonpointer import JSONPointer
from jschon.uri import URI
Expand Down
2 changes: 1 addition & 1 deletion jschon/uri.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import rfc3986.misc
import rfc3986.validators

from jschon.exceptions import URIError
from jschon.exc import URIError

__all__ = [
'URI',
Expand Down
4 changes: 2 additions & 2 deletions jschon/vocabulary/__init__.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
from __future__ import annotations

import re
import inspect
import re
from typing import Any, Dict, Mapping, Optional, Sequence, TYPE_CHECKING, Tuple, Type

from jschon.exc import JSONSchemaError
from jschon.json import JSON, JSONCompatible
from jschon.jsonschema import JSONSchema, Result
from jschon.exceptions import JSONSchemaError
from jschon.uri import URI

if TYPE_CHECKING:
Expand Down
2 changes: 1 addition & 1 deletion jschon/vocabulary/core.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import Mapping

from jschon.exceptions import CatalogError, JSONSchemaError, URIError
from jschon.exc import CatalogError, JSONSchemaError, URIError
from jschon.json import JSON
from jschon.jsonschema import JSONSchema, Result
from jschon.uri import URI
Expand Down
4 changes: 1 addition & 3 deletions jschon/vocabulary/future.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
from typing import Mapping

from jschon.exceptions import JSONSchemaError
from jschon.exc import JSONSchemaError
from jschon.jsonschema import JSONSchema
from jschon.uri import URI
from jschon.vocabulary import Keyword
Expand Down
2 changes: 1 addition & 1 deletion jschon/vocabulary/legacy.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from jschon.exceptions import JSONSchemaError
from jschon.exc import JSONSchemaError
from jschon.json import JSON
from jschon.jsonschema import JSONSchema, Result
from jschon.vocabulary import ArrayOfSubschemas, Keyword, Subschema
Expand Down
24 changes: 7 additions & 17 deletions tests/test_catalog.py
Original file line number Diff line number Diff line change
@@ -1,27 +1,17 @@
import itertools
import json
import pathlib
import pytest
import re
import tempfile
import uuid
import itertools
import re

import pytest
from unittest.mock import patch

from jschon import (
Catalog,
CatalogError,
URI,
JSONPointer,
JSONSchema,
JSON,
create_catalog,
LocalSource,
RemoteSource,
)
from jschon import Catalog, JSON, JSONPointer, JSONSchema, LocalSource, RemoteSource, URI, create_catalog
from jschon.catalog import Source
from jschon.vocabulary import Metaschema, Keyword
from tests import example_schema, metaschema_uri_2020_12, core_vocab_uri_2020_12
from jschon.exc import CatalogError
from jschon.vocabulary import Keyword, Metaschema
from tests import core_vocab_uri_2020_12, example_schema, metaschema_uri_2020_12

json_example = {"foo": "bar"}

Expand Down
4 changes: 2 additions & 2 deletions tests/test_formats.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import ipaddress

import pytest
from hypothesis import given, strategies as hs

from jschon import JSON, JSONPointer, JSONPointerError, JSONSchema
from jschon import JSON, JSONPointer, JSONSchema
from jschon.exc import JSONPointerError
from jschon.jsonschema import Result
from jschon.vocabulary.format import FormatKeyword, format_validator
from tests.strategies import jsonpointer
Expand Down
8 changes: 4 additions & 4 deletions tests/test_json.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import json as jsonlib
import pathlib
import pytest
import tempfile
from copy import deepcopy
from random import randint

import pytest
from hypothesis import assume, given, strategies as hs
from pytest_httpserver import HTTPServer
from random import randint

from jschon import JSON, JSONCompatible, JSONError, JSONPatch, JSONPointer
from jschon import JSON, JSONCompatible, JSONPatch, JSONPointer
from jschon.exc import JSONError
from jschon.json import false, null, true
from jschon.utils import json_loadf
from tests.strategies import json, jsonflatarray, jsonflatobject, jsonleaf, jsonnumber, jsonstring
Expand Down
5 changes: 2 additions & 3 deletions tests/test_jsonpatch.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import pathlib
from copy import deepcopy

import pytest
from copy import deepcopy

from jschon.exceptions import JSONPatchError
from jschon.exc import JSONPatchError
from jschon.jsonpatch import JSONPatch, JSONPatchOperation
from jschon.utils import json_loadf

Expand Down
11 changes: 6 additions & 5 deletions tests/test_metaschema.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import pytest

from jschon import JSONSchemaError, URI, create_catalog
from jschon import URI, create_catalog
from jschon.exc import JSONSchemaError
from jschon.vocabulary import Metaschema
from tests import (
metaschema_uri_2020_12,
core_vocab_uri_2019_09, core_vocab_uri_2020_12, core_vocab_uri_next,
)
from tests import core_vocab_uri_2020_12, core_vocab_uri_next, metaschema_uri_2020_12


@pytest.mark.parametrize('vocab_data', [
None,
Expand Down Expand Up @@ -33,6 +32,7 @@ def test_metaschema_no_core(vocab_data):
with pytest.raises(JSONSchemaError):
Metaschema(catalog, metaschema_data, uri=URI(metaschema_id))


def test_detect_core(catalog):
metaschema_id = 'https://example.com/meta'
metaschema_uri = URI(metaschema_id)
Expand All @@ -51,6 +51,7 @@ def test_detect_core(catalog):
assert m1 is m
assert m2 is m


def test_default_core(catalog):
metaschema_id = 'https://example.com/meta'
metaschema_uri = URI(metaschema_id)
Expand Down
3 changes: 2 additions & 1 deletion tests/test_vocabulary.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import pytest

from jschon import URIError, JSONSchema, JSON
from jschon import JSON, JSONSchema
from jschon.exc import URIError


def test_unknown_keyword_json_unwrapping():
Expand Down

0 comments on commit df3c840

Please sign in to comment.