tests: add moultipart.py
Add moultipart.py, a Python module to help read text files meant to be
split in different parts. A moultipart-compliant file is a succession
of parts, where each part is made of a header line followed with zero or
more lines of content.
A header line consists of `---` optionally followed by a space and some
custom information.
The moultipart module exposes the `parse` function, which takes a TextIO
object and returns a list of Part objects.
For instance, the following input:
--- Victoria
Parenteau
---
Taillon
--- This part is empty
--- Josianne
Gervais
results in the following parts:
[Part('Victoria', 'Parenteau\n', 2),
Part('', 'Taillon\n', 4),
Part('This part is empty', '', 6),
Part('Josianne', 'Gervais\n', 7)]
Change-Id: I50fb88ed6e064c09deaf1d56187415bc26002a14
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/10912
Tested-by: jenkins <jenkins@lttng.org>
This page took 0.037068 seconds and 4 git commands to generate.