We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Sampled_from() should work with collections.OrderedDict
OrderedDict should satisfy the replayability requirement, so sampling from it should be possible.
Currently it raises exception:
`HypothesisDeprecationWarning: Cannot sample from odict_values`

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `src/hypothesis/version.py`
Content:
```
1 # coding=utf-8
2 #
3 # This file is part of Hypothesis, which may be found at
4 # https://github.com/HypothesisWorks/hypothesis-python
5 #
6 # Most of this work is copyright (C) 2013-2017 David R. MacIver
7 # (david@drmaciver.com), but it contains contributions by others. See
8 # CONTRIBUTING.rst for a full list of people who may hold copyright, and
9 # consult the git log if you need to determine who owns an individual
10 # contribution.
11 #
12 # This Source Code Form is subject to the terms of the Mozilla Public License,
13 # v. 2.0. If a copy of the MPL was not distributed with this file, You can
14 # obtain one at http://mozilla.org/MPL/2.0/.
15 #
16 # END HEADER
17 
18 from __future__ import division, print_function, absolute_import
19 
20 __version_info__ = (3, 11, 2)
21 __version__ = '.'.join(map(str, __version_info__))
22
```

Path: `src/hypothesis/internal/conjecture/utils.py`
Content:
```
1 # coding=utf-8
2 #
3 # This file is part of Hypothesis, which may be found at
4 # https://github.com/HypothesisWorks/hypothesis-python
5 #
6 # Most of this work is copyright (C) 2013-2017 David R. MacIver
7 # (david@drmaciver.com), but it contains contributions by others. See
8 # CONTRIBUTING.rst for a full list of people who may hold copyright, and
9 # consult the git log if you need to determine who owns an individual
10 # contribution.
11 #
12 # This Source Code Form is subject to the terms of the Mozilla Public License,
13 # v. 2.0. If a copy of the MPL was not distributed with this file, You can
14 # obtain one at http://mozilla.org/MPL/2.0/.
15 #
16 # END HEADER
17 
18 from __future__ import division, print_function, absolute_import
19 
20 import enum
21 import math
22 from collections import Sequence
23 
24 from hypothesis._settings import note_deprecation
25 from hypothesis.internal.compat import hbytes, bit_length, int_to_bytes, \
26     int_from_bytes
27 
28 
29 def n_byte_unsigned(data, n):
30     return int_from_bytes(data.draw_bytes(n))
31 
32 
33 def saturate(n):
34     bits = bit_length(n)
35     k = 1
36     while k < bits:
37         n |= (n >> k)
38         k *= 2
39     return n
40 
41 
42 def integer_range(data, lower, upper, center=None, distribution=None):
43     assert lower <= upper
44     if lower == upper:
45         return int(lower)
46 
47     if center is None:
48         center = lower
49     center = min(max(center, lower), upper)
50     if distribution is None:
51         if lower < center < upper:
52             def distribution(random):
53                 if random.randint(0, 1):
54                     return random.randint(center, upper)
55                 else:
56                     return random.randint(lower, center)
57         else:
58             def distribution(random):
59                 return random.randint(lower, upper)
60 
61     gap = upper - lower
62     bits = bit_length(gap)
63     nbytes = bits // 8 + int(bits % 8 != 0)
64     mask = saturate(gap)
65 
66     def byte_distribution(random, n):
67         assert n == nbytes
68         v = distribution(random)
69         if v >= center:
70             probe = v - center
71         else:
72             probe = upper - v
73         return int_to_bytes(probe, n)
74 
75     probe = gap + 1
76 
77     while probe > gap:
78         probe = int_from_bytes(
79             data.draw_bytes(nbytes, byte_distribution)
80         ) & mask
81 
82     if center == upper:
83         result = upper - probe
84     elif center == lower:
85         result = lower + probe
86     else:
87         if center + probe <= upper:
88             result = center + probe
89         else:
90             result = upper - probe
91     assert lower <= result <= upper
92     return int(result)
93 
94 
95 def integer_range_with_distribution(data, lower, upper, nums):
96     return integer_range(
97         data, lower, upper, distribution=nums
98     )
99 
100 
101 def centered_integer_range(data, lower, upper, center):
102     return integer_range(
103         data, lower, upper, center=center
104     )
105 
106 
107 def check_sample(values):
108     if not isinstance(values, (Sequence, enum.EnumMeta)):
109         note_deprecation(
110             ('Cannot sample from %r, not a sequence.  ' % (values,)) +
111             'Hypothesis goes to some length to ensure that sampling an '
112             'element from a collection (with `sampled_from` or `choices`) is '
113             'replayable and can be minimised.  To replay a saved example, '
114             'the sampled values must have the same iteration order on every '
115             'run - ruling out sets, dicts, etc due to hash randomisation.  '
116             'Most cases can simply use `sorted(values)`, but mixed types or '
117             'special values such as math.nan require careful handling - and '
118             'note that when simplifying an example, Hypothesis treats '
119             'earlier values as simpler.')
120     return tuple(values)
121 
122 
123 def choice(data, values):
124     return values[integer_range(data, 0, len(values) - 1)]
125 
126 
127 def geometric(data, p):
128     denom = math.log1p(-p)
129     n_bytes = 8
130 
131     def distribution(random, n):
132         assert n == n_bytes
133         for _ in range(100):
134             try:
135                 return int_to_bytes(int(
136                     math.log1p(-random.random()) / denom), n)
137             # This is basically impossible to hit but is required for
138             # correctness
139             except OverflowError:  # pragma: no cover
140                 pass
141         # We got a one in a million chance 100 times in a row. Something is up.
142         assert False  # pragma: no cover
143     return int_from_bytes(data.draw_bytes(n_bytes, distribution))
144 
145 
146 def boolean(data):
147     return bool(n_byte_unsigned(data, 1) & 1)
148 
149 
150 def biased_coin(data, p):
151     def distribution(random, n):
152         assert n == 1
153         return hbytes([int(random.random() <= p)])
154     return bool(
155         data.draw_bytes(1, distribution)[0] & 1
156     )
157 
158 
159 def write(data, string):
160     assert isinstance(string, hbytes)
161 
162     def distribution(random, n):
163         assert n == len(string)
164         return string
165     x = data.draw_bytes(len(string), distribution)
166     if x != string:
167         data.mark_invalid()
168
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/src/hypothesis/internal/conjecture/utils.py b/src/hypothesis/internal/conjecture/utils.py
--- a/src/hypothesis/internal/conjecture/utils.py
+++ b/src/hypothesis/internal/conjecture/utils.py
@@ -19,7 +19,7 @@
 
 import enum
 import math
-from collections import Sequence
+from collections import Sequence, OrderedDict
 
 from hypothesis._settings import note_deprecation
 from hypothesis.internal.compat import hbytes, bit_length, int_to_bytes, \
@@ -105,7 +105,7 @@
 
 
 def check_sample(values):
-    if not isinstance(values, (Sequence, enum.EnumMeta)):
+    if not isinstance(values, (OrderedDict, Sequence, enum.EnumMeta)):
         note_deprecation(
             ('Cannot sample from %r, not a sequence.  ' % (values,)) +
             'Hypothesis goes to some length to ensure that sampling an '
diff --git a/src/hypothesis/version.py b/src/hypothesis/version.py
--- a/src/hypothesis/version.py
+++ b/src/hypothesis/version.py
@@ -17,5 +17,5 @@
 
 from __future__ import division, print_function, absolute_import
 
-__version_info__ = (3, 11, 2)
+__version_info__ = (3, 11, 3)
 __version__ = '.'.join(map(str, __version_info__))

{"golden_diff": "diff --git a/src/hypothesis/internal/conjecture/utils.py b/src/hypothesis/internal/conjecture/utils.py\n--- a/src/hypothesis/internal/conjecture/utils.py\n+++ b/src/hypothesis/internal/conjecture/utils.py\n@@ -19,7 +19,7 @@\n \n import enum\n import math\n-from collections import Sequence\n+from collections import Sequence, OrderedDict\n \n from hypothesis._settings import note_deprecation\n from hypothesis.internal.compat import hbytes, bit_length, int_to_bytes, \\\n@@ -105,7 +105,7 @@\n \n \n def check_sample(values):\n-    if not isinstance(values, (Sequence, enum.EnumMeta)):\n+    if not isinstance(values, (OrderedDict, Sequence, enum.EnumMeta)):\n         note_deprecation(\n             ('Cannot sample from %r, not a sequence.  ' % (values,)) +\n             'Hypothesis goes to some length to ensure that sampling an '\ndiff --git a/src/hypothesis/version.py b/src/hypothesis/version.py\n--- a/src/hypothesis/version.py\n+++ b/src/hypothesis/version.py\n@@ -17,5 +17,5 @@\n \n from __future__ import division, print_function, absolute_import\n \n-__version_info__ = (3, 11, 2)\n+__version_info__ = (3, 11, 3)\n __version__ = '.'.join(map(str, __version_info__))\n", "issue": "Sampled_from() should work with collections.OrderedDict\nOrderedDict should satisfy the replayability requirement, so sampling from it should be possible.\r\nCurrently it raises exception:\r\n`HypothesisDeprecationWarning: Cannot sample from odict_values`\n", "before_files": [{"content": "# coding=utf-8\n#\n# This file is part of Hypothesis, which may be found at\n# https://github.com/HypothesisWorks/hypothesis-python\n#\n# Most of this work is copyright (C) 2013-2017 David R. MacIver\n# (david@drmaciver.com), but it contains contributions by others. See\n# CONTRIBUTING.rst for a full list of people who may hold copyright, and\n# consult the git log if you need to determine who owns an individual\n# contribution.\n#\n# This Source Code Form is subject to the terms of the Mozilla Public License,\n# v. 2.0. If a copy of the MPL was not distributed with this file, You can\n# obtain one at http://mozilla.org/MPL/2.0/.\n#\n# END HEADER\n\nfrom __future__ import division, print_function, absolute_import\n\n__version_info__ = (3, 11, 2)\n__version__ = '.'.join(map(str, __version_info__))\n", "path": "src/hypothesis/version.py"}, {"content": "# coding=utf-8\n#\n# This file is part of Hypothesis, which may be found at\n# https://github.com/HypothesisWorks/hypothesis-python\n#\n# Most of this work is copyright (C) 2013-2017 David R. MacIver\n# (david@drmaciver.com), but it contains contributions by others. See\n# CONTRIBUTING.rst for a full list of people who may hold copyright, and\n# consult the git log if you need to determine who owns an individual\n# contribution.\n#\n# This Source Code Form is subject to the terms of the Mozilla Public License,\n# v. 2.0. If a copy of the MPL was not distributed with this file, You can\n# obtain one at http://mozilla.org/MPL/2.0/.\n#\n# END HEADER\n\nfrom __future__ import division, print_function, absolute_import\n\nimport enum\nimport math\nfrom collections import Sequence\n\nfrom hypothesis._settings import note_deprecation\nfrom hypothesis.internal.compat import hbytes, bit_length, int_to_bytes, \\\n    int_from_bytes\n\n\ndef n_byte_unsigned(data, n):\n    return int_from_bytes(data.draw_bytes(n))\n\n\ndef saturate(n):\n    bits = bit_length(n)\n    k = 1\n    while k < bits:\n        n |= (n >> k)\n        k *= 2\n    return n\n\n\ndef integer_range(data, lower, upper, center=None, distribution=None):\n    assert lower <= upper\n    if lower == upper:\n        return int(lower)\n\n    if center is None:\n        center = lower\n    center = min(max(center, lower), upper)\n    if distribution is None:\n        if lower < center < upper:\n            def distribution(random):\n                if random.randint(0, 1):\n                    return random.randint(center, upper)\n                else:\n                    return random.randint(lower, center)\n        else:\n            def distribution(random):\n                return random.randint(lower, upper)\n\n    gap = upper - lower\n    bits = bit_length(gap)\n    nbytes = bits // 8 + int(bits % 8 != 0)\n    mask = saturate(gap)\n\n    def byte_distribution(random, n):\n        assert n == nbytes\n        v = distribution(random)\n        if v >= center:\n            probe = v - center\n        else:\n            probe = upper - v\n        return int_to_bytes(probe, n)\n\n    probe = gap + 1\n\n    while probe > gap:\n        probe = int_from_bytes(\n            data.draw_bytes(nbytes, byte_distribution)\n        ) & mask\n\n    if center == upper:\n        result = upper - probe\n    elif center == lower:\n        result = lower + probe\n    else:\n        if center + probe <= upper:\n            result = center + probe\n        else:\n            result = upper - probe\n    assert lower <= result <= upper\n    return int(result)\n\n\ndef integer_range_with_distribution(data, lower, upper, nums):\n    return integer_range(\n        data, lower, upper, distribution=nums\n    )\n\n\ndef centered_integer_range(data, lower, upper, center):\n    return integer_range(\n        data, lower, upper, center=center\n    )\n\n\ndef check_sample(values):\n    if not isinstance(values, (Sequence, enum.EnumMeta)):\n        note_deprecation(\n            ('Cannot sample from %r, not a sequence.  ' % (values,)) +\n            'Hypothesis goes to some length to ensure that sampling an '\n            'element from a collection (with `sampled_from` or `choices`) is '\n            'replayable and can be minimised.  To replay a saved example, '\n            'the sampled values must have the same iteration order on every '\n            'run - ruling out sets, dicts, etc due to hash randomisation.  '\n            'Most cases can simply use `sorted(values)`, but mixed types or '\n            'special values such as math.nan require careful handling - and '\n            'note that when simplifying an example, Hypothesis treats '\n            'earlier values as simpler.')\n    return tuple(values)\n\n\ndef choice(data, values):\n    return values[integer_range(data, 0, len(values) - 1)]\n\n\ndef geometric(data, p):\n    denom = math.log1p(-p)\n    n_bytes = 8\n\n    def distribution(random, n):\n        assert n == n_bytes\n        for _ in range(100):\n            try:\n                return int_to_bytes(int(\n                    math.log1p(-random.random()) / denom), n)\n            # This is basically impossible to hit but is required for\n            # correctness\n            except OverflowError:  # pragma: no cover\n                pass\n        # We got a one in a million chance 100 times in a row. Something is up.\n        assert False  # pragma: no cover\n    return int_from_bytes(data.draw_bytes(n_bytes, distribution))\n\n\ndef boolean(data):\n    return bool(n_byte_unsigned(data, 1) & 1)\n\n\ndef biased_coin(data, p):\n    def distribution(random, n):\n        assert n == 1\n        return hbytes([int(random.random() <= p)])\n    return bool(\n        data.draw_bytes(1, distribution)[0] & 1\n    )\n\n\ndef write(data, string):\n    assert isinstance(string, hbytes)\n\n    def distribution(random, n):\n        assert n == len(string)\n        return string\n    x = data.draw_bytes(len(string), distribution)\n    if x != string:\n        data.mark_invalid()\n", "path": "src/hypothesis/internal/conjecture/utils.py"}], "after_files": [{"content": "# coding=utf-8\n#\n# This file is part of Hypothesis, which may be found at\n# https://github.com/HypothesisWorks/hypothesis-python\n#\n# Most of this work is copyright (C) 2013-2017 David R. MacIver\n# (david@drmaciver.com), but it contains contributions by others. See\n# CONTRIBUTING.rst for a full list of people who may hold copyright, and\n# consult the git log if you need to determine who owns an individual\n# contribution.\n#\n# This Source Code Form is subject to the terms of the Mozilla Public License,\n# v. 2.0. If a copy of the MPL was not distributed with this file, You can\n# obtain one at http://mozilla.org/MPL/2.0/.\n#\n# END HEADER\n\nfrom __future__ import division, print_function, absolute_import\n\n__version_info__ = (3, 11, 3)\n__version__ = '.'.join(map(str, __version_info__))\n", "path": "src/hypothesis/version.py"}, {"content": "# coding=utf-8\n#\n# This file is part of Hypothesis, which may be found at\n# https://github.com/HypothesisWorks/hypothesis-python\n#\n# Most of this work is copyright (C) 2013-2017 David R. MacIver\n# (david@drmaciver.com), but it contains contributions by others. See\n# CONTRIBUTING.rst for a full list of people who may hold copyright, and\n# consult the git log if you need to determine who owns an individual\n# contribution.\n#\n# This Source Code Form is subject to the terms of the Mozilla Public License,\n# v. 2.0. If a copy of the MPL was not distributed with this file, You can\n# obtain one at http://mozilla.org/MPL/2.0/.\n#\n# END HEADER\n\nfrom __future__ import division, print_function, absolute_import\n\nimport enum\nimport math\nfrom collections import Sequence, OrderedDict\n\nfrom hypothesis._settings import note_deprecation\nfrom hypothesis.internal.compat import hbytes, bit_length, int_to_bytes, \\\n    int_from_bytes\n\n\ndef n_byte_unsigned(data, n):\n    return int_from_bytes(data.draw_bytes(n))\n\n\ndef saturate(n):\n    bits = bit_length(n)\n    k = 1\n    while k < bits:\n        n |= (n >> k)\n        k *= 2\n    return n\n\n\ndef integer_range(data, lower, upper, center=None, distribution=None):\n    assert lower <= upper\n    if lower == upper:\n        return int(lower)\n\n    if center is None:\n        center = lower\n    center = min(max(center, lower), upper)\n    if distribution is None:\n        if lower < center < upper:\n            def distribution(random):\n                if random.randint(0, 1):\n                    return random.randint(center, upper)\n                else:\n                    return random.randint(lower, center)\n        else:\n            def distribution(random):\n                return random.randint(lower, upper)\n\n    gap = upper - lower\n    bits = bit_length(gap)\n    nbytes = bits // 8 + int(bits % 8 != 0)\n    mask = saturate(gap)\n\n    def byte_distribution(random, n):\n        assert n == nbytes\n        v = distribution(random)\n        if v >= center:\n            probe = v - center\n        else:\n            probe = upper - v\n        return int_to_bytes(probe, n)\n\n    probe = gap + 1\n\n    while probe > gap:\n        probe = int_from_bytes(\n            data.draw_bytes(nbytes, byte_distribution)\n        ) & mask\n\n    if center == upper:\n        result = upper - probe\n    elif center == lower:\n        result = lower + probe\n    else:\n        if center + probe <= upper:\n            result = center + probe\n        else:\n            result = upper - probe\n    assert lower <= result <= upper\n    return int(result)\n\n\ndef integer_range_with_distribution(data, lower, upper, nums):\n    return integer_range(\n        data, lower, upper, distribution=nums\n    )\n\n\ndef centered_integer_range(data, lower, upper, center):\n    return integer_range(\n        data, lower, upper, center=center\n    )\n\n\ndef check_sample(values):\n    if not isinstance(values, (OrderedDict, Sequence, enum.EnumMeta)):\n        note_deprecation(\n            ('Cannot sample from %r, not a sequence.  ' % (values,)) +\n            'Hypothesis goes to some length to ensure that sampling an '\n            'element from a collection (with `sampled_from` or `choices`) is '\n            'replayable and can be minimised.  To replay a saved example, '\n            'the sampled values must have the same iteration order on every '\n            'run - ruling out sets, dicts, etc due to hash randomisation.  '\n            'Most cases can simply use `sorted(values)`, but mixed types or '\n            'special values such as math.nan require careful handling - and '\n            'note that when simplifying an example, Hypothesis treats '\n            'earlier values as simpler.')\n    return tuple(values)\n\n\ndef choice(data, values):\n    return values[integer_range(data, 0, len(values) - 1)]\n\n\ndef geometric(data, p):\n    denom = math.log1p(-p)\n    n_bytes = 8\n\n    def distribution(random, n):\n        assert n == n_bytes\n        for _ in range(100):\n            try:\n                return int_to_bytes(int(\n                    math.log1p(-random.random()) / denom), n)\n            # This is basically impossible to hit but is required for\n            # correctness\n            except OverflowError:  # pragma: no cover\n                pass\n        # We got a one in a million chance 100 times in a row. Something is up.\n        assert False  # pragma: no cover\n    return int_from_bytes(data.draw_bytes(n_bytes, distribution))\n\n\ndef boolean(data):\n    return bool(n_byte_unsigned(data, 1) & 1)\n\n\ndef biased_coin(data, p):\n    def distribution(random, n):\n        assert n == 1\n        return hbytes([int(random.random() <= p)])\n    return bool(\n        data.draw_bytes(1, distribution)[0] & 1\n    )\n\n\ndef write(data, string):\n    assert isinstance(string, hbytes)\n\n    def distribution(random, n):\n        assert n == len(string)\n        return string\n    x = data.draw_bytes(len(string), distribution)\n    if x != string:\n        data.mark_invalid()\n", "path": "src/hypothesis/internal/conjecture/utils.py"}]}