Source code for mt_metadata.transfer_functions.io.emtfxml.metadata.remote_ref

# -*- coding: utf-8 -*-
"""
Created on Mon Sep  6 12:04:35 2021

@author: jpeacock
"""

# =============================================================================
# Imports
# =============================================================================
from xml.etree import cElementTree as et

from mt_metadata.base.helpers import write_lines, element_to_string
from mt_metadata.base import get_schema, Base
from .standards import SCHEMA_FN_PATHS
from mt_metadata.transfer_functions.io.emtfxml.metadata import helpers

# =============================================================================
attr_dict = get_schema("remote_ref", SCHEMA_FN_PATHS)
# =============================================================================


[docs]class RemoteRef(Base): __doc__ = write_lines(attr_dict) def __init__(self, **kwargs): super().__init__(attr_dict=attr_dict, **kwargs)
[docs] def read_dict(self, input_dict): """ :param input_dict: DESCRIPTION :type input_dict: TYPE :return: DESCRIPTION :rtype: TYPE """ helpers._read_element(self, input_dict, "remote_ref")
[docs] def to_xml(self, string=False, required=True): """ :param string: DESCRIPTION, defaults to False :type string: TYPE, optional :param required: DESCRIPTION, defaults to True :type required: TYPE, optional :return: DESCRIPTION :rtype: TYPE """ if self.type is None: self.type = "" root = et.Element(self.__class__.__name__, {"type": self.type}) if string: return element_to_string(root) return root