# Buggy code
def from_line(cls, line):
    link = None
    path = None
    editable = line.startswith("-e ")
    line = line.split(" ", 1)[1] if editable else line
    if not any([is_installable_file(line), is_valid_url(line)]):
        raise ValueError("Supplied requirement is not installable: {0!r}".format(line))

    if is_valid_url(line):
        link = Link(line)
    else:
        _path = Path(line)
        link = Link(_path.absolute().as_uri())
        if _path.is_absolute() or _path.as_posix() == ".":
            path = _path.as_posix()
        else:
            path = get_converted_relative_path(line)
    arg_dict = {
        "path": path,
        "uri": link.url_without_fragment,
        "link": link,
        "editable": editable,
    }
    if link.egg_fragment:
        arg_dict["name"] = link.egg_fragment
    created = cls(**arg_dict)
    return created


# Traceback (pip9.exceptions.InstallationError)
gtalarico@GUI-STUDIO:~/dev/repos/genome$ pipenv install --dev
Pipfile.lock not found, creating…
Locking [dev-packages] dependencies…
Locking [packages] dependencies…
341, in <listcomp>
c for c in req.parse_requirements(t, session=pip_requests)
File "/home/gtalarico/.pyenv/versions/3.6.5/lib/python3.6/site-packages/pipenv/vendor/pip9/req/req_file.py", line 93, in parse_requirements
for req in req_iter:
File "/home/gtalarico/.pyenv/versions/3.6.5/lib/python3.6/site-packages/pipenv/vendor/pip9/req/req_file.py", line 158, in process_line
isolated=isolated, options=req_options, wheel_cache=wheel_cache
File "/home/gtalarico/.pyenv/versions/3.6.5/lib/python3.6/site-packages/pipenv/vendor/pip9/req/req_install.py", line 235, in from_line
wheel_cache=wheel_cache, constraint=constraint)
File "/home/gtalarico/.pyenv/versions/3.6.5/lib/python3.6/site-packages/pipenv/vendor/pip9/req/req_install.py", line 91, in __init__
"Invalid requirement: '%s'\n%s" % (req, add_msg))
pip9.exceptions.InstallationError: Invalid requirement: '.\vendor\stargate==0.14.2'
Traceback (most recent call last):
File "/home/gtalarico/.pyenv/versions/3.6.5/lib/python3.6/site-packages/pipenv/vendor/pip9/_vendor/packaging/requirements.py", line 92, in __init__
req = REQUIREMENT.parseString(requirement_string)
File "/home/gtalarico/.pyenv/versions/3.6.5/lib/python3.6/site-packages/pipenv/vendor/pip9/_vendor/pyparsing.py", line 1617, in parseString
raise exc
File "/home/gtalarico/.pyenv/versions/3.6.5/lib/python3.6/site-packages/pipenv/vendor/pip9/_vendor/pyparsing.py", line 1607, in parseString
loc, tokens = self._parse( instring, 0 )
File "/home/gtalarico/.pyenv/versions/3.6.5/lib/python3.6/site-packages/pipenv/vendor/pip9/_vendor/pyparsing.py", line 1379, in _parseNoCache
loc,tokens = self.parseImpl( instring, preloc, doActions )
File "/home/gtalarico/.pyenv/versions/3.6.5/lib/python3.6/site-packages/pipenv/vendor/pip9/_vendor/pyparsing.py", line 3376, in parseImpl
loc, exprtokens = e._parse( instring, loc, doActions )
File "/home/gtalarico/.pyenv/versions/3.6.5/lib/python3.6/site-packages/pipenv/vendor/pip9/_vendor/pyparsing.py", line 1379, in _parseNoCache
loc,tokens = self.parseImpl( instring, preloc, doActions )
File "/home/gtalarico/.pyenv/versions/3.6.5/lib/python3.6/site-packages/pipenv/vendor/pip9/_vendor/pyparsing.py", line 3698, in parseImpl
return self.expr._parse( instring, loc, doActions, callPreParse=False )
File "/home/gtalarico/.pyenv/versions/3.6.5/lib/python3.6/site-packages/pipenv/vendor/pip9/_vendor/pyparsing.py", line 1379, in _parseNoCache
loc,tokens = self.parseImpl( instring, preloc, doActions )
File "/home/gtalarico/.pyenv/versions/3.6.5/lib/python3.6/site-packages/pipenv/vendor/pip9/_vendor/pyparsing.py", line 3359, in parseImpl
loc, resultlist = self.exprs[0]._parse( instring, loc, doActions, callPreParse=False )
File "/home/gtalarico/.pyenv/versions/3.6.5/lib/python3.6/site-packages/pipenv/vendor/pip9/_vendor/pyparsing.py", line 1383, in _parseNoCache
loc,tokens = self.parseImpl( instring, preloc, doActions )
File "/home/gtalarico/.pyenv/versions/3.6.5/lib/python3.6/site-packages/pipenv/vendor/pip9/_vendor/pyparsing.py", line 2670, in parseImpl
raise ParseException(instring, loc, self.errmsg, self)
pip9._vendor.pyparsing.ParseException: Expected W:(abcd...) (at char 0), (line:1, col:1)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/gtalarico/.pyenv/versions/3.6.5/lib/python3.6/site-packages/pipenv/vendor/pip9/req/req_install.py", line 82, in __init__
req = Requirement(req)
File "/home/gtalarico/.pyenv/versions/3.6.5/lib/python3.6/site-packages/pipenv/vendor/pip9/_vendor/packaging/requirements.py", line 96, in __init__
requirement_string[e.loc:e.loc + 8]))
pip9._vendor.packaging.requirements.InvalidRequirement: Invalid requirement, parse error at "'.\\vendor'"
gtalarico@GUI-STUDIO:~/dev/repos/genome$

# Fixed code
def from_line(cls, line):
    link = None
    path = None
    editable = line.startswith("-e ")
    line = line.split(" ", 1)[1] if editable else line
    if not any([is_installable_file(line), is_valid_url(line)]):
        raise ValueError("Supplied requirement is not installable: {0!r}".format(line))

    if is_valid_url(line) and not is_installable_file(line):
        link = Link(line)
    else:
        if is_valid_url(line):
            parsed = urlparse(line)
            link = Link("{0}".format(line))
            if parsed.scheme == "file":
                path = Path(parsed.path).absolute().as_posix()
                if get_converted_relative_path(path) == ".":
                    path = "."
                line = path
        else:
            _path = Path(line)
            link = Link(_path.absolute().as_uri())
            if _path.is_absolute() or _path.as_posix() == ".":
                path = _path.as_posix()
            else:
                path = get_converted_relative_path(line)
    arg_dict = {
        "path": path,
        "uri": link.url_without_fragment,
        "link": link,
        "editable": editable,
    }
    if link.egg_fragment:
        arg_dict["name"] = link.egg_fragment
    created = cls(**arg_dict)
    return created