def get_api_items(api_doc_fd):
current_module = '<STR_LIT>'<EOL>previous_line = current_section = current_subsection = '<STR_LIT>'<EOL>position = None<EOL>for line in api_doc_fd:<EOL><INDENT>line = line.strip()<EOL>if len(line) == len(previous_line):<EOL><INDENT>if set(line) == set('<STR_LIT:->'):<EOL><INDENT>current_section = previous_line<EOL>continue<EOL><DEDENT>if set(line) == set('<STR_LIT>'):<EOL><INDENT>current_subsection = previous_line<EOL>continue<EOL><DEDENT><DEDENT>if line.startswith('<STR_LIT>'):<EOL><INDENT>current_module = line.replace('<STR_LIT>', '<STR_LIT>').strip()<EOL>continue<EOL><DEDENT>if line == '<STR_LIT>':<EOL><INDENT>position = '<STR_LIT>'<EOL>continue<EOL><DEDENT>if position == '<STR_LIT>':<EOL><INDENT>if line == '<STR_LIT>':<EOL><INDENT>position = '<STR_LIT>'<EOL>continue<EOL><DEDENT><DEDENT>if position == '<STR_LIT>':<EOL><INDENT>if line == '<STR_LIT>':<EOL><INDENT>position = None<EOL>continue<EOL><DEDENT>item = line.strip()<EOL>func = importlib.import_module(current_module)<EOL>for part in item.split('<STR_LIT:.>'):<EOL><INDENT>func = getattr(func, part)<EOL><DEDENT>yield ('<STR_LIT:.>'.join([current_module, item]), func,<EOL>current_section, current_subsection)<EOL><DEDENT>previous_line = line<EOL><DEDENT>
Yield information about all public API items.

Parse api.rst file from the documentation, and extract all the functions,
methods, classes, attributes... This should include all pandas public API.

Parameters
----------
api_doc_fd : file descriptor
    A file descriptor of the API documentation page, containing the table
    of contents with all the public API.

Yields
------
name : str
    The name of the object (e.g. 'pandas.Series.str.upper).
func : function
    The object itself. In most cases this will be a function or method,
    but it can also be classes, properties, cython objects...
section : str
    The name of the section in the API page where the object item is
    located.
subsection : str
    The name of the subsection in the API page where the object item is
    located.