Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: abp/filters/rpy.py

Issue 29880577: Issue 6877 - Only parse headers in the first line of the filter list (Closed)
Patch Set: Fix header parsing, improve argument naming and documentation Created Sept. 18, 2018, 6:06 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « abp/filters/parser.py ('k') | tests/test_parser.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: abp/filters/rpy.py
===================================================================
--- a/abp/filters/rpy.py
+++ b/abp/filters/rpy.py
@@ -67,27 +67,29 @@
if isinstance(data, tuple):
return tuple(strings2utf8(v) for v in data)
if isinstance(data, type('')): # Python 2/3 compatible way of
# saying "unicode string".
return data.encode('utf-8')
return data
-def line2dict(text):
+def line2dict(text, mode='body'):
"""Convert a filterlist line 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
----------
text: str
The filter text we want to parse
+ mode: str
+ Parsing mode (see `abp.filters.parser.parse_line`).
Returns
-------
dict
With the parsing results and all strings converted to utf8 byte
strings.
"""
- return strings2utf8(tuple2dict(parse_line(text)))
+ return strings2utf8(tuple2dict(parse_line(text, mode)))
« no previous file with comments | « abp/filters/parser.py ('k') | tests/test_parser.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld