• strict warning: Non-static method view::load() should not be called statically in /home/saturn/public_html/blog/sites/all/modules/views/views.module on line 906.
  • strict warning: Declaration of views_handler_filter::options_validate() should be compatible with views_handler::options_validate($form, &$form_state) in /home/saturn/public_html/blog/sites/all/modules/views/handlers/views_handler_filter.inc on line 607.
  • strict warning: Declaration of views_handler_filter::options_submit() should be compatible with views_handler::options_submit($form, &$form_state) in /home/saturn/public_html/blog/sites/all/modules/views/handlers/views_handler_filter.inc on line 607.
  • strict warning: Declaration of views_handler_filter_boolean_operator::value_validate() should be compatible with views_handler_filter::value_validate($form, &$form_state) in /home/saturn/public_html/blog/sites/all/modules/views/handlers/views_handler_filter_boolean_operator.inc on line 159.
  • strict warning: Declaration of views_plugin_style_default::options() should be compatible with views_object::options() in /home/saturn/public_html/blog/sites/all/modules/views/plugins/views_plugin_style_default.inc on line 24.
  • strict warning: Declaration of views_plugin_row::options_validate() should be compatible with views_plugin::options_validate(&$form, &$form_state) in /home/saturn/public_html/blog/sites/all/modules/views/plugins/views_plugin_row.inc on line 134.
  • strict warning: Declaration of views_plugin_row::options_submit() should be compatible with views_plugin::options_submit(&$form, &$form_state) in /home/saturn/public_html/blog/sites/all/modules/views/plugins/views_plugin_row.inc on line 134.

This is a quick, simple and dirty script to extract the contents of a Python module and store it in a QScintilla/Eric4 API file.

#!/usr/bin/env python

api-gen 0.1
This is a quick, simple and dirty script to extract the contents of a
Python module and store it in a QScintilla/Eric4 API file.

Replace all instances of "mymodule" with your module name.

Written by Raoul Snyman [raoul.snyman AT saturnlaboratories DOT co DOT za]

Copyright (c) 2009 Raoul Snyman. All rights reserved.

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

import inspect
# Put your module here
import mymodule

# These Python core modules are often imported into modules, and due
# to the way this script works, all extra modules are pulled in as
# well. This is a list of modules you want to exclude from your API
# file. Append any modules you don't want in your API file.
exclude = ['os', 'sys', 're', 'logging', 'types', 'pkg_resources',
    'warnings', 'inspect']

def get_members(mod, hierarchy, filehandle=None):
    This function runs through a given module and pulls out all the
    classes, methods, and attributes. It then calls itself recursively
    in order to pull out the sub-modules, -classes and -attributes.
    for mname, mobject in inspect.getmembers(mod):
        if mname in exclude:
        object_path = '%s.%s' % (hierarchy, mname)
        if filehandle is not None:
            filehandle.write(object_path + '\n')
            print object_path
        if (not (mname.startswith('_') or inspect.isbuiltin(mobject))) and \
            (inspect.ismodule(mobject) or inspect.isclass(mobject)) and \
            mname not in hierarchy.split('.'):
            get_members(mobject, object_path, filehandle)

if __name__ == '__main__':
    # Put your api file name here
    filehandle = open('mymodule.api', 'w')
    # Put your module here
    get_members(mymodule, 'mymodule', filehandle)