Did I find the right examples for you? yes no

All Samples(2)  |  Call(1)  |  Derive(0)  |  Import(1)
Yields all numbers in given intervals.

Examples:
    >>> list(yield_from_intervals("1,4-5")) == [1, 4, 5]
    True
    >>> list(yield_from_intervals("1,7", delta=3)) == [4, 10]
    True
    >>> list(yield_from_intervals("1-2,3-4")) == [1, 2, 3, 4]
    True
    >>> list(yield_from_intervals("")) == [](more...)

        def yield_from_intervals(intervals, delta=0):
    """
    Yields all numbers in given intervals.

    Examples:
        >>> list(yield_from_intervals("1,4-5")) == [1, 4, 5]
        True
        >>> list(yield_from_intervals("1,7", delta=3)) == [4, 10]
        True
        >>> list(yield_from_intervals("1-2,3-4")) == [1, 2, 3, 4]
        True
        >>> list(yield_from_intervals("")) == []
        True
        >>> list(yield_from_intervals("1-2-3"))
        Traceback (most recent call last):
        ...
        ValueError: Wrong interval syntax: '1-2-3'

    Arguments:
        intervals (str): Comma-separated list of (closed, integer) intervals.
        delta (int): Offset added to all generated values.

    Yields:
        Lazy sequence of integers from all intervals.

    Raises:
        ValueError: Syntax error in intervals.

    """
    if not VALID_INTERVALS.match(intervals):
        raise ValueError("Wrong interval syntax: %r" % intervals)

    for sec in intervals.split(","):
        if "-" in sec:
            start, end = map(int, sec.split("-"))
            for i in range(start, end+1):
                yield i + delta
        elif sec:
            yield int(sec) + delta
        


src/p/a/pandocwheels-0.1.1/pandocwheels/pygmentize.py   pandocwheels(Download)
from pandocfilters import RawBlock
 
from .utils import yield_from_intervals, supports_only
 
__all__ = ["pygmentize"]
        try:
            hlines_attr = attributes.get("highlightedLines", "")
            seq = yield_from_intervals(hlines_attr, delta=-first_line+1)
            highlighted_lines = list(seq)
        except ValueError: