| Index: abp/filters/rpy.py |
| =================================================================== |
| --- a/abp/filters/rpy.py |
| +++ b/abp/filters/rpy.py |
| @@ -93,3 +93,32 @@ |
| """ |
| return strings2utf8(tuple2dict(parse_line(text, mode))) |
| + |
| + |
| +def lines2dict(string_list, mode='start'): |
| + """Convert a list of filterlist strings to a dictionary. |
| + |
| + All strings in the output dictionary will be UTF8 byte strings. This is |
| + necessary to prevent unicode encoding errors in rPython conversion layer. |
| + |
| + Parameters |
| + ---------- |
| + string_list: iterable of str |
| + Each string in the list can be a header, metadata, empty line, |
| + include instruction, or filter. |
| + mode: str |
| + Parsing mode. Note: The default is 'start' in case any of the filters |
|
Vasily Kuznetsov
2019/01/24 13:27:59
I think the default should be 'body'. The data tea
rhowell
2019/01/25 00:30:07
Done.
|
| + are a header or metadata. For more information, see |
| + `abp.filters.parser.parse_line` |
| + |
| + Returns |
| + ------- |
| + dict |
|
Vasily Kuznetsov
2019/01/24 13:27:59
If I understand it right, the output should be a l
rhowell
2019/01/25 00:30:07
Done.
|
| + With the parsing results and all strings converted to utf8 byte |
| + strings. |
| + |
| + """ |
| + result = {} |
| + for string in string_list: |
| + result[string] = line2dict(string, mode) |
| + return result |