def automodsumm_to_autosummary_lines(fn, app):
fullfn = os.path.join(app.builder.env.srcdir, fn)<EOL>with open(fullfn) as fr:<EOL><INDENT>if '<STR_LIT>' in app._extensions:<EOL><INDENT>from astropy_helpers.sphinx.ext.automodapi import automodapi_replace<EOL>docname = os.path.splitext(fn)[<NUM_LIT:0>]<EOL>filestr = automodapi_replace(fr.read(), app, True, docname, False)<EOL><DEDENT>else:<EOL><INDENT>filestr = fr.read()<EOL><DEDENT><DEDENT>spl = _automodsummrex.split(filestr)<EOL>indent1s = spl[<NUM_LIT:1>::<NUM_LIT:5>]<EOL>mods = spl[<NUM_LIT:2>::<NUM_LIT:5>]<EOL>opssecs = spl[<NUM_LIT:3>::<NUM_LIT:5>]<EOL>indent2s = spl[<NUM_LIT:4>::<NUM_LIT:5>]<EOL>remainders = spl[<NUM_LIT:5>::<NUM_LIT:5>]<EOL>newlines = []<EOL>for i, (i1, i2, modnm, ops, rem) in enumerate(zip(indent1s, indent2s, mods,<EOL>opssecs, remainders)):<EOL><INDENT>allindent = i1 + ('<STR_LIT>' if i2 is None else i2)<EOL>oplines = ops.split('<STR_LIT:\n>')<EOL>toskip = []<EOL>allowedpkgnms = []<EOL>funcsonly = clssonly = False<EOL>for i, ln in reversed(list(enumerate(oplines))):<EOL><INDENT>if '<STR_LIT>' in ln:<EOL><INDENT>funcsonly = True<EOL>del oplines[i]<EOL><DEDENT>if '<STR_LIT>' in ln:<EOL><INDENT>clssonly = True<EOL>del oplines[i]<EOL><DEDENT>if '<STR_LIT>' in ln:<EOL><INDENT>toskip.extend(_str_list_converter(ln.replace('<STR_LIT>', '<STR_LIT>')))<EOL>del oplines[i]<EOL><DEDENT>if '<STR_LIT>' in ln:<EOL><INDENT>allowedpkgnms.extend(_str_list_converter(ln.replace('<STR_LIT>', '<STR_LIT>')))<EOL>del oplines[i]<EOL><DEDENT><DEDENT>if funcsonly and clssonly:<EOL><INDENT>msg = ('<STR_LIT>'<EOL>'<STR_LIT>')<EOL>lnnum = sum([spl[j].count('<STR_LIT:\n>') for j in range(i * <NUM_LIT:5> + <NUM_LIT:1>)])<EOL>app.warn('<STR_LIT>' + msg, (fn, lnnum))<EOL>continue<EOL><DEDENT>newlines.extend([i1 + '<STR_LIT>' + modnm,<EOL>'<STR_LIT>',<EOL>'<STR_LIT>'])<EOL>newlines.extend(oplines)<EOL>ols = True if len(allowedpkgnms) == <NUM_LIT:0> else allowedpkgnms<EOL>for nm, fqn, obj in zip(*find_mod_objs(modnm, onlylocals=ols)):<EOL><INDENT>if nm in toskip:<EOL><INDENT>continue<EOL><DEDENT>if funcsonly and not inspect.isroutine(obj):<EOL><INDENT>continue<EOL><DEDENT>if clssonly and not inspect.isclass(obj):<EOL><INDENT>continue<EOL><DEDENT>newlines.append(allindent + nm)<EOL><DEDENT><DEDENT>newlines.append('<STR_LIT>')<EOL>return newlines<EOL>
Generates lines from a file with an "automodsumm" entry suitable for
feeding into "autosummary".
Searches the provided file for `automodsumm` directives and returns
a list of lines specifying the `autosummary` commands for the modules
requested. This does *not* return the whole file contents - just an
autosummary section in place of any :automodsumm: entries. Note that
any options given for `automodsumm` are also included in the
generated `autosummary` section.
Parameters
----------
fn : str
    The name of the file to search for `automodsumm` entries.
app : sphinx.application.Application
    The sphinx Application object
Return
------
lines : list of str
    Lines for all `automodsumm` entries with the entries replaced by
    `autosummary` and the module's members added.