hypothesis 6.135.17__py3-none-any.whl → 6.135.19__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- hypothesis/core.py +9 -5
- hypothesis/internal/entropy.py +5 -3
- hypothesis/internal/reflection.py +7 -3
- hypothesis/utils/threading.py +44 -0
- hypothesis/version.py +1 -1
- {hypothesis-6.135.17.dist-info → hypothesis-6.135.19.dist-info}/METADATA +1 -1
- {hypothesis-6.135.17.dist-info → hypothesis-6.135.19.dist-info}/RECORD +11 -10
- {hypothesis-6.135.17.dist-info → hypothesis-6.135.19.dist-info}/WHEEL +0 -0
- {hypothesis-6.135.17.dist-info → hypothesis-6.135.19.dist-info}/entry_points.txt +0 -0
- {hypothesis-6.135.17.dist-info → hypothesis-6.135.19.dist-info}/licenses/LICENSE.txt +0 -0
- {hypothesis-6.135.17.dist-info → hypothesis-6.135.19.dist-info}/top_level.txt +0 -0
hypothesis/core.py
CHANGED
@@ -140,6 +140,7 @@ from hypothesis.strategies._internal.strategies import (
|
|
140
140
|
SearchStrategy,
|
141
141
|
check_strategy,
|
142
142
|
)
|
143
|
+
from hypothesis.utils.threading import ThreadLocal
|
143
144
|
from hypothesis.vendor.pretty import RepresentationPrinter
|
144
145
|
from hypothesis.version import __version__
|
145
146
|
|
@@ -149,7 +150,11 @@ TestFunc = TypeVar("TestFunc", bound=Callable)
|
|
149
150
|
running_under_pytest = False
|
150
151
|
pytest_shows_exceptiongroups = True
|
151
152
|
global_force_seed = None
|
152
|
-
|
153
|
+
# `threadlocal` stores "engine-global" constants, which are global relative to a
|
154
|
+
# ConjectureRunner instance (roughly speaking). Since only one conjecture runner
|
155
|
+
# instance can be active per thread, making engine constants thread-local prevents
|
156
|
+
# the ConjectureRunner instances of concurrent threads from treading on each other.
|
157
|
+
threadlocal = ThreadLocal(_hypothesis_global_random=None)
|
153
158
|
|
154
159
|
|
155
160
|
@dataclass
|
@@ -703,10 +708,9 @@ def get_random_for_wrapped_test(test, wrapped_test):
|
|
703
708
|
elif global_force_seed is not None:
|
704
709
|
return Random(global_force_seed)
|
705
710
|
else:
|
706
|
-
|
707
|
-
|
708
|
-
|
709
|
-
seed = _hypothesis_global_random.getrandbits(128)
|
711
|
+
if threadlocal._hypothesis_global_random is None: # pragma: no cover
|
712
|
+
threadlocal._hypothesis_global_random = Random()
|
713
|
+
seed = threadlocal._hypothesis_global_random.getrandbits(128)
|
710
714
|
wrapped_test._hypothesis_internal_use_generated_seed = seed
|
711
715
|
return Random(seed)
|
712
716
|
|
hypothesis/internal/entropy.py
CHANGED
@@ -195,9 +195,11 @@ def deterministic_PRNG(seed: int = 0) -> Generator[None, None, None]:
|
|
195
195
|
bad idea in principle, and breaks all kinds of independence assumptions
|
196
196
|
in practice.
|
197
197
|
"""
|
198
|
-
if
|
199
|
-
hypothesis.core._hypothesis_global_random
|
200
|
-
|
198
|
+
if (
|
199
|
+
hypothesis.core.threadlocal._hypothesis_global_random is None
|
200
|
+
): # pragma: no cover
|
201
|
+
hypothesis.core.threadlocal._hypothesis_global_random = random.Random()
|
202
|
+
register_random(hypothesis.core.threadlocal._hypothesis_global_random)
|
201
203
|
|
202
204
|
seed_all, restore_all = get_seeder_and_restorer(seed)
|
203
205
|
seed_all()
|
@@ -330,9 +330,13 @@ def _extract_lambda_source(f):
|
|
330
330
|
source = LINE_CONTINUATION.sub(" ", source)
|
331
331
|
source = WHITESPACE.sub(" ", source)
|
332
332
|
source = source.strip()
|
333
|
-
if "lambda" not in source
|
334
|
-
|
335
|
-
|
333
|
+
if "lambda" not in source: # pragma: no cover
|
334
|
+
# If a user starts a hypothesis process, then edits their code, the lines
|
335
|
+
# in the parsed source code might not match the live __code__ objects.
|
336
|
+
#
|
337
|
+
# (and on sys.platform == "emscripten", this can happen regardless
|
338
|
+
# due to a pyodide bug in inspect.getsource()).
|
339
|
+
return if_confused
|
336
340
|
|
337
341
|
tree = None
|
338
342
|
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# This file is part of Hypothesis, which may be found at
|
2
|
+
# https://github.com/HypothesisWorks/hypothesis/
|
3
|
+
#
|
4
|
+
# Copyright the Hypothesis Authors.
|
5
|
+
# Individual contributors are listed in AUTHORS.rst and the git log.
|
6
|
+
#
|
7
|
+
# This Source Code Form is subject to the terms of the Mozilla Public License,
|
8
|
+
# v. 2.0. If a copy of the MPL was not distributed with this file, You can
|
9
|
+
# obtain one at https://mozilla.org/MPL/2.0/.
|
10
|
+
|
11
|
+
import threading
|
12
|
+
from typing import Any
|
13
|
+
|
14
|
+
|
15
|
+
class ThreadLocal:
|
16
|
+
"""
|
17
|
+
Manages thread-local state. ThreadLocal forwards getattr and setattr to a
|
18
|
+
threading.local() instance. The passed kwargs defines the available attributes
|
19
|
+
on the threadlocal and their default values.
|
20
|
+
|
21
|
+
The only supported names to geattr and setattr are the keys of the passed kwargs.
|
22
|
+
"""
|
23
|
+
|
24
|
+
def __init__(self, **kwargs: Any) -> None:
|
25
|
+
self.__initialized = False
|
26
|
+
self.__kwargs = kwargs
|
27
|
+
self.__threadlocal = threading.local()
|
28
|
+
self.__initialized = True
|
29
|
+
|
30
|
+
def __getattr__(self, name: str) -> Any:
|
31
|
+
if name not in self.__kwargs:
|
32
|
+
raise AttributeError(f"No attribute {name}")
|
33
|
+
if not hasattr(self.__threadlocal, name):
|
34
|
+
setattr(self.__threadlocal, name, self.__kwargs[name])
|
35
|
+
return getattr(self.__threadlocal, name)
|
36
|
+
|
37
|
+
def __setattr__(self, name: str, value: Any) -> None:
|
38
|
+
# disable attribute-forwarding while initializing
|
39
|
+
if "_ThreadLocal__initialized" not in self.__dict__ or not self.__initialized:
|
40
|
+
super().__setattr__(name, value)
|
41
|
+
else:
|
42
|
+
if name not in self.__kwargs:
|
43
|
+
raise AttributeError(f"No attribute {name}")
|
44
|
+
setattr(self.__threadlocal, name, value)
|
hypothesis/version.py
CHANGED
@@ -5,7 +5,7 @@ hypothesis/__init__.py,sha256=-l2jKA8BwEWYTJoebvxmhJjA3M_K9qsMRu5CCNVCDFs,1624
|
|
5
5
|
hypothesis/_settings.py,sha256=FGEckgd43ifGBrGcP8pN0YiVu74ZZl2IqghgUZBPUPI,39049
|
6
6
|
hypothesis/configuration.py,sha256=ruHxaoUFm9_gjyFhloszHF8wt-_yW8FQtWfMXFLwdzc,4341
|
7
7
|
hypothesis/control.py,sha256=6zyn0hDDOt5FugCpD2vw1UJFn3uYwd7lpYqMLoHpOgQ,12625
|
8
|
-
hypothesis/core.py,sha256=
|
8
|
+
hypothesis/core.py,sha256=G-5p82IP8hPK6tUT3ld8l87v3kb3mVylfg2nhkXOGvU,93044
|
9
9
|
hypothesis/database.py,sha256=qbiow_zUTUVUzvUa0OlCmkvrBRTyGxA7cTscIn6q_B0,47299
|
10
10
|
hypothesis/entry_points.py,sha256=aY9iTAiu1GaLljqqXFcMBgipZQ60RBOwwvPVmEr1lQE,1440
|
11
11
|
hypothesis/errors.py,sha256=fci2Xe3kUIEBZ92361vot2f7IRjtfEn1aI1Bdf8vfRU,10048
|
@@ -14,7 +14,7 @@ hypothesis/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
14
14
|
hypothesis/reporting.py,sha256=f-jhl1JfAi5_tG8dsUd2qDjGcPdvxEzfF6hXmpTFQ1g,1761
|
15
15
|
hypothesis/stateful.py,sha256=33U0FtVuRnY5EzIiCL50SHAT6ZPe1n2pbaohkxTF6gc,42955
|
16
16
|
hypothesis/statistics.py,sha256=kZ5mc0fAg7gnSO6EmDo82fyz8DYhIiJ_mHe7srxOeQ0,5438
|
17
|
-
hypothesis/version.py,sha256=
|
17
|
+
hypothesis/version.py,sha256=S3xcAe4gNNcLo3Zygfy6li9vXZWLSfIvbT1nfuoKQXs,499
|
18
18
|
hypothesis/extra/__init__.py,sha256=gx4ENVDkrzBxy5Lv3Iyfs3tvMGdWMbiHfi95B7t61CY,415
|
19
19
|
hypothesis/extra/_array_helpers.py,sha256=PLmFckBfQpzQ4Q3dFJQqMmrbm7Qdvqxf1t9LHDCuSp0,27627
|
20
20
|
hypothesis/extra/_patching.py,sha256=A5s5EAf81itr--w4SAFyzuecSZm4eT397jM7BvbnQXU,12385
|
@@ -42,14 +42,14 @@ hypothesis/internal/compat.py,sha256=CexhnEVndODX3E-iJmBzt_svqLmADF_6vWkd7lXLRQI
|
|
42
42
|
hypothesis/internal/constants_ast.py,sha256=VcItL6O6LbNd-NpunBuonKE9rLNVVxNlOfTDY8Lqci0,10189
|
43
43
|
hypothesis/internal/coverage.py,sha256=u2ALnaYgwd2jSkZkA5aQYA1uMnk7gwaasMJbq_l3iIg,3380
|
44
44
|
hypothesis/internal/detection.py,sha256=v_zf0GYsnfJKQMNw78qYv61Dh-YaXXfgqKpVIOsBvfw,1228
|
45
|
-
hypothesis/internal/entropy.py,sha256=
|
45
|
+
hypothesis/internal/entropy.py,sha256=Bbjwg3TEGBt4i3gdcDUItBuqNJqDoXsXy2AIFuIcBwQ,8066
|
46
46
|
hypothesis/internal/escalation.py,sha256=z2WOTh1MRRT_3OhwX3kEU4EW_oAWDPHFW2S4ynoh5G0,6805
|
47
47
|
hypothesis/internal/filtering.py,sha256=L4zxZmeMzvg-y3LUn-6zJ149pbENcixNUYfCG8iYrhg,13814
|
48
48
|
hypothesis/internal/floats.py,sha256=0roRf0uHc-2sslppMGoFd--QFCeoO9PcdsM0ltgcQUc,7195
|
49
49
|
hypothesis/internal/healthcheck.py,sha256=JbCvnqtnulVne3egNMWY8koRqeKqhB8P0Wm0jn34As4,1130
|
50
50
|
hypothesis/internal/intervalsets.py,sha256=hlg3wQ5vYYbyEpQe8g_3MxwHSJ1wzS3_ccma259jE5E,11952
|
51
51
|
hypothesis/internal/observability.py,sha256=X2w1_CfpLZoSHGGHVRBEhxEpkjCTbie_Uyz5x4B5K_M,14291
|
52
|
-
hypothesis/internal/reflection.py,sha256=
|
52
|
+
hypothesis/internal/reflection.py,sha256=FvfsIXKIlVoG3w_l26E55Y59hg0mqXyrsbiaIkfditM,25429
|
53
53
|
hypothesis/internal/scrutineer.py,sha256=OtkCbUI8XIsVdOzo5oU_4vfINCggNNM-DjrLNOfYIOQ,11531
|
54
54
|
hypothesis/internal/validation.py,sha256=jLs1GGf9Jf5Qp_g8JRZR8VGcV_ICw9wXsWIN5fb1WA8,4168
|
55
55
|
hypothesis/internal/conjecture/__init__.py,sha256=gx4ENVDkrzBxy5Lv3Iyfs3tvMGdWMbiHfi95B7t61CY,415
|
@@ -102,12 +102,13 @@ hypothesis/utils/__init__.py,sha256=OKsQ90RrxP9FV66bIPVssiyUCrxloT--0ejboL-lbLM,
|
|
102
102
|
hypothesis/utils/conventions.py,sha256=qSoaFgYarQZ7aTXFeRwK-CZEKVQGIED_nTVoFjGJpZc,701
|
103
103
|
hypothesis/utils/dynamicvariables.py,sha256=bhNCs8UU84ZUtsqd4SDzGbsnhk5qWqoIpHsa8H_463o,1144
|
104
104
|
hypothesis/utils/terminal.py,sha256=IxGYDGaE4R3b_vMfz5buWbN18XH5qVP4IxqAgNAU5as,1406
|
105
|
+
hypothesis/utils/threading.py,sha256=i5xB_OJJyCvaLb_mhxXgIqXfweMnNzeYExhCO93NV-c,1711
|
105
106
|
hypothesis/vendor/__init__.py,sha256=gx4ENVDkrzBxy5Lv3Iyfs3tvMGdWMbiHfi95B7t61CY,415
|
106
107
|
hypothesis/vendor/pretty.py,sha256=WEZC-UV-QQgCjUf2Iz1WWaWnbgT7Hc3s-GWEVxq-Qz0,36114
|
107
108
|
hypothesis/vendor/tlds-alpha-by-domain.txt,sha256=W9hYvpu2BMmNgE-SfPp8-GTzEVjw0HJUviqlvHwpZu8,9588
|
108
|
-
hypothesis-6.135.
|
109
|
-
hypothesis-6.135.
|
110
|
-
hypothesis-6.135.
|
111
|
-
hypothesis-6.135.
|
112
|
-
hypothesis-6.135.
|
113
|
-
hypothesis-6.135.
|
109
|
+
hypothesis-6.135.19.dist-info/licenses/LICENSE.txt,sha256=rIkDe6xjVQZE3OjPMsZ2Xl-rncGhzpS4n4qAXzQaZ1A,17141
|
110
|
+
hypothesis-6.135.19.dist-info/METADATA,sha256=QPlfCg_EhB8QJdBDWhixyCRJCc2Ob2aSI9W_U7RwwQM,5638
|
111
|
+
hypothesis-6.135.19.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
112
|
+
hypothesis-6.135.19.dist-info/entry_points.txt,sha256=JDoUs9w1bYme7aG_eJ1cCtstRTWD71BzG8iRi-G2eHE,113
|
113
|
+
hypothesis-6.135.19.dist-info/top_level.txt,sha256=ReGreaueiJ4d1I2kEiig_CLeA0sD4QCQ4qk_8kH1oDc,81
|
114
|
+
hypothesis-6.135.19.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|