8000 MAINT: Cleanup solution · numpy/numpy@f099fc1 · GitHub
[go: up one dir, main page]

Skip to content

Commit f099fc1

Browse files
committed
MAINT: Cleanup solution
1 parent 123ed3d commit f099fc1

File tree

1 file changed

+16
-25
lines changed

1 file changed

+16
-25
lines changed

numpy/f2py/crackfortran.py

Lines changed: 16 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1375,7 +1375,7 @@ def analyzeline(m, case, line):
13751375
value = ''
13761376
init_list = ''
13771377
state = 0
1378-
quote_open = 1
1378+
quote_open = True
13791379
paren_open = 0
13801380

13811381
for c in m.group('after'):
@@ -1429,30 +1429,21 @@ def analyzeline(m, case, line):
14291429
# Ignoring since data statements are irrelevant for
14301430
# wrapping.
14311431
continue
1432-
fc = 0
1433-
pair_type = groupcache[groupcounter]['vars'][pair[0]]['typespec']
1434-
if pair_type == 'complex':
1435-
while (index < llen):
1436-
if pair[1][index] == "'":
1437-
fc = not fc
1438-
index = index + 1
1439-
index = index + 1
1440-
if name not in variables:
1441-
variables[name] = {}
1442-
if '=' in variables[name] and not variables[name]['='] == pair[1][end_index:index - 1]:
1443-
outmess('analyzeline: changing init expression of "%s" ("%s") to "%s"\n' % (
1444-
name, variables[name]['='], pair[1][end_index:index - 1]))
1445-
else:
1446-
while (index < llen) and (fc or not pair[1][index] == ','):
1447-
if pair[1][index] == "'":
1448-
fc = not fc
1449-
index = index + 1
1450-
index = index + 1
1451-
if name not in variables:
1452-
variables[name] = {}
1453-
if '=' in variables[name] and not variables[name]['='] == pair[1][end_index:index - 1]:
1454-
outmess('analyzeline: changing init expression of "%s" ("%s") to "%s"\n' % (
1455-
name, variables[name]['='], pair[1][end_index:index - 1]))
1432+
quote_open = 0
1433+
try:
1434+
pair_type = groupcache[groupcounter]['vars'][pair[0]]['typespec']
1435+
except KeyError:
1436+
pair_type = None
1437+
while index < llen and (pair_type == 'complex' or (quote_open or pair[1][index] != ',')):
1438+
if pair[1][index] == "'":
1439+
quote_open = not quote_open
1440+
index += 1
1441+
index = index + 1
1442+
if name not in variables:
1443+
variables[name] = {}
1444+
if '=' in variables[name] and not variables[name]['='] == pair[1][end_index:index - 1]:
1445+
outmess('analyzeline: changing init expression of "%s" ("%s") to "%s"\n' % (
1446+
name, variables[name]['='], pair[1][end_index:index - 1]))
14561447
variables[name]['='] = pair[1][end_index:index - 1]
14571448
end_index = index
14581449
last_variable = name

0 commit comments

Comments
 (0)
0