# Buggy code
def is_installable_file(path):
    """Determine if a path can potentially be installed"""
    from ._compat import is_installable_dir, is_archive_file
    from packaging import specifiers

    if hasattr(path, "keys") and any(
        key for key in path.keys() if key in ["file", "path"]
    ):
        path = urlparse(path["file"]).path if "file" in path else path["path"]
    if not isinstance(path, six.string_types) or path == "*":
        return False

    # If the string starts with a valid specifier operator, test if it is a valid
    # specifier set before making a path object (to avoid breaking windows)
    if any(path.startswith(spec) for spec in "!=<>~"):
        try:
            specifiers.SpecifierSet(path)
        # If this is not a valid specifier, just move on and try it as a path
        except specifiers.InvalidSpecifier:
            pass
        else:
            return False

    if not os.path.exists(os.path.abspath(path)):
        return False

    lookup_path = Path(path)
    absolute_path = "{0}".format(lookup_path.absolute())
    if lookup_path.is_dir() and is_installable_dir(absolute_path):
        return True

    elif lookup_path.is_file() and is_archive_file(absolute_path):
        return True

    return False


# 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 is_installable_file(path):
    """Determine if a path can potentially be installed"""
    from ._compat import is_installable_dir, is_archive_file
    from packaging import specifiers

    if hasattr(path, "keys") and any(
        key for key in path.keys() if key in ["file", "path"]
    ):
        path = urlparse(path["file"]).path if "file" in path else path["path"]
    if not isinstance(path, six.string_types) or path == "*":
        return False

    # If the string starts with a valid specifier operator, test if it is a valid
    # specifier set before making a path object (to avoid breaking windows)
    if any(path.startswith(spec) for spec in "!=<>~"):
        try:
            specifiers.SpecifierSet(path)
        # If this is not a valid specifier, just move on and try it as a path
        except specifiers.InvalidSpecifier:
            pass
        else:
            return False

    parsed = urlparse(path)
    if parsed.scheme == "file":
        path = parsed.path

    if not os.path.exists(os.path.abspath(path)):
        return False

    lookup_path = Path(path)
    absolute_path = "{0}".format(lookup_path.absolute())
    if lookup_path.is_dir() and is_installable_dir(absolute_path):
        return True

    elif lookup_path.is_file() and is_archive_file(absolute_path):
        return True

    return False