En Mon, 09 Mar 2009 15:51:01 -0200, Tim Michelsen <timmichel...@gmx-topmail.de> escribió:

is there a scipt or any other possibility to create a list of all undocumente functions (without docstrings) within a package or at least module?

You may customize this to your needs:

<code>
import inspect

def find_undocumented(module):
  modname = module.__name__
  for name in dir(module):
    obj = getattr(module, name)
    if inspect.isclass(obj) and not issubclass(obj, BaseException):
      if getattr(obj, '__module__') == modname:
        if not getattr(obj, '__doc__'):
          yield obj
    elif inspect.isfunction(obj):
      if getattr(obj, 'func_globals', {}).get('__name__') == modname:
        if not getattr(obj, '__doc__'):
          yield obj
</code>

import httplib
for obj in find_undocumented(httplib):
  print repr(obj)

<function FakeSocket at 0x00C649F0>
<class httplib.HTTPConnection at 0x00C153C0>
<class httplib.HTTPMessage at 0x00BFB150>
<class httplib.HTTPResponse at 0x00C15390>

--
Gabriel Genellina

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to