##// END OF EJS Templates
Specify unicode type properly in rmagic
Thomas Kluyver -
Show More
@@ -72,7 +72,8 b' from IPython.core.magic_arguments import ('
72 72 argument, magic_arguments, parse_argstring
73 73 )
74 74 from IPython.external.simplegeneric import generic
75 from IPython.utils.py3compat import str_to_unicode, unicode_to_str, PY3
75 from IPython.utils.py3compat import (str_to_unicode, unicode_to_str, PY3,
76 unicode_type)
76 77
77 78 class RInterpreterError(ri.RRuntimeError):
78 79 """An error when running R code in a %%R magic cell."""
@@ -390,7 +391,7 b' class RMagics(Magics):'
390 391 help='Convert these objects to data.frames and return as structured arrays.'
391 392 )
392 393 @argument(
393 '-u', '--units', type=unicode, choices=["px", "in", "cm", "mm"],
394 '-u', '--units', type=unicode_type, choices=["px", "in", "cm", "mm"],
394 395 help='Units of png plotting device sent as an argument to *png* in R. One of ["px", "in", "cm", "mm"].'
395 396 )
396 397 @argument(
@@ -84,6 +84,7 b' if sys.version_info[0] >= 3:'
84 84 cast_bytes_py2 = no_code
85 85
86 86 string_types = (str,)
87 unicode_type = str
87 88
88 89 def isidentifier(s, dotted=False):
89 90 if dotted:
@@ -134,6 +135,7 b' else:'
134 135 cast_bytes_py2 = cast_bytes
135 136
136 137 string_types = (str, unicode)
138 unicode_type = unicode
137 139
138 140 import re
139 141 _name_re = re.compile(r"[a-zA-Z_][a-zA-Z0-9_]*$")
General Comments 0
You need to be logged in to leave comments. Login now