(operation_name)
return result
Make a sphinx-style docstring.

        This is used to generate the off-line docs.
Make a sphinx-style docstring.
Make a sphinx - style docstring .
def generate_sphinx(operation_name):
        """Make a sphinx-style docstring.

        This is used to generate the off-line docs.

        """

        intro = Introspect.get(operation_name)
        if (intro.flags & _OPERATION_DEPRECATED) != 0:
            raise Error('No such operator.',
                        'operator "{0}" is deprecated'.format(operation_name))

        if intro.member_x is not None:
            result = '.. method:: '
        else:
            result = '.. staticmethod:: '
        args = []
        args += intro.method_args
        args += [x + '=' + GValue.gtype_to_python(intro.details[x]['type'])
                 for x in intro.doc_optional_input]
        args += [x + '=bool'
                 for x in intro.doc_optional_output]
        result += operation_name + '(' + ", ".join(args) + ')\n\n'

        result += intro.description[0].upper() + \
            intro.description[1:] + '.\n\n'

        result += 'Example:\n'
        result += '    '
        if len(intro.required_output) > 0:
            result += ', '.join(intro.required_output) + ' = '
        if intro.member_x is not None:
            result += intro.member_x + "." + operation_name + '('
        else:
            result += 'pyvips.Image.' + operation_name + '('
        args = []
        args += intro.method_args
        args += [x + '=' + GValue.gtype_to_python(intro.details[x]['type'])
                 for x in intro.doc_optional_input]
        result += ', '.join(args)
        result += ')\n\n'

        for name in intro.method_args + intro.doc_optional_input:
            details = intro.details[name]
            result += (':param {0}: {1}\n'.
                       format(name, details['blurb']))
            result += (':type {0}: {1}\n'.
                       format(name, GValue.gtype_to_python(details['type'])))
        for name in intro.doc_optional_output:
            result += (':param {0}: enable output: {1}\n'.
                       format(name, intro.details[name]['blurb']))
            result += (':type {0}: bool\n'.format(name))

        output_types = [GValue.gtype_to_python(intro.details[name]['type'])
                        for name in intro.required_output]
        if len(output_types) == 1:
            output_type = output_types[0]
        else:
            output_type = 'list[' + ', '.join(output_types) + ']'

        if len(intro.doc_optional_output) > 0:
            output_types += ['Dict[str, mixed]']
            output_type += ' or list[' + ', '.join(output_types) + ']'

        result += ':rtype: ' + output_type + '\n'
        result += ':raises Error:\n'

        return result
def generate_sphinx ( operation_name ) : intro = Introspect . get ( operation_name ) if ( intro . flags & _OPERATION_DEPRECATED ) != 0 : raise Error ( 'No such operator.' , 'operator "{0}" is deprecated' . format ( operation_name ) ) if intro . member_x is not None : result = '.. method:: ' else : result = '.. staticmethod:: ' args = [ ] args += intro . method_args args += [ x + '=' + GValue . gtype_to_python ( intro . details [ x ] [ 'type' ] ) for x in intro . doc_optional_input ] args += [ x + '=bool' for x in intro . doc_optional_output ] result += operation_name + '(' + ", " . join ( args ) + ')\n\n' result += intro . description [ 0 ] . upper ( ) + intro . description [ 1 : ] + '.\n\n' result += 'Example:\n' result += '    ' if len ( intro . required_output ) > 0 : result += ', ' . join ( intro . required_output ) + ' = ' if intro . member_x is not None : result += intro . member_x + "." + operation_name + '(' else : result += 'pyvips.Image.' + operation_name + '(' args = [ ] args += intro . method_args args += [ x + '=' + GValue . gtype_to_python ( intro . details [ x ] [ 'type' ] ) for x in intro . doc_optional_input ] result += ', ' . join ( args ) result += ')\n\n' for name in intro . method_args + intro . doc_optional_input : details = intro . details [ name ] result += ( ':param {0}: {1}\n' . format ( name , details [ 'blurb' ] ) ) result += ( ':type {0}: {1}\n' . format ( name , GValue . gtype_to_python ( details [ 'type' ] ) ) ) for name in intro . doc_optional_output : result += ( ':param {0}: enable output: {1}\n' . format ( name , intro . details [ name ] [ 'blurb' ] ) ) result += ( ':type {0}: bool\n' . format ( name ) ) output_types = [ GValue . gtype_to_python ( intro . details [ name ] [ 'type' ] ) for name in intro . required_output ] if len ( output_types ) == 1 : output_type = output_types [ 0 ] else : output_type = 'list[' + ', ' . join ( output_types ) + ']' if len ( intro . doc_optional_output ) > 0 : output_types += [ 'Dict[str, mixed]' ] output_type += ' or list[' + ', ' . join ( output_types ) + ']' result += ':rtype: ' + output_type + '\n' result += ':raises Error:\n' return result