Repository: numpy/numpy
File: numpy/f2py/capi_maps.py (Python)

Code before:
        init, showinit = getinit(a, var)
        init = f', optional\\n    Default: {showinit}'
    if isscalar(var):
        if isintent_inout(var):
            sig = (f"{a} : {opt} rank-0 array({c2py_map[ctype]},"
                   f"\'{c2pycode_map[ctype]}\'){init}")
        else:
            sig = f'{a} : {opt} {c2py_map[ctype]}{init}'
        sigout = f'{out_a} : {c2py_map[ctype]}'
    elif isstring(var):
        if isintent_inout(var):
            sig = (f"{a} : {opt} rank-0 array(string(len={getstrlength(var)}),"
                   f"\'c\'){init}")
        else:
            sig = f'{a} : {opt} string(len={getstrlength(var)}){init}'
        sigout = f'{out_a} : string(len={getstrlength(var)})'
    elif isarray(var):
        dim = var['dimension']
        rank = repr(len(dim))
        sig = (f"{a} : {opt} rank-{rank} array(\'{c2pycode_map[ctype]}\') with "
               f"bounds ({','.join(dim)}){init}")
        if a == out_a:
            sigout = (f"{a} : rank-{rank} array(\'{c2pycode_map[ctype]}\') with "
                      f"bounds ({','.join(dim)})")
        else:
            sigout = (f"{out_a} : rank-{rank} array(\'{c2pycode_map[ctype]}\') with "
                      f"bounds ({','.join(dim)}) and {a} storage")
    elif isexternal(var):
        ua = ''
        if a in lcb_map and lcb_map[a] in lcb2_map and 'argname' in lcb2_map[lcb_map[a]]:
            ua = lcb2_map[lcb_map[a]]['argname']
            if not ua == a:
                ua = f' => {ua}'
            else:
                ua = ''
        sig = f'{a} : call-back function{ua}'
        sigout = sig
    else:
        errmess(
            f'getpydocsign: Could not resolve docsignature for "{a}".\n')
    return sig, sigout


def getarrdocsign(a, var):
    ctype = getctype(var)
    if isstring(var) and (not isarray(var)):
        sig = f'{a} : rank-0 array(string(len={getstrlength(var)}),\'c\')'
    elif isscalar(var):
        sig = f'{a} : rank-0 array({c2py_map[ctype]},\'{c2pycode_map[ctype]}\')'
    elif isarray(var):
        dim = var['dimension']

Review comment (suggestion):
```suggestion
            sigout = (f"{out_a} : rank-{rank} array('{c2pycode_map[ctype]}') with "
```

Code after:
        init, showinit = getinit(a, var)
        init = f', optional\\n    Default: {showinit}'
    if isscalar(var):
        if isintent_inout(var):
            sig = (f"{a} : {opt} rank-0 array({c2py_map[ctype]},"
                   f"'{c2pycode_map[ctype]}'){init}")
        else:
            sig = f'{a} : {opt} {c2py_map[ctype]}{init}'
        sigout = f'{out_a} : {c2py_map[ctype]}'
    elif isstring(var):
        if isintent_inout(var):
            sig = (f"{a} : {opt} rank-0 array(string(len={getstrlength(var)}),"
                   f"'c'){init}")
        else:
            sig = f'{a} : {opt} string(len={getstrlength(var)}){init}'
        sigout = f'{out_a} : string(len={getstrlength(var)})'
    elif isarray(var):
        dim = var['dimension']
        rank = repr(len(dim))
        dim_str = ','.join(dim)
        sig = (f"{a} : {opt} rank-{rank} array('{c2pycode_map[ctype]}') with "
               f"bounds ({dim_str}){init}")
        if a == out_a:
            sigout = (f"{a} : rank-{rank} array('{c2pycode_map[ctype]}') with "
                      f"bounds ({dim_str})")
        else:
            sigout = (f"{out_a} : rank-{rank} array('{c2pycode_map[ctype]}') with "
                      f"bounds ({dim_str}) and {a} storage")
    elif isexternal(var):
        ua = ''
        if a in lcb_map and lcb_map[a] in lcb2_map and 'argname' in lcb2_map[lcb_map[a]]:
            ua = lcb2_map[lcb_map[a]]['argname']
            if not ua == a:
                ua = f' => {ua}'
            else:
                ua = ''
        sig = f'{a} : call-back function{ua}'
        sigout = sig
    else:
        errmess(
            f'getpydocsign: Could not resolve docsignature for "{a}".\n')
    return sig, sigout


def getarrdocsign(a, var):
    ctype = getctype(var)
    if isstring(var) and (not isarray(var)):
        sig = f'{a} : rank-0 array(string(len={getstrlength(var)}),\'c\')'
    elif isscalar(var):
        sig = f'{a} : rank-0 array({c2py_map[ctype]},\'{c2pycode_map[ctype]}\')'
    elif isarray(var):