Created
September 14, 2012 16:00
-
-
Save maikroeder/3722865 to your computer and use it in GitHub Desktop.
Pylint brain helper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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