Skip to content

Commit

Permalink
Merge pull request #1637 from braingram/remove_legacy_extension_api
Browse files Browse the repository at this point in the history
Remove legacy extension api
  • Loading branch information
braingram authored Sep 29, 2023
2 parents 1201a46 + fbcc1f9 commit acdfd9b
Show file tree
Hide file tree
Showing 36 changed files with 597 additions and 2,894 deletions.
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ The ASDF Standard is at v1.6.0

- Add support for python 3.12 [#1641]
- Move IntegerType to converter and drop cache of converted values. [#1527]
- Remove legacy extension API [#1637]

2.15.1 (2023-08-07)
-------------------
Expand Down
171 changes: 0 additions & 171 deletions asdf/_resolver.py

This file was deleted.

43 changes: 3 additions & 40 deletions asdf/_tests/_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,9 @@

import asdf
from asdf import generic_io, versioning
from asdf._resolver import Resolver, ResolverChain
from asdf.asdf import AsdfFile, get_asdf_library_info
from asdf.constants import YAML_TAG_PREFIX
from asdf.exceptions import AsdfConversionWarning, AsdfDeprecationWarning
from asdf.extension import _legacy
from asdf.exceptions import AsdfConversionWarning
from asdf.tags.core import AsdfObject
from asdf.versioning import (
AsdfVersion,
Expand Down Expand Up @@ -97,20 +95,14 @@ def assert_tree_match(old_tree, new_tree, ctx=None, funcname="assert_equal", ign
ignore_keys = ["asdf_library", "history"]
ignore_keys = set(ignore_keys)

if ctx is None:
version_string = str(versioning.default_version)
ctx = _legacy.default_extensions.extension_list
else:
version_string = ctx.version_string

def recurse(old, new):
if id(old) in seen or id(new) in seen:
return
seen.add(id(old))
seen.add(id(new))

old_type = ctx._type_index.from_custom_type(type(old), version_string)
new_type = ctx._type_index.from_custom_type(type(new), version_string)
old_type = None
new_type = None

if (
old_type is not None
Expand Down Expand Up @@ -418,35 +410,6 @@ def assert_no_warnings(warning_class=None):
)


def assert_extension_correctness(extension):
"""
Assert that an ASDF extension's types are all correctly formed and
that the extension provides all of the required schemas.
Parameters
----------
extension : asdf._AsdfExtension
The extension to validate
"""
__tracebackhide__ = True

warnings.warn(
"assert_extension_correctness is deprecated and depends "
"on the deprecated type system. Please use the new "
"extension API: "
"https://asdf.readthedocs.io/en/stable/asdf/extending/converters.html",
AsdfDeprecationWarning,
)

resolver = ResolverChain(
Resolver(extension.tag_mapping, "tag"),
Resolver(extension.url_mapping, "url"),
)

for extension_type in extension.types:
_assert_extension_type_correctness(extension, extension_type, resolver)


def _assert_extension_type_correctness(extension, extension_type, resolver):
__tracebackhide__ = True

Expand Down
6 changes: 4 additions & 2 deletions asdf/_tests/commands/tests/test_extension.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import pytest

from asdf.commands import find_extensions
from asdf.versioning import supported_versions


@pytest.mark.parametrize("summary", [True, False])
Expand All @@ -10,7 +11,8 @@ def test_parameter_combinations(summary, tags_only):
find_extensions(summary, tags_only)


def test_builtin_extension_included(capsys):
@pytest.mark.parametrize("standard_version", supported_versions)
def test_builtin_extension_included(capsys, standard_version):
find_extensions(True, False)
captured = capsys.readouterr()
assert "asdf.extension.BuiltinExtension" in captured.out
assert f"core-{standard_version}" in captured.out
2 changes: 0 additions & 2 deletions asdf/_tests/commands/tests/test_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,5 @@ def test_all_tags_present():
tags = {line.strip() for line in iostream.readlines()}

af = AsdfFile()
for tag in af._type_index._type_by_tag:
assert tag in tags
for tag in af.extension_manager._converters_by_tag:
assert tag in tags
11 changes: 0 additions & 11 deletions asdf/_tests/data/custom_flow-1.0.0.yaml

This file was deleted.

11 changes: 0 additions & 11 deletions asdf/_tests/data/custom_flow-1.1.0.yaml

This file was deleted.

6 changes: 0 additions & 6 deletions asdf/_tests/data/custom_style-1.0.0.yaml

This file was deleted.

55 changes: 0 additions & 55 deletions asdf/_tests/data/default-1.0.0.yaml

This file was deleted.

17 changes: 0 additions & 17 deletions asdf/_tests/data/foreign_tag_reference-1.0.0.yaml

This file was deleted.

Loading

0 comments on commit acdfd9b

Please sign in to comment.