Skip to content

Instantly share code, notes, and snippets.

@maikroeder
Created September 14, 2012 16:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maikroeder/3722865 to your computer and use it in GitHub Desktop.
Save maikroeder/3722865 to your computer and use it in GitHub Desktop.
Pylint brain helper
import mechanize
import inspect
for myclass in inspect.getmembers(mechanize, inspect.isclass):
for mymethod in inspect.getmembers(myclass[1], inspect.ismethod):
if mymethod[0] == '__init__':
pass
elif mymethod[0].startswith('_'):
continue
elif mymethod[0].startswith('__') and mymethod[0].endswith('__'):
continue
signature = inspect.getargspec(mymethod[1]).args
if signature[0] == 'self':
signature = signature[1:]
newsignature = []
for sig in signature:
newsignature.append("%s=None" %sig)
signature = ', '.join(newsignature)
if mymethod[0] == '__init__':
print 'dummy = mechanize.' + myclass[0] + '(' + signature + ')'
else:
print 'dummy' + '.' + mymethod[0] + '(' + signature + ')'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment