()
Generate sphinx documentation.

        This generates a .rst file for all auto-generated image methods. Use it
        to regenerate the docs with something like::

            $ python -c \
"import pyvips; pyvips.Operation.generate_sphinx_all()" > x

        And copy-paste the file contents into doc/vimage.rst in the appropriate
        place.
Generate sphinx documentation.
Generate sphinx documentation .
def generate_sphinx_all():
        """Generate sphinx documentation.

        This generates a .rst file for all auto-generated image methods. Use it
        to regenerate the docs with something like::

            $ python -c \
"import pyvips; pyvips.Operation.generate_sphinx_all()" > x

        And copy-paste the file contents into doc/vimage.rst in the appropriate
        place.

        """

        # these names are aliased
        alias = ["crop"]
        alias_gtypes = {}
        for name in alias:
            gtype = pyvips.type_find("VipsOperation", name)
            alias_gtypes[gtype] = name

        # all names we can generate docstrings for
        all_names = []

        def add_name(gtype, a, b):
            if gtype in alias_gtypes:
                name = alias_gtypes[gtype]
            else:
                name = nickname_find(gtype)

            try:
                Operation.generate_sphinx(name)
                all_names.append(name)
            except Error:
                pass

            type_map(gtype, add_name)

            return ffi.NULL

        type_map(type_from_name('VipsOperation'), add_name)

        all_names.sort()

        # remove operations we have to wrap by hand
        exclude = ['scale', 'ifthenelse', 'bandjoin', 'bandrank']
        all_names = [x for x in all_names if x not in exclude]

        # Output summary table
        print('.. class:: pyvips.Image\n')
        print('   .. rubric:: Methods\n')
        print('   .. autosummary::')
        print('      :nosignatures:\n')
        for name in all_names:
            print('      ~{0}'.format(name))
        print()

        # Output docs
        print()
        for name in all_names:
            docstr = Operation.generate_sphinx(name)
            docstr = docstr.replace('\n', '\n      ')
            print('   ' + docstr)
def generate_sphinx_all ( ) : # these names are aliased alias = [ "crop" ] alias_gtypes = { } for name in alias : gtype = pyvips . type_find ( "VipsOperation" , name ) alias_gtypes [ gtype ] = name # all names we can generate docstrings for all_names = [ ] def add_name ( gtype , a , b ) : if gtype in alias_gtypes : name = alias_gtypes [ gtype ] else : name = nickname_find ( gtype ) try : Operation . generate_sphinx ( name ) all_names . append ( name ) except Error : pass type_map ( gtype , add_name ) return ffi . NULL type_map ( type_from_name ( 'VipsOperation' ) , add_name ) all_names . sort ( ) # remove operations we have to wrap by hand exclude = [ 'scale' , 'ifthenelse' , 'bandjoin' , 'bandrank' ] all_names = [ x for x in all_names if x not in exclude ] # Output summary table print ( '.. class:: pyvips.Image\n' ) print ( '   .. rubric:: Methods\n' ) print ( '   .. autosummary::' ) print ( '      :nosignatures:\n' ) for name in all_names : print ( '      ~{0}' . format ( name ) ) print ( ) # Output docs print ( ) for name in all_names : docstr = Operation . generate_sphinx ( name ) docstr = docstr . replace ( '\n' , '\n      ' ) print ( '   ' + docstr )