@@ -426,16 +426,17 @@ def validate(self):
426426
427427
428428class Interchange (FileSourcableMixin , UNAHandlingMixin , AbstractSegmentsContainer ):
429- """
430- An interchange (started by UNB_ segment, ended by UNZ_ segment)
429+ """An EDIFACT interchange.
431430
432- Optional features of UNB are not yet supported.
431+ In EDIFACT, the **interchange** is the entire document at the highest level. Except
432+ for its header (a UNB_ segment) and footer (a UNZ_ segment), it consists of one or
433+ more **messages**.
433434
434- Functional groups are not yet supported.
435+ :class:`Interchange` currently does not support functional groups and optional
436+ features of UNB.
435437
436- Messages are supported (see :meth:`get_message`), but are
437- optional: interchange segments can be accessed without going through
438- messages.
438+ :class:`Interchange` supports all methods of :class:`AbstractSegmentsContainer` plus
439+ some additional methods.
439440
440441 .. _UNB: https://www.stylusstudio.com/edifact/40100/UNB_.htm
441442 .. _UNZ: https://www.stylusstudio.com/edifact/40100/UNZ_.htm
@@ -475,11 +476,6 @@ def get_header_segment(self) -> Segment:
475476 )
476477
477478 def get_footer_segment (self ) -> Segment :
478- """:returns a (UNZ) footer segment with correct segment count and control reference.
479-
480- It counts either of the number of messages or, if used, of the number of functional groups
481- in an interchange (TODO)."""
482-
483479 # FIXME: count functional groups (UNG/UNE) correctly
484480 cnt = 0
485481 for segment in self .segments :
@@ -495,11 +491,12 @@ def get_footer_segment(self) -> Segment:
495491 )
496492
497493 def get_messages (self ) -> List [Message ]:
498- """parses a list of messages out of the internal segments .
494+ """Get list of messages in the interchange .
499495
500- :raises EDISyntaxError if constraints are not met (e.g. UNH/UNT both correct)
496+ Using :meth:`get_messages` is optional; interchange segments can be accessed
497+ directly without going through messages.
501498
502- TODO: parts of this here are better done in the validate() method
499+ :raises: :class:`EDISyntaxError` if the interchange contents are not correct.
503500 """
504501
505502 message = None
@@ -531,6 +528,7 @@ def get_messages(self) -> List[Message]:
531528 raise EDISyntaxError ("UNH segment was not closed with a UNT segment." )
532529
533530 def add_message (self , message : Message ) -> "Interchange" :
531+ """Append a message to the interchange."""
534532 segments = (
535533 [message .get_header_segment ()]
536534 + message .segments
0 commit comments