File tree Expand file tree Collapse file tree 1 file changed +21
-2
lines changed Expand file tree Collapse file tree 1 file changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -1357,14 +1357,33 @@ cdef class TextReader:
1357
1357
1358
1358
coliter_setup(& it, self .parser, col, start)
1359
1359
1360
+ ignored_chars = b" +-"
1361
+ digits = b" 0123456789"
1362
+ float_indicating_chars = {self .parser.decimal, b" e" , b" E" }
1363
+
1360
1364
for i in range (lines):
1361
1365
COLITER_NEXT(it, word)
1362
1366
1363
1367
if na_filter and kh_get_str_starts_item(na_hashset, word):
1364
1368
continue
1365
1369
1366
- if self .parser.decimal in word or b" e" in word or b" E" in word:
1367
- return True
1370
+ found_first_digit = False
1371
+ for c in word:
1372
+ if not found_first_digit and c in ignored_chars:
1373
+ continue
1374
+ elif not found_first_digit and c not in digits:
1375
+ # word isn't numeric
1376
+ return False
1377
+ elif not found_first_digit:
1378
+ found_first_digit = True
1379
+ elif c in float_indicating_chars:
1380
+ # preceding chars indicates numeric and
1381
+ # current char indicates float
1382
+ return True
1383
+ elif c not in digits:
1384
+ # previous characters indicates numeric
1385
+ # current character shows otherwise
1386
+ return False
1368
1387
1369
1388
return False
1370
1389
You can’t perform that action at this time.
0 commit comments