

from lib2to3 import fixer_base
from lib2to3.fixer_util import Name, BlankLine


class FixAltUnicode(fixer_base.BaseFix):
    PATTERN = """
    func=funcdef< 'def' name='__unicode__'
                  parameters< '(' NAME ')' > any+ >
    """

    def transform(self, node, results):
        name = results['name']
        name.replace(Name('__str__', prefix=name.prefix))



from lib2to3 import fixer_base


class FixAltUnicode(fixer_base.BaseFix):
    PATTERN = "'__unicode__'"

    def transform(self, node, results):
        new = node.clone()
        new.value = '__str__'
        return new

Simplify python3 unicode fixer and make it replace all occurrences of __unicode__ with __str__.
Simplify python3 unicode fixer and make it replace all occurrences of __unicode__ with __str__.

  
  
  from lib2to3 import fixer_base
- from lib2to3.fixer_util import Name, BlankLine
  
  
  class FixAltUnicode(fixer_base.BaseFix):
+     PATTERN = "'__unicode__'"
-     PATTERN = """
-     func=funcdef< 'def' name='__unicode__'
-                   parameters< '(' NAME ')' > any+ >
-     """
  
      def transform(self, node, results):
-         name = results['name']
-         name.replace(Name('__str__', prefix=name.prefix))
+         new = node.clone()
+         new.value = '__str__'
+         return new
  
Simplify python3 unicode fixer and make it replace all occurrences of __unicode__ with __str__.
## Code Before:


from lib2to3 import fixer_base
from lib2to3.fixer_util import Name, BlankLine


class FixAltUnicode(fixer_base.BaseFix):
    PATTERN = """
    func=funcdef< 'def' name='__unicode__'
                  parameters< '(' NAME ')' > any+ >
    """

    def transform(self, node, results):
        name = results['name']
        name.replace(Name('__str__', prefix=name.prefix))

## Instruction:
Simplify python3 unicode fixer and make it replace all occurrences of __unicode__ with __str__.
## Code After:


from lib2to3 import fixer_base


class FixAltUnicode(fixer_base.BaseFix):
    PATTERN = "'__unicode__'"

    def transform(self, node, results):
        new = node.clone()
        new.value = '__str__'
        return new
