prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Development version number triggers a false positive warning
  * Pip version: 10.0.0b1
  * Python version: 3.6.4
  * Operating system: Linux
  
  ### Description:
  
  Say a package `foo` depends on `bar>=1.0.0`. If the installed version of `bar` is a development version such as `1.0.1.dev42`, pip issues an incompatible version warning upon installation of `foo`. Pip shouldn't issue any warning since `1.0.1.dev42>=1.0.0`. The weird thing is that pip is satisfied with that version when scanning the dependencies of `foo`, but issues that warning anyway.
  
  For that matter, the real life scenario is installing a development library with a `setuptools_scm`-generated version number and then installing a library that depends on it.
  
  ### What I've run:
  
  ```
  % tree
  .
  ├── bar
  │   └── setup.py
  └── foo
      └── setup.py
  
  2 directories, 2 files
  ```
  
  ```
  % cat bar/setup.py
  from setuptools import setup
  
  setup(
      name='bar',
      version='1.0.1.dev42')
  ```
  
  ```
  % cat foo/setup.py
  from setuptools import setup
  
  setup(
      name='foo',
      install_requires=['bar>=1.0.0'],
      version='3.14.15')
  ```
  
  ```
  # setting up virtual environment
  % python3 -m venv compat
  % source compat/bin/activate
  % pip install pip==10.0.0b1
  ```
  
  ```
  % pip install ./bar
  Processing ./bar
  Installing collected packages: bar
    Running setup.py install for bar ... done
  Successfully installed bar-1.0.1.dev42
  ```
  
  ```
  % pip install ./foo
  Processing ./foo
  Requirement already satisfied: bar>=1.0.0 in ./compat/lib/python3.6/site-packages (from foo==3.14.15) (1.0.1.dev42)
  foo 3.14.15 has requirement bar>=1.0.0, but you'll have bar 1.0.1.dev42 which is incompatible.
  Installing collected packages: foo
    Running setup.py install for foo ... done
  Successfully installed foo-3.14.15
  ```
  
  
  </issue>
  <code>
  [start of src/pip/_internal/operations/check.py]
  1 """Validation of dependencies of packages
  2 """
  3 
  4 from collections import namedtuple
  5 
  6 from pip._vendor.packaging.utils import canonicalize_name
  7 
  8 from pip._internal.operations.prepare import make_abstract_dist
  9 
  10 from pip._internal.utils.misc import get_installed_distributions
  11 from pip._internal.utils.typing import MYPY_CHECK_RUNNING
  12 
  13 if MYPY_CHECK_RUNNING:
  14     from pip._internal.req.req_install import InstallRequirement
  15     from typing import Any, Dict, Iterator, Set, Tuple, List
  16 
  17     # Shorthands
  18     PackageSet = Dict[str, 'PackageDetails']
  19     Missing = Tuple[str, Any]
  20     Conflicting = Tuple[str, str, Any]
  21 
  22     MissingDict = Dict[str, List[Missing]]
  23     ConflictingDict = Dict[str, List[Conflicting]]
  24     CheckResult = Tuple[MissingDict, ConflictingDict]
  25 
  26 PackageDetails = namedtuple('PackageDetails', ['version', 'requires'])
  27 
  28 
  29 def create_package_set_from_installed(**kwargs):
  30     # type: (**Any) -> PackageSet
  31     """Converts a list of distributions into a PackageSet.
  32     """
  33     retval = {}
  34     for dist in get_installed_distributions(**kwargs):
  35         name = canonicalize_name(dist.project_name)
  36         retval[name] = PackageDetails(dist.version, dist.requires())
  37     return retval
  38 
  39 
  40 def check_package_set(package_set):
  41     # type: (PackageSet) -> CheckResult
  42     """Check if a package set is consistent
  43     """
  44     missing = dict()
  45     conflicting = dict()
  46 
  47     for package_name in package_set:
  48         # Info about dependencies of package_name
  49         missing_deps = set()  # type: Set[Missing]
  50         conflicting_deps = set()  # type: Set[Conflicting]
  51 
  52         for req in package_set[package_name].requires:
  53             name = canonicalize_name(req.project_name)  # type: str
  54 
  55             # Check if it's missing
  56             if name not in package_set:
  57                 missed = True
  58                 if req.marker is not None:
  59                     missed = req.marker.evaluate()
  60                 if missed:
  61                     missing_deps.add((name, req))
  62                 continue
  63 
  64             # Check if there's a conflict
  65             version = package_set[name].version  # type: str
  66             if version not in req.specifier:
  67                 conflicting_deps.add((name, version, req))
  68 
  69         def str_key(x):
  70             return str(x)
  71 
  72         if missing_deps:
  73             missing[package_name] = sorted(missing_deps, key=str_key)
  74         if conflicting_deps:
  75             conflicting[package_name] = sorted(conflicting_deps, key=str_key)
  76 
  77     return missing, conflicting
  78 
  79 
  80 def check_install_conflicts(to_install):
  81     # type: (List[InstallRequirement]) -> Tuple[PackageSet, CheckResult]
  82     """For checking if the dependency graph would be consistent after \
  83     installing given requirements
  84     """
  85     # Start from the current state
  86     state = create_package_set_from_installed()
  87     _simulate_installation_of(to_install, state)
  88     return state, check_package_set(state)
  89 
  90 
  91 # NOTE from @pradyunsg
  92 # This required a minor update in dependency link handling logic over at
  93 # operations.prepare.IsSDist.dist() to get it working
  94 def _simulate_installation_of(to_install, state):
  95     # type: (List[InstallRequirement], PackageSet) -> None
  96     """Computes the version of packages after installing to_install.
  97     """
  98 
  99     # Modify it as installing requirement_set would (assuming no errors)
  100     for inst_req in to_install:
  101         dist = make_abstract_dist(inst_req).dist(finder=None)
  102         state[dist.key] = PackageDetails(dist.version, dist.requires())
  103
  [end of src/pip/_internal/operations/check.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/src/pip/_internal/operations/check.py b/src/pip/_internal/operations/check.py
  --- a/src/pip/_internal/operations/check.py
  +++ b/src/pip/_internal/operations/check.py
  @@ -63,7 +63,7 @@
   
               # Check if there's a conflict
               version = package_set[name].version  # type: str
  -            if version not in req.specifier:
  +            if not req.specifier.contains(version, prereleases=True):
                   conflicting_deps.add((name, version, req))
   
           def str_key(x):
  
verification_info: {"golden_diff": "diff --git a/src/pip/_internal/operations/check.py b/src/pip/_internal/operations/check.py\n--- a/src/pip/_internal/operations/check.py\n+++ b/src/pip/_internal/operations/check.py\n@@ -63,7 +63,7 @@\n \n             # Check if there's a conflict\n             version = package_set[name].version  # type: str\n-            if version not in req.specifier:\n+            if not req.specifier.contains(version, prereleases=True):\n                 conflicting_deps.add((name, version, req))\n \n         def str_key(x):\n", "issue": "Development version number triggers a false positive warning\n* Pip version: 10.0.0b1\r\n* Python version: 3.6.4\r\n* Operating system: Linux\r\n\r\n### Description:\r\n\r\nSay a package `foo` depends on `bar>=1.0.0`. If the installed version of `bar` is a development version such as `1.0.1.dev42`, pip issues an incompatible version warning upon installation of `foo`. Pip shouldn't issue any warning since `1.0.1.dev42>=1.0.0`. The weird thing is that pip is satisfied with that version when scanning the dependencies of `foo`, but issues that warning anyway.\r\n\r\nFor that matter, the real life scenario is installing a development library with a `setuptools_scm`-generated version number and then installing a library that depends on it.\r\n\r\n### What I've run:\r\n\r\n```\r\n% tree\r\n.\r\n\u251c\u2500\u2500 bar\r\n\u2502\u00a0\u00a0 \u2514\u2500\u2500 setup.py\r\n\u2514\u2500\u2500 foo\r\n    \u2514\u2500\u2500 setup.py\r\n\r\n2 directories, 2 files\r\n```\r\n\r\n```\r\n% cat bar/setup.py\r\nfrom setuptools import setup\r\n\r\nsetup(\r\n    name='bar',\r\n    version='1.0.1.dev42')\r\n```\r\n\r\n```\r\n% cat foo/setup.py\r\nfrom setuptools import setup\r\n\r\nsetup(\r\n    name='foo',\r\n    install_requires=['bar>=1.0.0'],\r\n    version='3.14.15')\r\n```\r\n\r\n```\r\n# setting up virtual environment\r\n% python3 -m venv compat\r\n% source compat/bin/activate\r\n% pip install pip==10.0.0b1\r\n```\r\n\r\n```\r\n% pip install ./bar\r\nProcessing ./bar\r\nInstalling collected packages: bar\r\n  Running setup.py install for bar ... done\r\nSuccessfully installed bar-1.0.1.dev42\r\n```\r\n\r\n```\r\n% pip install ./foo\r\nProcessing ./foo\r\nRequirement already satisfied: bar>=1.0.0 in ./compat/lib/python3.6/site-packages (from foo==3.14.15) (1.0.1.dev42)\r\nfoo 3.14.15 has requirement bar>=1.0.0, but you'll have bar 1.0.1.dev42 which is incompatible.\r\nInstalling collected packages: foo\r\n  Running setup.py install for foo ... done\r\nSuccessfully installed foo-3.14.15\r\n```\r\n\n", "before_files": [{"content": "\"\"\"Validation of dependencies of packages\n\"\"\"\n\nfrom collections import namedtuple\n\nfrom pip._vendor.packaging.utils import canonicalize_name\n\nfrom pip._internal.operations.prepare import make_abstract_dist\n\nfrom pip._internal.utils.misc import get_installed_distributions\nfrom pip._internal.utils.typing import MYPY_CHECK_RUNNING\n\nif MYPY_CHECK_RUNNING:\n    from pip._internal.req.req_install import InstallRequirement\n    from typing import Any, Dict, Iterator, Set, Tuple, List\n\n    # Shorthands\n    PackageSet = Dict[str, 'PackageDetails']\n    Missing = Tuple[str, Any]\n    Conflicting = Tuple[str, str, Any]\n\n    MissingDict = Dict[str, List[Missing]]\n    ConflictingDict = Dict[str, List[Conflicting]]\n    CheckResult = Tuple[MissingDict, ConflictingDict]\n\nPackageDetails = namedtuple('PackageDetails', ['version', 'requires'])\n\n\ndef create_package_set_from_installed(**kwargs):\n    # type: (**Any) -> PackageSet\n    \"\"\"Converts a list of distributions into a PackageSet.\n    \"\"\"\n    retval = {}\n    for dist in get_installed_distributions(**kwargs):\n        name = canonicalize_name(dist.project_name)\n        retval[name] = PackageDetails(dist.version, dist.requires())\n    return retval\n\n\ndef check_package_set(package_set):\n    # type: (PackageSet) -> CheckResult\n    \"\"\"Check if a package set is consistent\n    \"\"\"\n    missing = dict()\n    conflicting = dict()\n\n    for package_name in package_set:\n        # Info about dependencies of package_name\n        missing_deps = set()  # type: Set[Missing]\n        conflicting_deps = set()  # type: Set[Conflicting]\n\n        for req in package_set[package_name].requires:\n            name = canonicalize_name(req.project_name)  # type: str\n\n            # Check if it's missing\n            if name not in package_set:\n                missed = True\n                if req.marker is not None:\n                    missed = req.marker.evaluate()\n                if missed:\n                    missing_deps.add((name, req))\n                continue\n\n            # Check if there's a conflict\n            version = package_set[name].version  # type: str\n            if version not in req.specifier:\n                conflicting_deps.add((name, version, req))\n\n        def str_key(x):\n            return str(x)\n\n        if missing_deps:\n            missing[package_name] = sorted(missing_deps, key=str_key)\n        if conflicting_deps:\n            conflicting[package_name] = sorted(conflicting_deps, key=str_key)\n\n    return missing, conflicting\n\n\ndef check_install_conflicts(to_install):\n    # type: (List[InstallRequirement]) -> Tuple[PackageSet, CheckResult]\n    \"\"\"For checking if the dependency graph would be consistent after \\\n    installing given requirements\n    \"\"\"\n    # Start from the current state\n    state = create_package_set_from_installed()\n    _simulate_installation_of(to_install, state)\n    return state, check_package_set(state)\n\n\n# NOTE from @pradyunsg\n# This required a minor update in dependency link handling logic over at\n# operations.prepare.IsSDist.dist() to get it working\ndef _simulate_installation_of(to_install, state):\n    # type: (List[InstallRequirement], PackageSet) -> None\n    \"\"\"Computes the version of packages after installing to_install.\n    \"\"\"\n\n    # Modify it as installing requirement_set would (assuming no errors)\n    for inst_req in to_install:\n        dist = make_abstract_dist(inst_req).dist(finder=None)\n        state[dist.key] = PackageDetails(dist.version, dist.requires())\n", "path": "src/pip/_internal/operations/check.py"}]}