From 3d9dec53d1a337be1de3c0765337720e0f41d191 Mon Sep 17 00:00:00 2001 From: Laurent MICHEL Date: Sun, 15 Dec 2024 16:18:56 +0100 Subject: [PATCH] import viewer explicitely because pyvo.mivot.viewer is no longer the default pyvo.mivot content code stye add license --- pyvo/mivot/tests/test_annotation_seeker.py | 2 +- pyvo/mivot/tests/test_mivot_instance.py | 2 +- pyvo/mivot/tests/test_mivot_instance_generation.py | 2 +- pyvo/mivot/tests/test_mivot_viewer.py | 2 +- pyvo/mivot/tests/test_static_reference.py | 2 +- pyvo/mivot/tests/test_user_api.py | 2 +- pyvo/mivot/tests/test_vizier_cs.py | 2 +- pyvo/mivot/tests/test_xml_viewer.py | 2 +- pyvo/mivot/viewer/__init__.py | 1 + pyvo/mivot/writer/annotations.py | 9 +++++---- pyvo/mivot/writer/instance.py | 7 ++++--- 11 files changed, 18 insertions(+), 15 deletions(-) diff --git a/pyvo/mivot/tests/test_annotation_seeker.py b/pyvo/mivot/tests/test_annotation_seeker.py index 86ad4c73..fd741eed 100644 --- a/pyvo/mivot/tests/test_annotation_seeker.py +++ b/pyvo/mivot/tests/test_annotation_seeker.py @@ -11,7 +11,7 @@ from pyvo.mivot.seekers.annotation_seeker import AnnotationSeeker from pyvo.mivot.utils.dict_utils import DictUtils from pyvo.mivot.version_checker import check_astropy_version -from pyvo.mivot import MivotViewer +from pyvo.mivot.viewer import MivotViewer from . import XMLOutputChecker diff --git a/pyvo/mivot/tests/test_mivot_instance.py b/pyvo/mivot/tests/test_mivot_instance.py index 1e314bf4..81607ff8 100644 --- a/pyvo/mivot/tests/test_mivot_instance.py +++ b/pyvo/mivot/tests/test_mivot_instance.py @@ -11,7 +11,7 @@ from pyvo.mivot.version_checker import check_astropy_version from pyvo.mivot.viewer.mivot_instance import MivotInstance from pyvo.mivot.utils.mivot_utils import MivotUtils -from pyvo.mivot import MivotViewer +from pyvo.mivot.viewer import MivotViewer fake_hk_dict = { "dmtype": "EpochPosition", diff --git a/pyvo/mivot/tests/test_mivot_instance_generation.py b/pyvo/mivot/tests/test_mivot_instance_generation.py index cab728ae..ea2ffb85 100644 --- a/pyvo/mivot/tests/test_mivot_instance_generation.py +++ b/pyvo/mivot/tests/test_mivot_instance_generation.py @@ -6,7 +6,7 @@ import pytest from urllib.request import urlretrieve from pyvo.mivot.version_checker import check_astropy_version -from pyvo.mivot import MivotViewer +from pyvo.mivot.viewer import MivotViewer from pyvo.mivot.utils.mivot_utils import MivotUtils diff --git a/pyvo/mivot/tests/test_mivot_viewer.py b/pyvo/mivot/tests/test_mivot_viewer.py index 20fb63f8..ff79da42 100644 --- a/pyvo/mivot/tests/test_mivot_viewer.py +++ b/pyvo/mivot/tests/test_mivot_viewer.py @@ -10,7 +10,7 @@ from pyvo.mivot.utils.dict_utils import DictUtils from pyvo.mivot.utils.exceptions import MappingError from pyvo.mivot.version_checker import check_astropy_version -from pyvo.mivot import MivotViewer +from pyvo.mivot.viewer import MivotViewer from astropy import version as astropy_version diff --git a/pyvo/mivot/tests/test_static_reference.py b/pyvo/mivot/tests/test_static_reference.py index 82bce325..1c5096f5 100644 --- a/pyvo/mivot/tests/test_static_reference.py +++ b/pyvo/mivot/tests/test_static_reference.py @@ -7,7 +7,7 @@ from pyvo.mivot.seekers.annotation_seeker import AnnotationSeeker from pyvo.mivot.features.static_reference_resolver import StaticReferenceResolver from pyvo.mivot.version_checker import check_astropy_version -from pyvo.mivot import MivotViewer +from pyvo.mivot.viewer import MivotViewer from . import XMLOutputChecker diff --git a/pyvo/mivot/tests/test_user_api.py b/pyvo/mivot/tests/test_user_api.py index 04277c0e..67a74a80 100644 --- a/pyvo/mivot/tests/test_user_api.py +++ b/pyvo/mivot/tests/test_user_api.py @@ -12,7 +12,7 @@ from astropy.coordinates import SkyCoord from pyvo.dal.scs import SCSService from pyvo.mivot.version_checker import check_astropy_version -from pyvo.mivot import MivotViewer +from pyvo.mivot.viewer import MivotViewer from astropy.io.votable import parse from pyvo.mivot.utils.dict_utils import DictUtils diff --git a/pyvo/mivot/tests/test_vizier_cs.py b/pyvo/mivot/tests/test_vizier_cs.py index 573430ce..72fff1cf 100644 --- a/pyvo/mivot/tests/test_vizier_cs.py +++ b/pyvo/mivot/tests/test_vizier_cs.py @@ -20,7 +20,7 @@ import pytest from urllib.request import urlretrieve from pyvo.mivot.version_checker import check_astropy_version -from pyvo.mivot import MivotViewer +from pyvo.mivot.viewer import MivotViewer from pyvo.mivot.utils.exceptions import MivotError diff --git a/pyvo/mivot/tests/test_xml_viewer.py b/pyvo/mivot/tests/test_xml_viewer.py index e0dde04e..8ff8f667 100644 --- a/pyvo/mivot/tests/test_xml_viewer.py +++ b/pyvo/mivot/tests/test_xml_viewer.py @@ -9,7 +9,7 @@ from xml.etree.ElementTree import Element as element from astropy.utils.data import get_pkg_data_filename from pyvo.mivot.version_checker import check_astropy_version -from pyvo.mivot import MivotViewer +from pyvo.mivot.viewer import MivotViewer from pyvo.mivot.utils.exceptions import MivotError diff --git a/pyvo/mivot/viewer/__init__.py b/pyvo/mivot/viewer/__init__.py index 998961af..0ca6afaf 100644 --- a/pyvo/mivot/viewer/__init__.py +++ b/pyvo/mivot/viewer/__init__.py @@ -1,2 +1,3 @@ +# Licensed under a 3-clause BSD style license - see LICENSE.rst from .mivot_instance import MivotInstance from .mivot_viewer import MivotViewer diff --git a/pyvo/mivot/writer/annotations.py b/pyvo/mivot/writer/annotations.py index 76dbdcdc..61200980 100644 --- a/pyvo/mivot/writer/annotations.py +++ b/pyvo/mivot/writer/annotations.py @@ -29,16 +29,17 @@ __all__ = ["MivotAnnotations"] + @prototype_feature("MIVOT") class MivotAnnotations: """ This module provides a class to construct, validate, and insert MIVOT - blocks into VOTable files. + blocks into VOTable files. The MIVOT block, represented as an XML structure, is used for data model annotations in the IVOA ecosystem. - + The main features are: - + - Construct the MIVOT block step-by-step with various components. - Validate the MIVOT block against the MIVOT XML schema (if ``xmlschema`` is installed). - Embed the MIVOT block into an existing VOTable file. @@ -281,7 +282,7 @@ def check_xml(self): """ # put here just to improve the test coverage root = etree.fromstring(self._mivot_block) - mivot_block = XmlUtils.pretty_string(root, clean_ns=False) + mivot_block = XmlUtils.pretty_string(root, clean_namespace=False) if not xmlschema: logging.error( "XML validation skipped: no XML schema found. " diff --git a/pyvo/mivot/writer/instance.py b/pyvo/mivot/writer/instance.py index c19e7c10..6c04a1d6 100644 --- a/pyvo/mivot/writer/instance.py +++ b/pyvo/mivot/writer/instance.py @@ -8,6 +8,7 @@ __all__ = ["MivotInstance"] + @prototype_feature("MIVOT") class MivotInstance: """ @@ -16,19 +17,19 @@ class MivotInstance: This class provides methods for incremental construction of a MIVOT instance. It builds elements that can contain , , and . Support for elements is not yet implemented. - + The main features are: - Model-agnostic: The implementation is independent of any specific data model. - Syntax validation: Ensures basic MIVOT syntax rules are followed. - Context-agnostic: Ignores context-dependent syntax rules. - + attributes ---------- _dmtype : string Instance type (class VO-DML ID) _dmrole : string - Role played by the instance in the context where it is used + Role played by the instance in the context where it is used (given by the VO-DML serialization of the model) _dmid : string Free identifier of the instance