File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change 5454 "FunctionType" ,
5555 "TCallable" ,
5656 "TFunction" ,
57+ "Function" ,
5758 "T" ,
5859 "in_T" ,
5960 "out_T" ,
@@ -109,6 +110,20 @@ def __rand__(self, other: object) -> object:
109110 return Intersection [other , self ]
110111
111112
113+ if TYPE_CHECKING :
114+ Function = Callable [..., object ] # type: ignore[no-any-explicit]
115+ """deprecated, use `AnyCallable`/`AnyFunction` instead. Any ``Callable``.
116+
117+ useful when using mypy with ``disallow-any-explicit``
118+ due to https://github.com/python/mypy/issues/9496
119+
120+ Cannot actually be called unless it's narrowed, so it should only really be used as
121+ a bound in a ``TypeVar``.
122+ """
123+ else :
124+ # for isinstance checks
125+ Function = Callable
126+
112127# Unlike the generics in other modules, these are meant to be imported to save you
113128# from the boilerplate
114129T = TypeVar ("T" )
@@ -137,7 +152,7 @@ def __rand__(self, other: object) -> object:
137152TCallable = TypeVar ("TCallable" , bound = AnyCallable )
138153TFunction = TypeVar ("TFunction" , bound = AnyFunction )
139154Fn = TypeVar ("Fn" , bound = AnyCallable )
140- """this is deprecated, use `TCallable` or `TFunction` instead"""
155+ """deprecated, use `TCallable` or `TFunction` instead"""
141156
142157
143158def _type_convert (arg : object ) -> object :
You can’t perform that action at this time.
0 commit comments