diff options
author | Emile Anclin <emile.anclin@logilab.fr> | 2009-09-02 19:54:09 +0200 |
---|---|---|
committer | Emile Anclin <emile.anclin@logilab.fr> | 2009-09-02 19:54:09 +0200 |
commit | 930357399593b05a4db464cd2a6688dfb4618cdb (patch) | |
tree | eee4e80d20ea67cc46efe03c98a8ad37572a4b97 /utils.py | |
parent | dc5837fbf93e656ec158b072fa2f9520084eb0d1 (diff) | |
download | astroid-git-930357399593b05a4db464cd2a6688dfb4618cdb.tar.gz |
[R] extend_class now extends from a list of classes...
Diffstat (limited to 'utils.py')
-rw-r--r-- | utils.py | 25 |
1 files changed, 13 insertions, 12 deletions
@@ -24,20 +24,21 @@ __docformat__ = "restructuredtext en" from logilab.astng._exceptions import IgnoreChild -def extend_class(original, addons): - """add methods and attribute defined in the addons class to the original +def extend_class(original, class_addons): + """add methods and attribute defined in the addon classes to the original class """ - brain = addons.__dict__.copy() - for special_key in ('__doc__', '__module__', '__dict__'): - if special_key in addons.__dict__: - del brain[special_key] - try: - original.__dict__.update(brain) - except AttributeError: - # dictproxy object - for k, v in brain.iteritems(): - setattr(original, k, v) + for addons in class_addons: + brain = addons.__dict__.copy() + for special_key in ('__doc__', '__module__', '__dict__'): + if special_key in addons.__dict__: + del brain[special_key] + try: + original.__dict__.update(brain) + except AttributeError: + # dictproxy object + for k, v in brain.iteritems(): + setattr(original, k, v) class ASTVisitor(object): |