(lines_iter, inc_tab)
Yield just the lines for a given code tab.

    Args:
        lines_iter: An iterator of all code lines.
        inc_tab: The tab number, or None to yield all code lines.

    Yields:
        Each line of code for the requested tab, or for all tabs if inc_tab is
        None.
Yield just the lines for a given code tab.
Yield just the lines for a given code tab .
def lines_for_tab(lines_iter, inc_tab):
    """Yield just the lines for a given code tab.

    Args:
        lines_iter: An iterator of all code lines.
        inc_tab: The tab number, or None to yield all code lines.

    Yields:
        Each line of code for the requested tab, or for all tabs if inc_tab is
        None.
    """
    cur_tab = 0
    for line in lines_iter:
        if TAB_LINE_RE.match(line):
            cur_tab += 1
            if inc_tab is None:
                # Preserve tab cut lines if we're not actually selecting a tab.
                yield line
        elif inc_tab is None or inc_tab == cur_tab:
            yield line
def lines_for_tab ( lines_iter , inc_tab ) : cur_tab = 0 for line in lines_iter : if TAB_LINE_RE . match ( line ) : cur_tab += 1 if inc_tab is None : # Preserve tab cut lines if we're not actually selecting a tab. yield line elif inc_tab is None or inc_tab == cur_tab : yield line