@@ -53,7 +53,7 @@ def unwrap(obj: Any) -> Any:
5353 return obj
5454
5555
56- def unwrap_all (obj : Any , * , stop : Callable | None = None ) -> Any :
56+ def unwrap_all (obj : Any , * , stop : Callable [[ Any ], bool ] | None = None ) -> Any :
5757 """
5858 Get an original object from wrapped object (unwrapping partials, wrapped
5959 functions, and other decorators).
@@ -352,7 +352,7 @@ def safe_getattr(obj: Any, name: str, *defargs: Any) -> Any:
352352 raise AttributeError (name ) from exc
353353
354354
355- def object_description (obj : Any , * , _seen : frozenset = frozenset ()) -> str :
355+ def object_description (obj : Any , * , _seen : frozenset [ int ] = frozenset ()) -> str :
356356 """A repr() implementation that returns text safe to use in reST context.
357357
358358 Maintains a set of 'seen' object IDs to detect and avoid infinite recursion.
@@ -546,8 +546,9 @@ def _should_unwrap(subject: Callable) -> bool:
546546 return False
547547
548548
549- def signature (subject : Callable , bound_method : bool = False , type_aliases : dict | None = None ,
550- ) -> inspect .Signature :
549+ def signature (
550+ subject : Callable , bound_method : bool = False , type_aliases : dict [str , str ] | None = None ,
551+ ) -> inspect .Signature :
551552 """Return a Signature object for the given *subject*.
552553
553554 :param bound_method: Specify *subject* is a bound method or not
@@ -604,15 +605,19 @@ def signature(subject: Callable, bound_method: bool = False, type_aliases: dict
604605 __validate_parameters__ = False )
605606
606607
607- def evaluate_signature (sig : inspect .Signature , globalns : dict | None = None ,
608- localns : dict | None = None ,
608+ def evaluate_signature (sig : inspect .Signature , globalns : dict [ str , Any ] | None = None ,
609+ localns : dict [ str , Any ] | None = None ,
609610 ) -> inspect .Signature :
610611 """Evaluate unresolved type annotations in a signature object."""
611- def evaluate_forwardref (ref : ForwardRef , globalns : dict , localns : dict ) -> Any :
612+ def evaluate_forwardref (
613+ ref : ForwardRef , globalns : dict [str , Any ] | None , localns : dict [str , Any ] | None ,
614+ ) -> Any :
612615 """Evaluate a forward reference."""
613616 return ref ._evaluate (globalns , localns , frozenset ())
614617
615- def evaluate (annotation : Any , globalns : dict , localns : dict ) -> Any :
618+ def evaluate (
619+ annotation : Any , globalns : dict [str , Any ], localns : dict [str , Any ],
620+ ) -> Any :
616621 """Evaluate unresolved type annotation."""
617622 try :
618623 if isinstance (annotation , str ):
@@ -799,7 +804,9 @@ def getdoc(
799804 * inherited docstring
800805 * inherited decorated methods
801806 """
802- def getdoc_internal (obj : Any , attrgetter : Callable = safe_getattr ) -> str | None :
807+ def getdoc_internal (
808+ obj : Any , attrgetter : Callable [[Any , str , Any ], Any ] = safe_getattr ,
809+ ) -> str | None :
803810 doc = attrgetter (obj , '__doc__' , None )
804811 if isinstance (doc , str ):
805812 return doc
0 commit comments