Commits

Georg Brandl committed 239430a

Recognize and correctly handle "// unit" lines, which are now preprocessed by IPython to "(/, unit)".

Comments (0)

Files changed (1)

 
 inline_unit_re = re.compile(r'\((%s)\)' % quantity)
 slash_conv_re = re.compile(r'^(.*?)//\s*%s$' % unit)
+slash_last_re = re.compile(r'^()\(/, %s\)$' % unit)
 trailing_conv_re = re.compile(r'\s*//\s*%s$' % unit)
 nice_assign_re = re.compile(r'^%s\s*=\s*(%s)$' % (name, quantity))
 quantity_re = re.compile(quantity)
         if not continue_prompt:
             line = slash_conv_re.sub(replace_slash, line)
             line = nice_assign_re.sub(replace_assign, line)
+            # lines that look like ``(/, unit)`` have been ``// unit`` but
+            # already preprocessed by IPython, let's recognize them
+            line = slash_last_re.sub(replace_slash, line)
         return line