8000 MAINT: Add a helper · numpy/numpy@3d58d8c · GitHub
[go: up one dir, main page]

Skip to content

Commit 3d58d8c

Browse files
committed
MAINT: Add a helper
1 parent e2288b3 commit 3d58d8c

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

numpy/f2py/auxfuncs.py

Lines changed: 9 additions & 1 deletion
Original file l 8000 ine numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"""
1717
import pprint
1818
import sys
19+
import re
1920
import types
2021
from functools import reduce
2122

@@ -26,7 +27,7 @@
2627
'applyrules', 'debugcapi', 'dictappend', 'errmess', 'gentitle',
2728
'getargs2', 'getcallprotoargument', 'getcallstatement',
2829
'getfortranname', 'getpymethoddef', 'getrestdoc', 'getusercode',
29-
'getusercode1', 'hasbody', 'hascallstatement', 'hascommon',
30+
'getusercode1', 'getdimension', 'hasbody', 'hascallstatement', 'hascommon',
3031
'hasexternals', 'hasinitvalue', 'hasnote', 'hasresultnote',
3132
'isallocatable', 'isarray', 'isarrayofstrings',
3233
'ischaracter', 'ischaracterarray', 'ischaracter_or_characterarray',
@@ -417,6 +418,13 @@ def isexternal(var):
417418
return 'attrspec' in var and 'external' in var['attrspec']
418419

419420

421+
def getdimension(var):
422+
dimpattern = r"\((.*?)\)"
423+
if 'attrspec' in var.keys():
424+
if any('dimension' in s for s in var['attrspec']):
425+
return [re.findall(dimpattern, v) for v in var['attrspec']][0]
426+
427+
420428
def isrequired(var):
421429
return not isoptional(var) and isintent_nothide(var)
422430

0 commit comments

Comments
 (0)
0