We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 061ec2d commit ba426edCopy full SHA for ba426ed
pydifact/segmentcollection.py
@@ -395,6 +395,25 @@ def from_segments(
395
396
return cls(reference_number, identifier).add_segments(segments)
397
398
+ @classmethod
399
+ def from_str(cls, string: str) -> "AbstractSegmentsContainer":
400
+ segments = Parser().parse(string)
401
+
402
+ unh = None
403
+ todo = []
404
405
+ for segment in segments:
406
+ if segment.tag == "UNH":
407
+ unh = segment
408
+ continue
409
+ if segment.tag == "UNT":
410
411
+ todo.append(segment)
412
413
+ if not unh:
414
+ raise EDISyntaxError("Missing header in message")
415
+ return cls.from_segments(unh[0], unh[1], todo)
416
417
418
class Interchange(FileSourcableMixin, UNAHandlingMixin, AbstractSegmentsContainer):
419
"""
0 commit comments