Author: cfbolz
Date: Tue Jan 9 12:21:14 2007
New Revision: 36334
Added:
py/dist/py/misc/findmissingdocstrings.py (contents, props changed)
Log:
add a small helper script that finds missing docstrings of exported things
Added: py/dist/py/misc/findmissingdocstrings.py
==============================================================================
--- (empty file)
+++ py/dist/py/misc/findmissingdocstrings.py Tue Jan 9 12:21:14 2007
@@ -0,0 +1,26 @@
+#!/usr/bin/env python
+
+import py
+
+def report_if_missing(name, obj):
+ if obj.__doc__ is None:
+ print "%s misses a docstring" % (name, )
+ if obj.__doc__ == "":
+ print "%s has an empty" % (name, )
+
+if __name__ == '__main__':
+ stack = [(name, getattr(py, name)) for name in dir(py)[::-1]
+ if not name.startswith("__") and name != "compat"]
+ seen = {}
+ while stack:
+ name, obj = stack.pop()
+ if id(obj) in seen:
+ continue
+ else:
+ seen[id(obj)] = True
+ if callable(obj):
+ report_if_missing(name, obj)
+ if isinstance(obj, type) or isinstance(obj, type(py)):
+ stack.extend([("%s.%s" % (name, s), getattr(obj, s)) for s in dir(obj)
+ if len(s) <= 1 or not (s[0] == '_' and s[1] != '_')])
+