Skip to content

Commit

Permalink
Moved MessageType to io.xml.enums.
Browse files Browse the repository at this point in the history
Signed-off-by: javier.hernandez <javier.hernandez@meaningfuldata.eu>
  • Loading branch information
javihern98 committed May 16, 2024
1 parent 3333945 commit dd2f6cd
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 16 deletions.
16 changes: 16 additions & 0 deletions src/pysdmx/io/xml/enums.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""Enumeration for the XML message types."""

from enum import Enum


class MessageType(Enum):
"""MessageType enumeration.
Enumeration that withholds the Message type for writing purposes.
"""

GenericDataSet = 1
StructureSpecificDataSet = 2
Structure = 3
Error = 4
Submission = 5
3 changes: 2 additions & 1 deletion src/pysdmx/io/xml/sdmx21/writer/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from typing import Any, Dict, Optional

from pysdmx.io.xml.enums import MessageType
from pysdmx.io.xml.sdmx21.writer.__write_aux import (
__write_header,
create_namespaces,
Expand All @@ -10,7 +11,7 @@
from pysdmx.io.xml.sdmx21.writer.structure import (
generate_structures,
)
from pysdmx.model.message import Header, MessageType
from pysdmx.model.message import Header


def writer(
Expand Down
3 changes: 2 additions & 1 deletion src/pysdmx/io/xml/sdmx21/writer/__write_aux.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
from collections import OrderedDict
from typing import Any, Dict, Optional

from pysdmx.model.message import Header, MessageType
from pysdmx.io.xml.enums import MessageType
from pysdmx.model.message import Header

MESSAGE_TYPE_MAPPING = {
MessageType.GenericDataSet: "GenericData",
Expand Down
13 changes: 0 additions & 13 deletions src/pysdmx/model/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,6 @@
from msgspec import Struct


class MessageType(Enum):
"""MessageType enumeration.
Enumeration that withholds the Message type for writing purposes.
"""

GenericDataSet = 1
StructureSpecificDataSet = 2
Structure = 3
Error = 4
Submission = 5


class ActionType(Enum):
"""ActionType enumeration.
Expand Down
2 changes: 1 addition & 1 deletion tests/io/xml/sdmx21/writer/test_structures_writing.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@

import pytest

from pysdmx.io.xml.enums import MessageType
from pysdmx.io.xml.sdmx21.writer import Header, writer
from pysdmx.model import Agency, Code, Codelist, Concept, ConceptScheme
from pysdmx.model.__base import Annotation
from pysdmx.model.message import MessageType

TEST_CS_URN = (
"urn:sdmx:org.sdmx.infomodel.conceptscheme."
Expand Down

0 comments on commit dd2f6cd

Please sign in to comment.