2 # started from http://www.logilab.org/blogentry/78354
5 from logilab.astng import MANAGER
6 from logilab.astng.builder import ASTNGBuilder
8 def hashlib_transform(module):
9 if module.name == 'hashlib':
10 fake = ASTNGBuilder(MANAGER).string_build('''
12 class fakehash(object):
14 def __init__(self, value): pass
19 def update(self, value): pass
27 class sha256(fakehash):
31 for hashfunc in ('sha256', 'sha1', 'md5'):
32 module.locals[hashfunc] = fake.locals[hashfunc]
35 """called when loaded by pylint --load-plugins, register our tranformation
38 MANAGER.register_transformer(hashlib_transform)