File tree Expand file tree Collapse file tree 3 files changed +13
-5
lines changed Expand file tree Collapse file tree 3 files changed +13
-5
lines changed Original file line number Diff line number Diff line change
1
+ RELEASE_TYPE: patch
2
+
3
+ This patch improves annotations on some of Hypothesis' internal functions, in order to
4
+ deobfuscate the signatures of some strategies. In particular, strategies shared between
5
+ :ref: `hypothesis.extra.numpy <hypothesis-numpy >` and
6
+ :ref: `the hypothesis.extra.array_api extra <array-api >` will benefit from this patch.
Original file line number Diff line number Diff line change 26
26
from functools import wraps
27
27
from tokenize import detect_encoding
28
28
from types import ModuleType
29
- from typing import Callable , TypeVar
29
+ from typing import TYPE_CHECKING , Callable
30
30
31
31
from hypothesis .internal .compat import is_typed_named_tuple , update_code_location
32
32
from hypothesis .vendor .pretty import pretty
33
33
34
- C = TypeVar ("C" , bound = Callable )
34
+ if TYPE_CHECKING :
35
+ from hypothesis .strategies ._internal .strategies import T
36
+
35
37
READTHEDOCS = os .environ .get ("READTHEDOCS" , None ) == "True"
36
38
37
39
@@ -570,9 +572,9 @@ def accept(f):
570
572
return accept
571
573
572
574
573
- def proxies (target ) :
575
+ def proxies (target : "T" ) -> Callable [[ Callable ], "T" ] :
574
576
replace_sig = define_function_signature (
575
- target .__name__ .replace ("<lambda>" , "_lambda_" ),
577
+ target .__name__ .replace ("<lambda>" , "_lambda_" ), # type: ignore
576
578
target .__doc__ ,
577
579
getfullargspec_except_self (target ),
578
580
)
Original file line number Diff line number Diff line change @@ -85,7 +85,7 @@ def cached_strategy(*args, **kwargs):
85
85
cache [cache_key ] = result
86
86
return result
87
87
88
- cached_strategy .__clear_cache = clear_cache
88
+ cached_strategy .__clear_cache = clear_cache # type: ignore
89
89
return cached_strategy
90
90
91
91
You can’t perform that action at this time.
0 commit comments