fix_basestring.py 394 B

1234567891011121314151617
  1. """
  2. Fixer that adds ``from past.builtins import basestring`` if there is a
  3. reference to ``basestring``
  4. """
  5. from lib2to3 import fixer_base
  6. from libfuturize.fixer_util import touch_import_top
  7. class FixBasestring(fixer_base.BaseFix):
  8. BM_compatible = True
  9. PATTERN = "'basestring'"
  10. def transform(self, node, results):
  11. touch_import_top(u'past.builtins', 'basestring', node)