summaryrefslogtreecommitdiff
path: root/brain/py2stdlib.py
diff options
context:
space:
mode:
authorSylvain Thénault <sylvain.thenault@logilab.fr>2013-06-18 18:18:45 +0200
committerSylvain Thénault <sylvain.thenault@logilab.fr>2013-06-18 18:18:45 +0200
commit97c3f5dddd151494effe5150663f83c71e77354c (patch)
tree566cbe4ef5dfc41a23d8af3824c059b15cbe6e6a /brain/py2stdlib.py
parentfc02b9e6bc453e0413e324c7a458b5871277744c (diff)
downloadastroid-git-97c3f5dddd151494effe5150663f83c71e77354c.tar.gz
[transforms] allow transformation functions on any nodes, not only modules
Diffstat (limited to 'brain/py2stdlib.py')
-rw-r--r--brain/py2stdlib.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/brain/py2stdlib.py b/brain/py2stdlib.py
index 25c7122d..b3da2a53 100644
--- a/brain/py2stdlib.py
+++ b/brain/py2stdlib.py
@@ -5,11 +5,14 @@ Currently help understanding of :
* hashlib.md5 and hashlib.sha1
"""
-from astroid import MANAGER
+from astroid import MANAGER, nodes
from astroid.builder import AstroidBuilder
MODULE_TRANSFORMS = {}
+
+# module specific transformation functions #####################################
+
def hashlib_transform(module):
fake = AstroidBuilder(MANAGER).string_build('''
@@ -177,6 +180,6 @@ def transform(module):
tr(module)
from astroid import MANAGER
-MANAGER.register_transformer(transform)
+MANAGER.register_transform(nodes.Module, transform)