# HG changeset patch
# User Craig Citro <craigcitro@gmail.com>
# Date 1201494882 28800
# Node ID d0d57a8807f952ba09d35937f4870599ce8bd247
# Parent 60f53181a25b4d1caa945bbdfbc089fde1ddb9eb
Fix annoying ANSI code issue in interfaces/sage0.py.
diff -r 60f53181a25b -r d0d57a8807f9 sage/interfaces/sage0.py
|
a
|
b
|
|
| 147 | 147 | sage: sage0.cputime() # random output |
| 148 | 148 | 1.6462939999999999 |
| 149 | 149 | """ |
| 150 | | return eval(self.eval('cputime(%s)'%t)) |
| | 150 | s = self.eval('cputime(%s)'%t) |
| | 151 | |
| | 152 | if isinstance(s, str): |
| | 153 | ## argh, we have ansi codes ... |
| | 154 | |
| | 155 | ## kill the \n |
| | 156 | s = s[:-1] |
| | 157 | |
| | 158 | ## kill the ansi codes |
| | 159 | while s.find('m') != -1: |
| | 160 | s = s[s.find('m')+1:] |
| | 161 | |
| | 162 | return float(s) |
| | 163 | else: |
| | 164 | return eval(s) |
| 151 | 165 | |
| 152 | 166 | def trait_names(self): |
| 153 | 167 | return eval(self.eval('globals().keys()')) |