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

Unified Diff: abp/filters/rpy.py

Issue 30047570: Issue 7467 - Migrate rpy to Python 3 (Closed) Base URL: https://hg.adblockplus.org/python-abp
Patch Set: Created April 18, 2019, 12:15 a.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 | « no previous file | tests/test_rpy.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
@@ -19,8 +19,6 @@
see: https://cran.r-project.org/web/packages/rPython/index.html
"""
-from __future__ import unicode_literals
-
from abp.filters import parse_line
__all__ = ['line2dict']
@@ -70,30 +68,6 @@
return result
-def strings2utf8(data):
- """Convert strings in a data structure to utf8 byte strings.
-
- Parameters
- ----------
- data: dict
- The data to convert. Can include nested dicts, lists and tuples.
-
- Returns
- -------
- dict
- With all strings encoded as unicode.
-
- """
- if isinstance(data, dict):
- return {strings2utf8(k): strings2utf8(v) for k, v in data.items()}
- if isinstance(data, list):
- return [strings2utf8(v) for v in data]
- if isinstance(data, type('')):
- # The condition is a Python 2/3 way of saying "unicode string".
- return data.encode('utf-8')
- return data
-
-
def line2dict(text, mode='body'):
"""Convert a filterlist line to a dictionary.
@@ -114,7 +88,7 @@
strings.
"""
- return strings2utf8(tuple2dict(parse_line(text, mode)))
+ return tuple2dict(parse_line(text, mode))
def lines2dicts(string_list, mode='body'):
« no previous file with comments | « no previous file | tests/test_rpy.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld