(s)
| 1243 | |
| 1244 | |
| 1245 | def decistmt(s): |
| 1246 | result = [] |
| 1247 | g = tokenize.tokenize(BytesIO(s.encode('utf-8')).readline) # tokenize the string |
| 1248 | for toknum, tokval, _, _, _ in g: |
| 1249 | if toknum == tokenize.NUMBER and '.' in tokval: # replace NUMBER tokens |
| 1250 | result.extend([ |
| 1251 | (tokenize.NAME, 'Decimal'), |
| 1252 | (tokenize.OP, '('), |
| 1253 | (tokenize.STRING, repr(tokval)), |
| 1254 | (tokenize.OP, ')') |
| 1255 | ]) |
| 1256 | else: |
| 1257 | result.append((toknum, tokval)) |
| 1258 | return tokenize.untokenize(result).decode('utf-8').strip() |
| 1259 | |
| 1260 | class TestMisc(TestCase): |
| 1261 |
no test coverage detected
searching dependent graphs…