sphinx/ext/autodoc/type_comment.py
def update_annotations_using_type_comments(app: Sphinx, obj: Any, bound_method: bool) -> None:
    """Update annotations info of *obj* using type_comments."""
    try:
        type_sig = get_type_comment(obj, bound_method)
        if type_sig:
            sig = inspect.signature(obj, bound_method)
            for param in sig.parameters.values():
                if param.name not in obj.__annotations__:
                    annotation = type_sig.parameters[param.name].annotation
                    if annotation is not Parameter.empty:
                        obj.__annotations__[param.name] = ast_unparse(annotation)

            if 'return' not in obj.__annotations__:
                obj.__annotations__['return'] = type_sig.return_annotation
    except KeyError as exc:
        logger.warning(__("Failed to update signature for %r: parameter not found: %s"),
                       obj, exc)
    except NotImplementedError as exc:  # failed to ast.unparse()
        logger.warning(__("Failed to parse type_comment for %r: %s"), obj, exc)
Update annotations info of *obj* using type_comments.
Update annotations info of *obj* using type_comments.
Update annotations info of * obj * using type_comments .
def update_annotations_using_type_comments(app: Sphinx, obj: Any, bound_method: bool) -> None:
    try:
        type_sig = get_type_comment(obj, bound_method)
        if type_sig:
            sig = inspect.signature(obj, bound_method)
            for param in sig.parameters.values():
                if param.name not in obj.__annotations__:
                    annotation = type_sig.parameters[param.name].annotation
                    if annotation is not Parameter.empty:
                        obj.__annotations__[param.name] = ast_unparse(annotation)
            if 'return' not in obj.__annotations__:
                obj.__annotations__['return'] = type_sig.return_annotation
    except KeyError as exc:
        logger.warning(__("Failed to update signature for %r: parameter not found: %s"),
                       obj, exc)
    except NotImplementedError as exc:  
        logger.warning(__("Failed to parse type_comment for %r: %s"), obj, exc)
def update_annotations_using_type_comments ( app : Sphinx , obj : Any , bound_method : bool ) -> None : try : type_sig = get_type_comment ( obj , bound_method ) if type_sig : sig = inspect . signature ( obj , bound_method ) for param in sig . parameters . values ( ) : if param . name not in obj . __annotations__ : annotation = type_sig . parameters [ param . name ] . annotation if annotation is not Parameter . empty : obj . __annotations__ [ param . name ] = ast_unparse ( annotation ) if 'return' not in obj . __annotations__ : obj . __annotations__ [ 'return' ] = type_sig . return_annotation except KeyError as exc : logger . warning ( __ ( "Failed to update signature for %r: parameter not found: %s" ) , obj , exc ) except NotImplementedError as exc : logger . warning ( __ ( "Failed to parse type_comment for %r: %s" ) , obj , exc )
Update annotations info of *obj* using type_comments.
Update annotations info of * obj * using type_comments .
"""Update annotations info of *obj* using type_comments.""" # failed to ast.unparse()
app
Sphinx
obj
Any
bound_method
bool