(text)
return new_text
Fixes Pandas docstring warning about explicit markup not followed by a blank line.

    Parses the text and finds ``'.. '`` strings by adding a blank line next after.

    :param text: Original text with warnings
    :return: Modified text that fixes warnings
Fixes Pandas docstring warning about explicit markup not followed by a blank line.
Fixes Pandas docstring warning about explicit markup not followed by a blank line .
def reformat_explicit_markup(text):
    """
    Fixes Pandas docstring warning about explicit markup not followed by a blank line.

    Parses the text and finds ``'.. '`` strings by adding a blank line next after.

    :param text: Original text with warnings
    :return: Modified text that fixes warnings
    """
    lines = text.split('\n')
    new_text = ''
    while len(lines) > 0:
        line = lines[0]

        if line.strip().startswith('.. versionchanged') or line.strip().startswith('.. versionadded') or \
                line.strip().startswith('.. deprecated') or line.strip().startswith('.. _'):
            new_text += line + '\n'
            # Here if found explicit markup
            if len(lines) > 1:
                # Here if there is at least one line after explicit markup
                if lines[1].strip != '':
                    # Here if there is no empty line after explicit markup. Add new line then
                    new_text += '\n'
                lines.pop(0)
        elif line.strip().startswith('.. note') or line.strip().startswith('.. warning'):
            new_text += line.strip() + '\n'
            if len(lines) > 1:
                # Here if there is at least one line after explicit markup
                if lines[1].strip() == '':
                    # Here if there is empty line after explicit markup. Remove new line then
                    lines.pop(1)
        elif line.strip().startswith('.. ['):
            new_text += '\n'  # Remove references
        else:
            new_text += line + '\n'
        lines.pop(0)
    return new_text
def reformat_explicit_markup ( text ) : lines = text . split ( '\n' ) new_text = '' while len ( lines ) > 0 : line = lines [ 0 ] if line . strip ( ) . startswith ( '.. versionchanged' ) or line . strip ( ) . startswith ( '.. versionadded' ) or line . strip ( ) . startswith ( '.. deprecated' ) or line . strip ( ) . startswith ( '.. _' ) : new_text += line + '\n' # Here if found explicit markup if len ( lines ) > 1 : # Here if there is at least one line after explicit markup if lines [ 1 ] . strip != '' : # Here if there is no empty line after explicit markup. Add new line then new_text += '\n' lines . pop ( 0 ) elif line . strip ( ) . startswith ( '.. note' ) or line . strip ( ) . startswith ( '.. warning' ) : new_text += line . strip ( ) + '\n' if len ( lines ) > 1 : # Here if there is at least one line after explicit markup if lines [ 1 ] . strip ( ) == '' : # Here if there is empty line after explicit markup. Remove new line then lines . pop ( 1 ) elif line . strip ( ) . startswith ( '.. [' ) : new_text += '\n' # Remove references else : new_text += line + '\n' lines . pop ( 0 ) return new_text