(
    filepath: types.PathLike,
    *,
    mode: str = "rt",
    encoding: Optional[str] = None,
    lines: bool = False,
)
Read the contents of a text file at ``filepath``, either all at once
    or streaming line-by-line.

    Args:
        filepath: Path to file on disk from which data will be read.
        mode: Mode with which ``filepath`` is opened.
        encoding: Name of the encoding used to decode or encode the data in ``filepath``.
            Only applicable in text mode.
        lines: If False, all data is read in at once;
            otherwise, data is read in one line at a time.

    Yields:
        Next line of text to read in.

        If ``lines`` is False, wrap this output in :func:`next()` to conveniently
        access the full text.
Read the contents of a text file at ``filepath``, either all at once
    or streaming line-by-line.
Read the contents of a text file at filepath either all at once or streaming line - by - line .
def read_text(
    filepath: types.PathLike,
    *,
    mode: str = "rt",
    encoding: Optional[str] = None,
    lines: bool = False,
) -> Iterable[str]:
    """
    Read the contents of a text file at ``filepath``, either all at once
    or streaming line-by-line.

    Args:
        filepath: Path to file on disk from which data will be read.
        mode: Mode with which ``filepath`` is opened.
        encoding: Name of the encoding used to decode or encode the data in ``filepath``.
            Only applicable in text mode.
        lines: If False, all data is read in at once;
            otherwise, data is read in one line at a time.

    Yields:
        Next line of text to read in.

        If ``lines`` is False, wrap this output in :func:`next()` to conveniently
        access the full text.
    """
    io_utils._validate_read_mode(mode)
    with io_utils.open_sesame(filepath, mode=mode, encoding=encoding) as f:
        if lines is False:
            yield f.read()
        else:
            for line in f:
                yield line
def read_text ( filepath : types . PathLike , * , mode : str = "rt" , encoding : Optional [ str ] = None , lines : bool = False , ) -> Iterable [ str ] : io_utils . _validate_read_mode ( mode ) with io_utils . open_sesame ( filepath , mode = mode , encoding = encoding ) as f : if lines is False : yield f . read ( ) else : for line in f : yield line