Skip to content
This repository has been archived by the owner on Jul 22, 2020. It is now read-only.

Add fix_metaclass fixer #7

Merged
merged 1 commit into from
May 20, 2013
Merged

Commits on May 17, 2013

  1. Add fix_metaclass fixer

    This fixer changes any class definition using __metaclass__ to use
    six.with_metaclass():
    
    class Foo(object):
        __metaclass__ = FooMeta
    
    will be changed to:
    
    import six
    class Foo(six.with_metaclass(FooMeta, object)):
        pass
    
    If multiple base classes are encountered a base class that can be
    passed¬
    to six.with_metaclass() will be created dynamically:
    
    class Spam(Foo, Bar):
        __metaclass__ = SpamMeta
    
    class Spam(six.with_metaclass(SpamMeta, type('NewBase', (Foo, bar), {})):¬¬
        pass
    
    This needs to be done because six.with_metaclass() can't handle more
    than one base class.
    DasIch committed May 17, 2013
    1 Configuration menu
    Copy the full SHA
    56fbf20 View commit details
    Browse the repository at this point in the history