"""Extract reference documentation from the NumPy source tree.

"""

import inspect
import textwrap
import re
import pydoc
try:
    from StringIO import StringIO
except ImportError:
    from io import StringIO
from warnings import warn


class Reader(object):

    """A line-based string reader.

    """

    def __init__(self, data):
        """
        Parameters
        ----------
        data : str
           String with lines separated by '\n'.

        """
        if isinstance(data, list):