'Format the signature (arguments and return annotation) of the object.
Let the user process it via the ``autodoc-process-signature`` event.'

def format_signature(self):

    if (self.args is not None):
        args = ('(%s)' % self.args)
    else:
        try:
            args = self.format_args()
        except Exception as err:
            self.directive.warn(('error    while    formatting    arguments    for    %s:    %s' % (self.fullname, err)))
            args = None
    retann = self.retann
    result = self.env.app.emit_firstresult('autodoc-process-signature', self.objtype, self.fullname, self.object, self.options, args, retann)
    if result:
        (args, retann) = result
    if (args is not None):
        return (args + ((retann and ('    ->    %s' % retann)) or ''))
    else:
        return ''
