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

Function param_parse

numpy/f2py/crackfortran.py:3028–3105  ·  view source on GitHub ↗

Recursively parse array dimensions. Parses the declaration of an array variable or parameter `dimension` keyword, and is called recursively if the dimension for this array is a previously defined parameter (found in `params`). Parameters ---------- d : str Fortr

(d, params)

Source from the content-addressed store, hash-verified

3026
3027
3028def param_parse(d, params):
3029 """Recursively parse array dimensions.
3030
3031 Parses the declaration of an array variable or parameter
3032 `dimension` keyword, and is called recursively if the
3033 dimension for this array is a previously defined parameter
3034 (found in `params`).
3035
3036 Parameters
3037 ----------
3038 d : str
3039 Fortran expression describing the dimension of an array.
3040 params : dict
3041 Previously parsed parameters declared in the Fortran source file.
3042
3043 Returns
3044 -------
3045 out : str
3046 Parsed dimension expression.
3047
3048 Examples
3049 --------
3050
3051 * If the line being analyzed is
3052
3053 `integer, parameter, dimension(2) :: pa = (/ 3, 5 /)`
3054
3055 then `d = 2` and we return immediately, with
3056
3057 >>> d = '2'
3058 >>> param_parse(d, params)
3059 2
3060
3061 * If the line being analyzed is
3062
3063 `integer, parameter, dimension(pa) :: pb = (/1, 2, 3/)`
3064
3065 then `d = 'pa'`; since `pa` is a previously parsed parameter,
3066 and `pa = 3`, we call `param_parse` recursively, to obtain
3067
3068 >>> d = 'pa'
3069 >>> params = {'pa': 3}
3070 >>> param_parse(d, params)
3071 3
3072
3073 * If the line being analyzed is
3074
3075 `integer, parameter, dimension(pa(1)) :: pb = (/1, 2, 3/)`
3076
3077 then `d = 'pa(1)'`; since `pa` is a previously parsed parameter,
3078 and `pa(1) = 3`, we call `param_parse` recursively, to obtain
3079
3080 >>> d = 'pa(1)'
3081 >>> params = dict(pa={1: 3, 2: 5})
3082 >>> param_parse(d, params)
3083 3
3084 """
3085 if "(" in d:

Callers 2

analyzevarsFunction · 0.85
param_evalFunction · 0.85

Calls 3

findMethod · 0.80
rfindMethod · 0.80
compileMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…