openmath/decoder.py
def decode_stream(stream, validator=None, snippet=False):
    """ Decodes a stream into an OpenMath object.

    :param stream: Stream to decode.
    :type stream: Any

    :param validator: Validator to use.

    :param snippet: Is this an OpenMath snippet, or a full object?
    :type snippet: Bool

    :rtype: OMAny
    """

    # TODO: Complete the docstring above

    
    tree = etree.parse(stream)
    if validator is not None:
        validator.assertValid(tree)

    root = tree.getroot()
    v = root.get("version")
    if not snippet and (not v or v != "2.0"):
        raise ValueError("Only OpenMath 2.0 is supported")

    return decode_xml(root)
def decode_stream(stream, validator=None, snippet=False):
    """ Decodes a stream into an OpenMath object.

    :param stream: Stream to decode.
    :type stream: Any

    :param validator: Validator to use.

    :param snippet: Is this an OpenMath snippet, or a full object?
    :type snippet: Bool

    :rtype: OMAny
    """

    # TODO: Complete the docstring above

    
    tree = etree.parse(stream)
    if validator is not None:
        validator.assertValid(tree)

    root = tree.getroot()
    v = root.get("version")
    if not snippet and (not v or v != "2.0"):
        raise ValueError("Only OpenMath 2.0 is supported")

    return decode_xml(root)
Decodes a stream into an OpenMath object.

    :param stream: Stream to decode.
    :type stream: Any

    :param validator: Validator to use.

    :param snippet: Is this an OpenMath snippet, or a full object?
    :type snippet: Bool

    :rtype: OMAny