MCPcopy Index your code
hub / github.com/numpy/numpy / cracktypespec

Function cracktypespec

numpy/f2py/crackfortran.py:1835–1889  ·  view source on GitHub ↗
(typespec, selector)

Source from the content-addressed store, hash-verified

1833
1834
1835def cracktypespec(typespec, selector):
1836 kindselect = None
1837 charselect = None
1838 typename = None
1839 if selector:
1840 if typespec in ['complex', 'integer', 'logical', 'real']:
1841 kindselect = kindselector.match(selector)
1842 if not kindselect:
1843 outmess(
1844 f'cracktypespec: no kindselector pattern found for {repr(selector)}\n')
1845 return
1846 kindselect = kindselect.groupdict()
1847 kindselect['*'] = kindselect['kind2']
1848 del kindselect['kind2']
1849 for k in list(kindselect.keys()):
1850 if not kindselect[k]:
1851 del kindselect[k]
1852 for k, i in list(kindselect.items()):
1853 kindselect[k] = rmbadname1(i)
1854 elif typespec == 'character':
1855 charselect = charselector.match(selector)
1856 if not charselect:
1857 outmess(
1858 f'cracktypespec: no charselector pattern found for {repr(selector)}\n')
1859 return
1860 charselect = charselect.groupdict()
1861 charselect['*'] = charselect['charlen']
1862 del charselect['charlen']
1863 if charselect['lenkind']:
1864 lenkind = lenkindpattern.match(
1865 markoutercomma(charselect['lenkind']))
1866 lenkind = lenkind.groupdict()
1867 for lk in ['len', 'kind']:
1868 if lenkind[lk + '2']:
1869 lenkind[lk] = lenkind[lk + '2']
1870 charselect[lk] = lenkind[lk]
1871 del lenkind[lk + '2']
1872 if lenkind['f2py_len'] is not None:
1873 # used to specify the length of assumed length strings
1874 charselect['f2py_len'] = lenkind['f2py_len']
1875 del charselect['lenkind']
1876 for k in list(charselect.keys()):
1877 if not charselect[k]:
1878 del charselect[k]
1879 for k, i in list(charselect.items()):
1880 charselect[k] = rmbadname1(i)
1881 elif typespec == 'type':
1882 typename = re.match(r'\s*\(\s*(?P<name>\w+)\s*\)', selector, re.I)
1883 if typename:
1884 typename = typename.group('name')
1885 else:
1886 outmess(f'cracktypespec: no typename found in {typespec + selector}\n')
1887 else:
1888 outmess(f'cracktypespec: no selector used for {repr(selector)}\n')
1889 return kindselect, charselect, typename
1890######
1891
1892

Callers 3

analyzelineFunction · 0.85
updatevarsFunction · 0.85
analyzevarsFunction · 0.85

Calls 5

rmbadname1Function · 0.85
markoutercommaFunction · 0.85
itemsMethod · 0.80
outmessFunction · 0.70
keysMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…