capybara/virtualenv/lib/python2.7/site-packages/pkg_resources/__init__.py
def parse_requirements(strs):
    """Yield ``Requirement`` objects for each specification in `strs`

    `strs` must be a string, or a (possibly-nested) iterable thereof.
    """
    # create a steppable iterator, so we can handle \-continuations
    lines = iter(yield_lines(strs))

    def scan_list(ITEM, TERMINATOR, line, p, groups, item_name):

        items = []

        while not TERMINATOR(line, p):
            if CONTINUE(line, p):
                try:
                    line = next(lines)
                    p = 0
                except StopIteration:
                    msg = "\\ must not appear on the last nonblank line"
                    raise RequirementParseError(msg)

            match = ITEM(line, p)
            if not match:
                msg = "Expected " + item_name + " in"
                raise RequirementParseError(msg, line, "at", line[p:])

            items.append(match.group(*groups))
            p = match.end()

            match = COMMA(line, p)
            if match:
                # skip the comma
                p = match.end()
            elif not TERMINATOR(line, p):
                msg = "Expected ',' or end-of-list in"
                raise RequirementParseError(msg, line, "at", line[p:])

        match = TERMINATOR(line, p)
        # skip the terminator, if any
        if match:
            p = match.end()
        return line, p, items

    for line in lines:
        match = DISTRO(line)
        if not match:
            raise RequirementParseError("Missing distribution spec", line)
        project_name = match.group(1)
        p = match.end()
        extras = []

        match = OBRACKET(line, p)
        if match:
            p = match.end()
            line, p, extras = scan_list(
                DISTRO, CBRACKET, line, p, (1,), "'extra' name"
            )

        line, p, specs = scan_list(VERSION, LINE_END, line, p, (1, 2),
            "version spec")
        specs = [(op, val) for op, val in specs]
        yield Requirement(project_name, specs, extras)
def parse_requirements(strs):
    """Yield ``Requirement`` objects for each specification in `strs`

    `strs` must be a string, or a (possibly-nested) iterable thereof.
    """
    # create a steppable iterator, so we can handle \-continuations
    lines = iter(yield_lines(strs))

    def scan_list(ITEM, TERMINATOR, line, p, groups, item_name):

        items = []

        while not TERMINATOR(line, p):
            if CONTINUE(line, p):
                try:
                    line = next(lines)
                    p = 0
                except StopIteration:
                    msg = "\\ must not appear on the last nonblank line"
                    raise RequirementParseError(msg)

            match = ITEM(line, p)
            if not match:
                msg = "Expected " + item_name + " in"
                raise RequirementParseError(msg, line, "at", line[p:])

            items.append(match.group(*groups))
            p = match.end()

            match = COMMA(line, p)
            if match:
                # skip the comma
                p = match.end()
            elif not TERMINATOR(line, p):
                msg = "Expected ',' or end-of-list in"
                raise RequirementParseError(msg, line, "at", line[p:])

        match = TERMINATOR(line, p)
        # skip the terminator, if any
        if match:
            p = match.end()
        return line, p, items

    for line in lines:
        match = DISTRO(line)
        if not match:
            raise RequirementParseError("Missing distribution spec", line)
        project_name = match.group(1)
        p = match.end()
        extras = []

        match = OBRACKET(line, p)
        if match:
            p = match.end()
            line, p, extras = scan_list(
                DISTRO, CBRACKET, line, p, (1,), "'extra' name"
            )

        line, p, specs = scan_list(VERSION, LINE_END, line, p, (1, 2),
            "version spec")
        specs = [(op, val) for op, val in specs]
        yield Requirement(project_name, specs, extras)
def parse_requirements ( strs ) : # create a steppable iterator, so we can handle \-continuations lines = iter ( yield_lines ( strs ) ) def scan_list ( ITEM , TERMINATOR , line , p , groups , item_name ) : items = [ ] while not TERMINATOR ( line , p ) : if CONTINUE ( line , p ) : try : line = next ( lines ) p = 0 except StopIteration : msg = "\\ must not appear on the last nonblank line" raise RequirementParseError ( msg ) match = ITEM ( line , p ) if not match : msg = "Expected " + item_name + " in" raise RequirementParseError ( msg , line , "at" , line [ p : ] ) items . append ( match . group ( * groups ) ) p = match . end ( ) match = COMMA ( line , p ) if match : # skip the comma p = match . end ( ) elif not TERMINATOR ( line , p ) : msg = "Expected ',' or end-of-list in" raise RequirementParseError ( msg , line , "at" , line [ p : ] ) match = TERMINATOR ( line , p ) # skip the terminator, if any if match : p = match . end ( ) return line , p , items for line in lines : match = DISTRO ( line ) if not match : raise RequirementParseError ( "Missing distribution spec" , line ) project_name = match . group ( 1 ) p = match . end ( ) extras = [ ] match = OBRACKET ( line , p ) if match : p = match . end ( ) line , p , extras = scan_list ( DISTRO , CBRACKET , line , p , ( 1 , ) , "'extra' name" ) line , p , specs = scan_list ( VERSION , LINE_END , line , p , ( 1 , 2 ) , "version spec" ) specs = [ ( op , val ) for op , val in specs ] yield Requirement ( project_name , specs , extras )
Yield ``Requirement`` objects for each specification in `strs`

    `strs` must be a string, or a (possibly-nested) iterable thereof.
Yield Requirement objects for each specification in strs