diff --git a/weldx/asdf/types.py b/weldx/asdf/types.py index 82a131515..e51eec2c6 100644 --- a/weldx/asdf/types.py +++ b/weldx/asdf/types.py @@ -3,7 +3,12 @@ import functools import re -from asdf.asdf import SerializationContext +import asdf + +if asdf.__version__ > "3.0.0": + from asdf.extension import SerializationContext +else: + from asdf.asdf import SerializationContext from asdf.extension import Converter from asdf.versioning import AsdfSpec from boltons.iterutils import remap diff --git a/weldx/asdf/util.py b/weldx/asdf/util.py index a608b5de1..90dbc9d41 100644 --- a/weldx/asdf/util.py +++ b/weldx/asdf/util.py @@ -11,7 +11,11 @@ import asdf import pint -from asdf.asdf import SerializationContext + +if asdf.__version__ > "3.0.0": + from asdf.extension import SerializationContext +else: + from asdf.asdf import SerializationContext from asdf.config import AsdfConfig, get_config from asdf.extension import Extension from asdf.tagged import TaggedDict, TaggedList, TaggedString @@ -495,7 +499,7 @@ def from_yaml_tree( def get_weldx_extension(ctx: SerializationContext | AsdfConfig) -> Extension: """Grab the weldx extension from list of current active extensions.""" - if isinstance(ctx, asdf.asdf.SerializationContext): + if isinstance(ctx, SerializationContext): extensions = ctx.extension_manager.extensions elif isinstance(ctx, asdf.config.AsdfConfig): extensions = ctx.extensions diff --git a/weldx/tags/base_types.py b/weldx/tags/base_types.py index 6bb6bc582..1fc9fd712 100644 --- a/weldx/tags/base_types.py +++ b/weldx/tags/base_types.py @@ -2,7 +2,12 @@ from uuid import UUID -from asdf.asdf import SerializationContext +import asdf + +if asdf.__version__ > "3.0.0": + from asdf.extension import SerializationContext +else: + from asdf.asdf import SerializationContext from weldx.asdf.types import WeldxConverter